summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2016-10-24 16:16:13 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-07-21 07:44:57 +0200
commitfdb8f10499924d96b8eb60cc1354b278f6fcf0e9 (patch)
tree47beaa387982c03609752e7c9937fbf793f5d6db /firmware
parent7cbc3955ef3b5bda9336654f1b10a803202e7ed0 (diff)
downloadlinux-stable-fdb8f10499924d96b8eb60cc1354b278f6fcf0e9.tar.gz
linux-stable-fdb8f10499924d96b8eb60cc1354b278f6fcf0e9.tar.bz2
linux-stable-fdb8f10499924d96b8eb60cc1354b278f6fcf0e9.zip
mnt: In propgate_umount handle visiting mounts in any order
commit 99b19d16471e9c3faa85cad38abc9cbbe04c6d55 upstream. While investigating some poor umount performance I realized that in the case of overlapping mount trees where some of the mounts are locked the code has been failing to unmount all of the mounts it should have been unmounting. This failure to unmount all of the necessary mounts can be reproduced with: $ cat locked_mounts_test.sh mount -t tmpfs test-base /mnt mount --make-shared /mnt mkdir -p /mnt/b mount -t tmpfs test1 /mnt/b mount --make-shared /mnt/b mkdir -p /mnt/b/10 mount -t tmpfs test2 /mnt/b/10 mount --make-shared /mnt/b/10 mkdir -p /mnt/b/10/20 mount --rbind /mnt/b /mnt/b/10/20 unshare -Urm --propagation unchaged /bin/sh -c 'sleep 5; if [ $(grep test /proc/self/mountinfo | wc -l) -eq 1 ] ; then echo SUCCESS ; else echo FAILURE ; fi' sleep 1 umount -l /mnt/b wait %% $ unshare -Urm ./locked_mounts_test.sh This failure is corrected by removing the prepass that marks mounts that may be umounted. A first pass is added that umounts mounts if possible and if not sets mount mark if they could be unmounted if they weren't locked and adds them to a list to umount possibilities. This first pass reconsiders the mounts parent if it is on the list of umount possibilities, ensuring that information of umoutability will pass from child to mount parent. A second pass then walks through all mounts that are umounted and processes their children unmounting them or marking them for reparenting. A last pass cleans up the state on the mounts that could not be umounted and if applicable reparents them to their first parent that remained mounted. While a bit longer than the old code this code is much more robust as it allows information to flow up from the leaves and down from the trunk making the order in which mounts are encountered in the umount propgation tree irrelevant. Fixes: 0c56fe31420c ("mnt: Don't propagate unmounts to locked mounts") Reviewed-by: Andrei Vagin <avagin@virtuozzo.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'firmware')
0 files changed, 0 insertions, 0 deletions