Re: [PATCH v3] introduce sys_syncfs to sync a single file system

From: Indan Zupancic
Date: Fri Mar 11 2011 - 18:46:15 EST


On Fri, March 11, 2011 12:55, Arnd Bergmann wrote:
> On Friday 11 March 2011, Indan Zupancic wrote:
>> > http://marc.info/?l=linux-fsdevel&m=127970513829285&w=2
>>
>> The patch there seems much more reasonable than introducing a whole
>> new systemcall just for 20 lines of kernel code. New system calls are
>> added too easily nowadays.
>
> The only problem with adding new system calls is that we are stuck
> with the interface until the end of time, so we must be sure not
> to get it wrong. The same thing is true for any other interface
> such as ioctl or extensions to existing system calls. People usually
> get away with adding new ioctls more easily because it is less
> obvious when they are added.

Agreed.

I'm not sure this feature is important enough to add. I can't really
think of a regular use case where this would be useful, generally
it's transparent on which mount files are. Add symlinks, and you
give users a lot of rope. Any user has to make sure that all the
files they want to sync are on the same file system.

About the arguments against sync(2):

> - On machines with many mounts, it is not at all uncommon for some of
> them to hang (e.g. unresponsive NFS server). sync(2) will get stuck on
> those and may never get to the one you do care about (e.g., /).

It would be better to fix NFS, or mount it with the fsc option (assuming
a sync will write to the local cache instead of hanging forever then).

> - Some applications write lots of data to the file system and then
> want to make sure it is flushed to disk. Calling fsync(2) on each
> file introduces unnecessary ordering constraints that result in a large
> amount of sub-optimal writeback/flush/commit behavior by the file
> system.

You can use sync_file_range() on those files to schedule the writes
and then do the fsync(2) as usual (both on files and dirs).

If there still is a good reason to implement this, please don't add it
as a new system call, but add it to sync_file_range(), as that seems
the best place for odd file synchronisation operations.

Greetings,

Indan


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/