Patch "ovl: proper cleanup of workdir" has been added to the 4.7-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
ovl: proper cleanup of workdir
to the 4.7-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-proper-cleanup-of-workdir.patch
and it can be found in the queue-4.7 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
eea2fb4851e9dcbab6b991aaf47e2e024f1f55a0Mon Sep 17 00:00:00 2001
From: Miklos Szeredi <[email protected]>
Date: Thu, 1 Sep 2016 11:11:59 +0200
Subject: ovl: proper cleanup of workdir
From: Miklos Szeredi <[email protected]>
commit eea2fb4851e9dcbab6b991aaf47e2e024f1f55a0 upstream.
When mounting overlayfs it needs a clean "work" directory under the supplied workdir.
Previously the mount code removed this directory if it already existed and created a new one. If the removal failed (e.g. directory was not empty) then it fell back to a read-only mount not using the workdir.
While this has never been reported, it is possible to get a non-empty "work" dir from a previous mount of overlayfs in case of crash in the middle of an operation using the work directory.
In this case the left over state should be discarded and the overlay filesystem will be consistent, guaranteed by the atomicity of operations on moving to/from the workdir to the upper layer.
This patch implements cleaning out any files left in workdir. It is implemented using real recursion for simplicity, but the depth is limited to 2, because the worst case is that of a directory containing whiteouts under "work".
--- fs/overlayfs/overlayfs.h | 2 + fs/overlayfs/readdir.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++- fs/overlayfs/super.c | 2 - 3 files changed, 65 insertions(+), 2 deletions(-)
fs/overlayfs/overlayfs.h +2 -0
@@ -168,6 +168,8 @@ int ovl_check_empty_dir(struct dentry *dvoid ovl_cleanup_whiteouts (struct dentry *upper,struct list_head *list);void ovl_cache_free (struct list_head *list);int ovl_check_d_type_supported (struct path *realpath); +void ovl_workdir_cleanup (struct inode *dir,struct vfsmount *mnt, +struct dentry *dentry,int level);/* inode.c */ int ovl_setattr (struct dentry *dentry,struct iattr *attr);
fs/overlayfs/readdir.c +62 -1
72 lines not on this page · raw message
fs/overlayfs/super.c +1 -1
@@ -805,7 +805,7 @@ retry: goto out_dput; retried = true; -ovl_cleanup (dir, work); +ovl_workdir_cleanup (dir, mnt, work,0 );dput (work); goto retry; }
Patches currently in stable-queue which might be from [email protected] are
queue-4.7/ovl-listxattr-use-strnlen.patch queue-4.7/ovl-remove-posix_acl_default-from-workdir.patch queue-4.7/ovl-don-t-copy-up-opaqueness.patch queue-4.7/ovl-proper-cleanup-of-workdir.patch queue-4.7/ovl-fix-workdir-creation.patch