Hi,
On 3 Jul 2008, at 13:21, jim owens wrote:
Dave Chinner wrote:
xfs_bmap provides an atomic sync and mapping.
By the way, I still fail to see how doing fiemap-with-SYNC
in XFS has any more value than doing fsync(), fiemap().
In both cases the returned extent information is only
guaranteed if there are 0 other threads changing the file.
That's simply wrong.
fsync() followed by fiemap() means that another process/thread can
write to the file in between the two system calls so that the fiemap()
call will return things like delayed allocation regions, etc, which
the caller may not want / may not even be able to know what to do with.
fiemap-with-SYNC does not suffer from this problem because the caller
is guaranteed that the sync will flush everything to disk and then
this state will be returned by the fiemap call.
It is completely irrelevant whether the information is still valid
after the fiemap returns. Any application that calls fiemap and then
goes and reads or writes those blocks on disk is totally brain damaged
and should be sent to bitrot hell. fiemap is about information not
about direct access to disk by user space. That is what O_DIRECT is
for... For example all you need to do as a malicious process/user is
to catch some application that uses fiemap + then writes to disk and
open() the file it does this on and do a truncate(0) on it whilst the
application is writing to the disk. With some luck and good design
you could get the application to overwrite /etc/shadow or to read the
ssh private key, etc at least on some file systems...
(Well OK, it is 1 less system call being made)
That is basically irrelevant on Linux.
Best regards,
Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer, http://www.linux-ntfs.org/
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html