aboutsummaryrefslogtreecommitdiffstats
path: root/fs/overlayfs/ovl_entry.h
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2017-06-21 15:28:33 +0300
committerMiklos Szeredi <mszeredi@redhat.com>2017-07-04 22:03:17 +0200
commit2cac0c00a6cdcc9121de150ed531f652396d1544 (patch)
tree2c0d163277aad85c8226ed385735fc4f40bde939 /fs/overlayfs/ovl_entry.h
parentvfs: introduce inode 'inuse' lock (diff)
downloadlinux-dev-2cac0c00a6cdcc9121de150ed531f652396d1544.tar.xz
linux-dev-2cac0c00a6cdcc9121de150ed531f652396d1544.zip
ovl: get exclusive ownership on upper/work dirs
Bad things can happen if several concurrent overlay mounts try to use the same upperdir/workdir path. Try to get the 'inuse' advisory lock on upperdir and workdir. Fail mount if another overlay mount instance or another user holds the 'inuse' lock on these directories. Note that this provides no protection for concurrent overlay mount that use overlapping (i.e. descendant) upper/work dirs. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs/ovl_entry.h')
-rw-r--r--fs/overlayfs/ovl_entry.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/overlayfs/ovl_entry.h b/fs/overlayfs/ovl_entry.h
index 6a90a48c3589..5b5a32116424 100644
--- a/fs/overlayfs/ovl_entry.h
+++ b/fs/overlayfs/ovl_entry.h
@@ -21,6 +21,9 @@ struct ovl_fs {
struct vfsmount *upper_mnt;
unsigned numlower;
struct vfsmount **lower_mnt;
+ /* workbasedir is the path at workdir= mount option */
+ struct dentry *workbasedir;
+ /* workdir is the 'work' directory under workbasedir */
struct dentry *workdir;
long namelen;
/* pathnames of lower and upper dirs, for show_options */