diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2016-09-16 13:44:20 +0300 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2016-09-16 13:44:20 +0300 |
commit | c568d68341be7030f5647def68851e469b21ca11 (patch) | |
tree | fe205e47e6d6d292557580c16ea0186a05752634 /fs/overlayfs | |
parent | f3fbbb079263bd29ae592478de6808db7e708267 (diff) | |
download | linux-c568d68341be7030f5647def68851e469b21ca11.tar.xz |
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>
Diffstat (limited to 'fs/overlayfs')
-rw-r--r-- | fs/overlayfs/super.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index e2a94a26767b..3d0b9dee2b76 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -1320,7 +1320,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) sb->s_xattr = ovl_xattr_handlers; sb->s_root = root_dentry; sb->s_fs_info = ufs; - sb->s_flags |= MS_POSIXACL; + sb->s_flags |= MS_POSIXACL | MS_NOREMOTELOCK; return 0; |