]> git.baikalelectronics.ru Git - kernel.git/commit
fuse: fix flock
authorMiklos Szeredi <mszeredi@suse.cz>
Mon, 8 Aug 2011 14:08:08 +0000 (16:08 +0200)
committerMiklos Szeredi <mszeredi@suse.cz>
Mon, 8 Aug 2011 14:08:08 +0000 (16:08 +0200)
commitc9a7e8344d55fee4b94b8b1d08c17dcb337b3edc
treec36910e300ade812159d12218fdf122b3d2ef3de
parent69e9a2192c04c7ee777a73df83c9d9191b91e915
fuse: fix flock

Commit d5420438 "fuse: support BSD locking semantics" overlooked a
number of issues with supporing flock locks over existing POSIX
locking infrastructure:

  - it's not backward compatible, passing flock(2) calls to userspace
    unconditionally (if userspace sets FUSE_POSIX_LOCKS)

  - it doesn't cater for the fact that flock locks are automatically
    unlocked on file release

  - it doesn't take into account the fact that flock exclusive locks
    (write locks) don't need an fd opened for write.

The last one invalidates the original premise of the patch that flock
locks can be emulated with POSIX locks.

This patch fixes the first two issues.  The last one needs to be fixed
in userspace if the filesystem assumed that a write lock will happen
only on a file operned for write (as in the case of the current fuse
library).

Reported-by: Sebastian Pipping <webmaster@hartwork.org>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
fs/fuse/file.c
fs/fuse/fuse_i.h
fs/fuse/inode.c
include/linux/fuse.h