mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
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 <[email protected]> Acked-by: Jeff Layton <[email protected]> Cc: "J. Bruce Fields" <[email protected]>
This commit is contained in:
parent
f3fbbb0792
commit
c568d68341
6 changed files with 46 additions and 27 deletions
|
|
@ -726,7 +726,7 @@ static int do_dentry_open(struct file *f,
|
|||
if (error)
|
||||
goto cleanup_all;
|
||||
|
||||
error = break_lease(inode, f->f_flags);
|
||||
error = break_lease(locks_inode(f), f->f_flags);
|
||||
if (error)
|
||||
goto cleanup_all;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue