Re: [MC] [CHECKER] Do ext2, jfs and reiserfs respect mount -o sync/dirsync option?

Andrew Morton
2005-03-05T00:36:55Z

Junfeng Yang <yjf@stanford.edu> wrote:
>
> > >From a quick parse, ext2 seems to be full of MS_SYNCHRONOUS holes, and
> > there might be some O_SYNC ones there as well.
>
> I should be able to easily add O_SYNC check to FiSC. Several questions:
> 1. Does O_SYNC apply to directory as well?

Only if you can open directores for writing ;)

> 2. For the same file, if I open twice, once with O_SYNC and another time
> without, only writes through the O_SYNC fd will be sychonous, right?

Yes, O_SYNC is a per-fd thing.

> 3. I open a file w/o O_SYNC, issue a bunch of writes, then call
> ioctl(FIOASYNC) to set the fd sync, then issure a second set of writes.
> Only the second set of writes are synchronous?

FIOSYNC is unrelated to O_SYNC. OSYNC can only be set at open().

> btw, man page show that O_DSYNC and O_RSYNC are just O_SYNC. Is this true
> for current linux kernel (2.6)?

The kernel only supports O_SYNC (equivalent behaviour to O_RSYNC|O_DSYNC).
Perhaps glibc does a conversion.

> > So this wild scattergun patch probably does extra work and possibly extra
> > I/O all over the place, but I'd be interested if Junfeng could give it a
> > quick test. It's against 2.6.11.
>
> I checked 2.6.11 with your patch just now. Looks like the problem is
> still there. If you need more information, let me know. Image is at
> http://fisc.stanford.edu/bug2/crash-1.img.bz2. Below is the output from
> e2fsck.

ugh. Thanks.