aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2005-07-07 20:57:26 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-07 21:23:51 -0400
commited42c879b7b1463aa7a15fdbbeb2b1914d60be8a (patch)
tree191f9386a8288e06d7d0e914434aea2f9a56e1ca
parent24ca2af1e7cff55e71e9f86c61ddc56e894b8b40 (diff)
[PATCH] namespace.c: fix expiring of detached mount
This patch fixes a bug noticed by Al Viro: However, we still have a problem here - just what would happen if vfsmount is detached while we were grabbing namespace semaphore? Refcount alone is not useful here - we might be held by whoever had detached the vfsmount. IOW, we should check that it's still attached (i.e. that mnt->mnt_parent != mnt). If it's not - just leave it alone, do mntput() and let whoever holds it deal with the sucker. No need to put it back on lists. Signed-off-by: Miklos Szeredi <miklos@szeredi.hu> Cc: <viro@parcelfarce.linux.theplanet.co.uk> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/namespace.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index d82cf18a1a94..2b4635e43ae8 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -830,6 +830,15 @@ static void expire_mount(struct vfsmount *mnt, struct list_head *mounts)
830 spin_lock(&vfsmount_lock); 830 spin_lock(&vfsmount_lock);
831 831
832 /* 832 /*
833 * Check if mount is still attached, if not, let whoever holds it deal
834 * with the sucker
835 */
836 if (mnt->mnt_parent == mnt) {
837 spin_unlock(&vfsmount_lock);
838 return;
839 }
840
841 /*
833 * Check that it is still dead: the count should now be 2 - as 842 * Check that it is still dead: the count should now be 2 - as
834 * contributed by the vfsmount parent and the mntget above 843 * contributed by the vfsmount parent and the mntget above
835 */ 844 */