Patch "ovl: take mnt_want_write() for work/index dir setup" has been added to the 4.15-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
ovl: take mnt_want_write() for work/index dir setup
to the 4.15-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
ovl-take-mnt_want_write-for-work-index-dir-setup.patch
and it can be found in the queue-4.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
2ba9d57e65044859f7ff133bcb0a902769bf3bc6Mon Sep 17 00:00:00 2001
From: Amir Goldstein <[email protected]>
Date: Wed, 3 Jan 2018 18:54:41 +0200
Subject: ovl: take mnt_want_write() for work/index dir setup
From: Amir Goldstein <[email protected]>
commit 2ba9d57e65044859f7ff133bcb0a902769bf3bc6 upstream.
There are several write operations on upper fs not covered by mnt_want_write():
- test set/remove OPAQUE xattr
- test create O_TMPFILE
- set ORIGIN xattr in ovl_verify_origin()
- cleanup of index entries in ovl_indexdir_cleanup()
Some of these go way back, but this patch only applies over the v4.14 re-factoring of ovl_fill_super().
--- fs/overlayfs/super.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
fs/overlayfs/super.c +17 -8
@@ -520,10 +520,6 @@ static struct dentry *ovl_workdir_createbool retried = false;bool locked = false; - err =mnt_want_write (mnt); -if (err) - goto out_err; -inode_lock_nested (dir,I_MUTEX_PARENT ); locked = true;
@@ -588,7 +584,6 @@ retry: goto out_err; } out_unlock: -mnt_drop_write (mnt);if (locked)inode_unlock (dir);
@@ -930,12 +925,17 @@ out:static int ovl_make_workdir (struct ovl_fs *ofs,struct path *workpath) { +struct vfsmount *mnt = ofs->upper_mnt;struct dentry *temp;int err; + err =mnt_want_write (mnt); +if (err) +return err; + ofs->workdir =ovl_workdir_create (ofs,OVL_WORKDIR_NAME , false);if (!ofs->workdir) -return 0 ; + goto out;/* * Upper should support d_type, else whiteouts are visible. Given
@@ -945,7 +945,7 @@ static int ovl_make_workdir(struct ovl_f*/ err =ovl_check_d_type_supported (workpath);if (err <0 ) -return err; + goto out;/* * We allowed this configuration and don't want to break users over
@@ -969,6 +969,7 @@ static int ovl_make_workdir(struct ovl_fif (err) { ofs->noxattr = true;pr_warn ("overlayfs: upper fs does not support xattr.\n" ); + err =0 ; }else {vfs_removexattr (ofs->workdir,OVL_XATTR_OPAQUE ); }
@@ -980,7 +981,9 @@ static int ovl_make_workdir(struct ovl_fpr_warn ("overlayfs: upper fs does not support file handles, falling back to index=off.\n" ); } -return 0 ; +out: +mnt_drop_write (mnt); +return err; }static int ovl_get_workdir (struct ovl_fs *ofs,struct path *upperpath)
@@ -1027,8 +1030,13 @@ out:static int ovl_get_indexdir (struct ovl_fs *ofs,struct ovl_entry *oe,struct path *upperpath) { +struct vfsmount *mnt = ofs->upper_mnt;int err; + err =mnt_want_write (mnt); +if (err) +return err; +/* Verify lower root is upper root origin */ err =ovl_verify_origin (upperpath->dentry, oe->lowerstack[0 ].dentry, false, true);
@@ -1056,6 +1064,7 @@ static int ovl_get_indexdir(struct ovl_fpr_warn ("overlayfs: try deleting index dir or mounting with '-o index=off' to disable inodes index.\n" ); out: +mnt_drop_write (mnt);return err; }
Patches currently in stable-queue which might be from [email protected] are
queue-4.15/ovl-take-mnt_want_write-for-removing-impure-xattr.patch queue-4.15/ovl-take-mnt_want_write-for-work-index-dir-setup.patch queue-4.15/ovl-hash-directory-inodes-for-fsnotify.patch queue-4.15/ovl-force-r-o-mount-when-index-dir-creation-fails.patch queue-4.15/ovl-fix-failure-to-fsync-lower-dir.patch