tree 191f9386a8288e06d7d0e914434aea2f9a56e1ca
parent 24ca2af1e7cff55e71e9f86c61ddc56e894b8b40
author Miklos Szeredi <[EMAIL PROTECTED]> Fri, 08 Jul 2005 07:57:26 -0700
committer Linus Torvalds <[EMAIL PROTECTED]> Fri, 08 Jul 2005 08:23:51 -0700

[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 <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Acked-by: Christoph Hellwig <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 fs/namespace.c |    9 +++++++++
 1 files changed, 9 insertions(+)

diff --git a/fs/namespace.c b/fs/namespace.c
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -830,6 +830,15 @@ static void expire_mount(struct vfsmount
        spin_lock(&vfsmount_lock);
 
        /*
+        * Check if mount is still attached, if not, let whoever holds it deal
+        * with the sucker
+        */
+       if (mnt->mnt_parent == mnt) {
+               spin_unlock(&vfsmount_lock);
+               return;
+       }
+
+       /*
         * Check that it is still dead: the count should now be 2 - as
         * contributed by the vfsmount parent and the mntget above
         */
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to