Do the 'sync' and 'syncfs' system calls map to FUSE's 'fsync' calls? Do the 'sync' and 'syncfs' system calls map to FUSE's 'fsync' calls? linux linux

Do the 'sync' and 'syncfs' system calls map to FUSE's 'fsync' calls?


Looking at the kernel source, it seems that on sync and syncfs any pending writebacks are performed, but fsync is not called (not AFAICS anyway), so there is not really any way to know that sync or syncfs is called.

Relevant code is in https://github.com/torvalds/linux/blob/v4.16/fs/sync.c, e.g. https://github.com/torvalds/linux/blob/v4.16/fs/sync.c#L31-L41

As shown, this calls the fsync_fs operation on the fileystem superblock, but fuse does not define any:

https://github.com/torvalds/linux/blob/v4.16/fs/fuse/inode.c#L803-L814

I also recall reading a mailing list thread about this, which suggested that implementing sync_fs in fuse is non-trivial, since it would allow a fuse filesystem (which might run as a non-privileged user) to block any global sync system calls indefinitely, posing a security (DoS) problem. I can't quite find that thread anymore, though.