From: David Dillow <dillowd@y12.doe.gov>
To: root@chaos.analogic.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 2.4.19-rc1/2.5.25 provide dummy fsync() routine fordirectories on NFS mounts
Date: Tue, 09 Jul 2002 15:39:22 -0400 [thread overview]
Message-ID: <3D2B3BEA.A89EAB88@y12.doe.gov> (raw)
In-Reply-To: <Pine.LNX.3.95.1020709150615.14559A-100000@chaos.analogic.com>
"Richard B. Johnson" wrote:
>
> On Tue, 9 Jul 2002, Alan Cox wrote:
>
> > > Really? Then what is the meaning of fsync() on a read-only file-
> > > descriptor? You can't update the information you can't change.
> >
> > fsync ensures the data for that inode/file content is on stable storage - note
> > _the_ _data_ not only random things written by this specific file handle.
> >
> flags = fcntl(dirfd, F_GETFL);
> flags &= ~O_RDONLY;
> flags |= O_RDWR;
> fcntl(dirfd, F_SETFL, flags);
Ehh? Not sure what you're doing here...
> fprintf(stderr, "Write %d bytes\n", sizeof(foo) * NR_WRITES);
> for(i=0; i< NR_WRITES; i++)
> write(outfd, foo, sizeof(foo));
> fprintf(stderr, "Write complete\n");
> fprintf(stderr, "Sync the directory\n");
> fsync(dirfd);
> fprintf(stderr, "Done, returns immediately!\n");
> close(outfd);
> fprintf(stderr, "Now execute sync and see if your disk is active!\n");
> // unlink("/foo");
> }
>
> Again, to assure that file-data is written to storage, one must
> execute fsync on files, not directories.
You are correct, but re-read what Alan said -- "fsync ensures the data
for that inode/file content is on stable storage". So your fsync(dirfd)
only makes sure data written to the directory is on disk, i.e. the name
of the new file "foo". sync still causes mucho activity because you did
not fsync the outfd.
> The dummy return of 0,
> that Linux provides is a database bug waiting to happen.
No, the dummy return of 0 from NFS is not a problem, because directory
updates, and indeed all writes, are supposed to be syncronous by
default. There really is no need to fsync on an NFS directory, as the
name should already be on stable storage by the time open() returns.
At least this is my understanding,
D
next prev parent reply other threads:[~2002-07-09 19:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-09 13:49 [PATCH] 2.4.19-rc1/2.5.25 provide dummy fsync() routine for directories " Trond Myklebust
2002-07-09 14:06 ` Richard B. Johnson
2002-07-09 14:08 ` Trond Myklebust
2002-07-09 15:06 ` Richard B. Johnson
2002-07-09 16:56 ` Alan Cox
2002-07-09 17:22 ` Richard B. Johnson
2002-07-09 18:58 ` [NFS] " Bill Rugolsky Jr.
2002-07-09 19:11 ` Alan Cox
2002-07-09 19:13 ` Richard B. Johnson
2002-07-09 19:39 ` David Dillow [this message]
2002-07-09 19:59 ` Alan Cox
2002-07-09 19:50 ` Richard B. Johnson
2002-07-10 6:33 ` Alex Riesen
2002-07-10 11:20 ` Richard B. Johnson
[not found] <20020715075221.GC21470@uncarved.com>
2002-07-15 12:45 ` Richard B. Johnson
2002-07-15 13:35 ` Matthias Andree
2002-07-15 14:49 ` Patrick J. LoPresti
2002-07-15 16:16 ` Alan Cox
2002-07-15 15:38 ` Patrick J. LoPresti
2002-07-15 16:55 ` Alan Cox
2002-07-15 15:29 ` [PATCH] 2.4.19-rc1/2.5.25 provide dummy fsync() routine fordirectories " Sandy Harris
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=3D2B3BEA.A89EAB88@y12.doe.gov \
--to=dillowd@y12.doe.gov \
--cc=linux-kernel@vger.kernel.org \
--cc=root@chaos.analogic.com \
/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
all inboxes | Powered by JetHome®