Merge tag 'mailbox-v6.3' of git://git.linaro.org/landing-teams/working/fujitsu/integr...
[linux-2.6-microblaze.git] / fs / namespace.c
index 5927d90..bc0f152 100644 (file)
@@ -1283,6 +1283,17 @@ struct vfsmount *mntget(struct vfsmount *mnt)
 }
 EXPORT_SYMBOL(mntget);
 
+/*
+ * Make a mount point inaccessible to new lookups.
+ * Because there may still be current users, the caller MUST WAIT
+ * for an RCU grace period before destroying the mount point.
+ */
+void mnt_make_shortterm(struct vfsmount *mnt)
+{
+       if (mnt)
+               real_mount(mnt)->mnt_ns = NULL;
+}
+
 /**
  * path_is_mountpoint() - Check if path is a mount in the current namespace.
  * @path: path to check
@@ -4459,8 +4470,8 @@ EXPORT_SYMBOL_GPL(kern_mount);
 void kern_unmount(struct vfsmount *mnt)
 {
        /* release long term mount so mount point can be released */
-       if (!IS_ERR_OR_NULL(mnt)) {
-               real_mount(mnt)->mnt_ns = NULL;
+       if (!IS_ERR(mnt)) {
+               mnt_make_shortterm(mnt);
                synchronize_rcu();      /* yecchhh... */
                mntput(mnt);
        }
@@ -4472,8 +4483,7 @@ void kern_unmount_array(struct vfsmount *mnt[], unsigned int num)
        unsigned int i;
 
        for (i = 0; i < num; i++)
-               if (mnt[i])
-                       real_mount(mnt[i])->mnt_ns = NULL;
+               mnt_make_shortterm(mnt[i]);
        synchronize_rcu_expedited();
        for (i = 0; i < num; i++)
                mntput(mnt[i]);