Re: fgetattr/fsetattr file operation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Miklos Szeredi wrote:
> On Thu, 4 Jun 2009, Brian Molnar wrote:
> > > On Thu, Jun 4, 2009 at 12:04 PM, Andreas Dilger <adilger@xxxxxxx> wrote:
> > > This sounds very strange - different processes (or even the same
> > > process using different file handles) will see different results
> > > for fstat() which are yet different from stat().  I can't imagine
> > > that applications would like this at all.
> > 
> > Ya, no doubt a good deal of applications would get very confused if
> > they didn't know the difference. And it is not the goal of this FS to
> > support the use of general applications.
> 
> Actually, well written applications shouldn't assume that
> fd=open(path);fstat(fd) is equivalent to fd=open(path);stat(path).
> Why?  Because the second one is racy wrt. remove and rename.

No, but well written applications can and do assume this:

    st1=stat(path)

    ...time passes, maybe do some filesystem operations, talk on the network...

    fd=open(path)
    st2=fstat(fd)

    if (st1!=st2)
        abort or loop "Race happened, something changed under me..."

-- Jamie
--
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

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux