Patch "mnt: Improve the umount_tree flags" has been added to the 4.0-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
mnt: Improve the umount_tree flags
to the 4.0-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:
mnt-improve-the-umount_tree-flags.patch
and it can be found in the queue-4.0 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
e819f152104c9f7c9fe50e1aecce6f5d4bf06d65Mon Sep 17 00:00:00 2001
From: "Eric W. Biederman" <[email protected]>
Date: Wed, 24 Dec 2014 07:20:01 -0600
Subject: mnt: Improve the umount_tree flags
From: "Eric W. Biederman" <[email protected]>
commit e819f152104c9f7c9fe50e1aecce6f5d4bf06d65 upstream.
- Remove the unneeded declaration from pnode.h
- Mark umount_tree static as it has no callers outside of namespace.c
- Define an enumeration of umount_tree's flags.
- Pass umount_tree's flags in by name
This removes the magic numbers 0, 1 and 2 making the code a little clearer and makes it possible for there to be lazy unmounts that don't propagate. Which is what __detach_mounts actually wants for example.
--- fs/namespace.c | 31 ++++++++++++++++--------------- fs/pnode.h | 1 - 2 files changed, 16 insertions(+), 16 deletions(-)
fs/namespace.c +16 -15
@@ -1319,14 +1319,15 @@ static inline void namespace_lock(void)down_write (&namespace_sem); } +enum umount_tree_flags { +UMOUNT_SYNC =1 , +UMOUNT_PROPAGATE =2 , +};/* * mount_lock must be held * namespace_sem must be held for write -* how = 0 => just this tree, don't propagate -* how = 1 => propagate; we know that nobody else has reference to any victims -* how = 2 => lazy umount */ -void umount_tree (struct mount *mnt,int how) +static void umount_tree (struct mount *mnt,enum umount_tree_flags how) {HLIST_HEAD (tmp_list);struct mount *p;
@@ -1339,7 +1340,7 @@ void umount_tree(struct mount *mnt, inthlist_for_each_entry (p, &tmp_list, mnt_hash)list_del_init (&p->mnt_child); -if (how) +if (how &UMOUNT_PROPAGATE )propagate_umount (&tmp_list);while (!hlist_empty (&tmp_list)) {
@@ -1349,7 +1350,7 @@ void umount_tree(struct mount *mnt, intlist_del_init (&p->mnt_list);__touch_mnt_namespace (p->mnt_ns); p->mnt_ns =NULL ; -if (how <2 ) +if (how &UMOUNT_SYNC ) p->mnt.mnt_flags |=MNT_SYNC_UMOUNT ;pin_insert_group (&p->mnt_umount, &p->mnt_parent->mnt, &unmounted);
@@ -1447,14 +1448,14 @@ static int do_umount(struct mount *mnt,if (flags &MNT_DETACH ) {if (!list_empty (&mnt->mnt_list)) -umount_tree (mnt,2 ); +umount_tree (mnt,UMOUNT_PROPAGATE ); retval =0 ; }else {shrink_submounts (mnt); retval = -EBUSY ;if (!propagate_mount_busy (mnt,2 )) {if (!list_empty (&mnt->mnt_list)) -umount_tree (mnt,1 ); +umount_tree (mnt,UMOUNT_PROPAGATE |UMOUNT_SYNC ); retval =0 ; } }
@@ -1486,7 +1487,7 @@ void __detach_mounts(struct dentry *dentlock_mount_hash ();while (!hlist_empty (&mp->m_list)) { mnt = hlist_entry(mp->m_list.first, struct mount, mnt_mp_list); -umount_tree (mnt,2 ); +umount_tree (mnt,UMOUNT_PROPAGATE ); }unlock_mount_hash ();put_mountpoint (mp);
@@ -1648,7 +1649,7 @@ struct mount *copy_tree(struct mount *mn out:if (res) {lock_mount_hash (); -umount_tree (res,0 ); +umount_tree (res,UMOUNT_SYNC );unlock_mount_hash (); }return q;
@@ -1672,7 +1673,7 @@ void drop_collected_mounts(struct vfsmou {namespace_lock ();lock_mount_hash (); -umount_tree (real_mount (mnt),0 ); +umount_tree (real_mount (mnt),UMOUNT_SYNC );unlock_mount_hash ();namespace_unlock (); }
@@ -1855,7 +1856,7 @@ static int attach_recursive_mnt(struct m out_cleanup_ids:while (!hlist_empty (&tree_list)) { child = hlist_entry(tree_list.first, struct mount, mnt_hash); -umount_tree (child,0 ); +umount_tree (child,UMOUNT_SYNC ); }unlock_mount_hash ();cleanup_group_ids (source_mnt,NULL );
@@ -2035,7 +2036,7 @@ static int do_loopback(struct path *path err =graft_tree (mnt, parent, mp);if (err) {lock_mount_hash (); -umount_tree (mnt,0 ); +umount_tree (mnt,UMOUNT_SYNC );unlock_mount_hash (); } out2:
@@ -2406,7 +2407,7 @@ void mark_mounts_for_expiry(struct list_while (!list_empty (&graveyard)) { mnt = list_first_entry(&graveyard, struct mount, mnt_expire);touch_mnt_namespace (mnt->mnt_ns); -umount_tree (mnt,1 ); +umount_tree (mnt,UMOUNT_PROPAGATE |UMOUNT_SYNC ); }unlock_mount_hash ();namespace_unlock ();
@@ -2477,7 +2478,7 @@ static void shrink_submounts(struct moun m = list_first_entry(&graveyard, struct mount, mnt_expire);touch_mnt_namespace (m->mnt_ns); -umount_tree (m,1 ); +umount_tree (m,UMOUNT_PROPAGATE |UMOUNT_SYNC ); } } }
fs/pnode.h +0 -1
@@ -47,7 +47,6 @@ int get_dominating_id(struct mount *mnt,unsigned int mnt_get_count (struct mount *mnt);void mnt_set_mountpoint (struct mount *,struct mountpoint *,struct mount *); -void umount_tree (struct mount *,int );struct mount *copy_tree (struct mount *,struct dentry *,int );bool is_path_reachable (struct mount *,struct dentry *,const struct path *root);
Patches currently in stable-queue which might be from [email protected] are
queue-4.0/mnt-don-t-propagate-umounts-in-__detach_mounts.patch queue-4.0/mnt-add-mnt_umount-flag.patch queue-4.0/mnt-honor-mnt_locked-when-detaching-mounts.patch queue-4.0/mnt-delay-removal-from-the-mount-hash.patch queue-4.0/mnt-on-an-unmount-propagate-clearing-of-mnt_locked.patch queue-4.0/mnt-don-t-propagate-unmounts-to-locked-mounts.patch queue-4.0/mnt-factor-out-unhash_mnt-from-detach_mnt-and-umount_tree.patch queue-4.0/mnt-factor-umount_mnt-from-umount_tree.patch queue-4.0/mnt-fix-the-error-check-in-__detach_mounts.patch queue-4.0/mnt-update-detach_mounts-to-leave-mounts-connected.patch queue-4.0/mnt-improve-the-umount_tree-flags.patch queue-4.0/mnt-in-umount_tree-reuse-mnt_list-instead-of-mnt_hash.patch