Re: [PATCH] Allow O_SYNC to be set by fcntl(F_SETFL)

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

 



On Fri, 08 Apr 2011 13:39:16 -0400
Steve Rago <sar@xxxxxxxxxxxx> wrote:

> > I wonder if we should sync the file when someone sets O_SYNC this way.
> > If we don't then there is a period during which we have an fd which has
> > O_SYNC set, but it has pending unwritten data.  An O_SYNC fd should
> > never be in such a state!
> 
> Why not?

Because it's inconsistent.  An O_SYNC fd never has outstanding writeout. 
Except for in this one new and special time window between a setfl()
and the next write().

It's not a big deal, but it's somewhat ugly and merits thinking about.

>  If I write something in non-synchronous mode, then change the file descriptor to synchronous mode, I should 
> not make any assumptions about what was written prior to this point.  If I care that much, I'll call fsync.

Well.  You can call fsync() after every write() too.

>  All that 
> matters is that the operating system honors the contract as specified by the system call API.

There's a lot more to it than that.  Things like
quality-of-implementation and principle-of-least-surprise.  We used to
have a particular relationship between an O_SYNC fd and the state of
the inode which it represents.  With this patch, that relationship no
longer holds.

As I say: not a big deal IMO, but it should be aired and thought about.
--
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