]> git.baikalelectronics.ru Git - kernel.git/commit
locks: fix file locking on overlayfs
authorMiklos Szeredi <mszeredi@redhat.com>
Fri, 16 Sep 2016 10:44:20 +0000 (12:44 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Fri, 16 Sep 2016 10:44:20 +0000 (12:44 +0200)
commitfa05214403fc3eb91fa058829d43f63787a5b1c5
treefe205e47e6d6d292557580c16ea0186a05752634
parent3546d51a56390ba29e7b1ff596200ccea8cc2da0
locks: fix file locking on overlayfs

This patch allows flock, posix locks, ofd locks and leases to work
correctly on overlayfs.

Instead of using the underlying inode for storing lock context use the
overlay inode.  This allows locks to be persistent across copy-up.

This is done by introducing locks_inode() helper and using it instead of
file_inode() to get the inode in locking code.  For non-overlayfs the two
are equivalent, except for an extra pointer dereference in locks_inode().

Since lock operations are in "struct file_operations" we must also make
sure not to call underlying filesystem's lock operations.  Introcude a
super block flag MS_NOREMOTELOCK to this effect.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Acked-by: Jeff Layton <jlayton@poochiereds.net>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
fs/locks.c
fs/namespace.c
fs/open.c
fs/overlayfs/super.c
include/linux/fs.h
include/uapi/linux/fs.h