linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jamie Lokier <jamie@shareable.org>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: brian.molnar@gmail.com, adilger@sun.com, linux-fsdevel@vger.kernel.org
Subject: Re: fgetattr/fsetattr file operation
Date: Mon, 8 Jun 2009 02:59:43 +0100	[thread overview]
Message-ID: <20090608015943.GM15426@shareable.org> (raw)
In-Reply-To: <E1MCWll-0007cR-RD@pomaz-ex.szeredi.hu>

Miklos Szeredi wrote:
> On Thu, 4 Jun 2009, Brian Molnar wrote:
> > > On Thu, Jun 4, 2009 at 12:04 PM, Andreas Dilger <adilger@sun.com> 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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2009-06-08  1:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-03 17:32 fgetattr/fsetattr file operation Brian Molnar
2009-06-04 10:27 ` Miklos Szeredi
2009-06-04 17:42   ` Brian Molnar
2009-06-04 19:04     ` Andreas Dilger
2009-06-04 19:46       ` Brian Molnar
2009-06-05 10:35         ` Miklos Szeredi
2009-06-08  1:59           ` Jamie Lokier [this message]
2009-06-08 22:26             ` Brian Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090608015943.GM15426@shareable.org \
    --to=jamie@shareable.org \
    --cc=adilger@sun.com \
    --cc=brian.molnar@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).