[PATCH] Add man page for vfs_syncops

Christoph Hellwig hch at infradead.org
Fri Aug 9 08:13:33 MDT 2013


On Fri, Aug 09, 2013 at 07:42:46AM -0400, Ira Cooper wrote:
> > I don't know a single Unix filesystems from the last 40 years where this
> > is not true.  Why isn't this the default behaviour in Samba instead of
> > having it in a module that very few people are going to use?
> >
> 
> ZFS behaves correctly here.

I'm not sure what your defintion of correct is, but ZFS behaves just
like I explained above (which for a local filesystem falls under correct
for me).

Even the code implementing it looks similar to what you'd see for other
filesystems - transactions just get greated and commited, but the log
only gets forced out if a per-fs sync flag is set, in the zfs cases this
looks like:

	if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
		zil_commit(zilog, 0);

(the above is for the sync=always property, which is equivalent to the
sync mount option in Linux, or the wsync option in IRIX.

> And fsync only guarantees a file is correct,
> not the filesystem.

fsync guaranteed the file behind the file descriptor is written back,
which might also be a directory.  While Posix doesn't mention
directories explicitly the fact that fsync is explicitly required to
work on read-only file descriptors is an artefact of this that made it
into the standard.

Calling fsync after directory operations is the most portable way to
force directory operations to disk, and if you can actually find a
filesystem where it's not required it should at least be harmless as
there won't be anything left to sync on this fd.

> So, I 100% see the need for this.  And I'd want there to at least be a flag
> to disable it.

If I wasn't clear enough - I agree with the need, but it should be the
default and not hidden in an obscure VFS module.



More information about the samba-technical mailing list