]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
vfs: Block intuitively in the case of BSD accounting files
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 14 Apr 2014 07:26:51 +0000 (00:26 -0700)
committerEric W. Biederman <ebiederm@xmission.com>
Wed, 16 Apr 2014 00:18:09 +0000 (17:18 -0700)
Have the mntput that started the BSD accounting files closing block
until the superblock has been succesfully freed.  This is what used to
happen until fput started calling mntput assynchronously, and is arguably
the right thing to do in the case of umount.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
fs/namespace.c

index 1d92f888f4dc6786dfc083741111c9b600adbc45..128c051041be8811d754f2a6e0d2c29340a3c055 100644 (file)
@@ -985,11 +985,14 @@ static void mntput_no_expire(struct mount *mnt)
                return;
        }
        if (unlikely(mnt->mnt_pinned)) {
+               init_completion(&undone);
+               mnt->mnt_undone = &undone;
                mnt_add_count(mnt, mnt->mnt_pinned);
                mnt->mnt_pinned = 0;
                rcu_read_unlock();
                unlock_mount_hash();
                acct_auto_close_mnt(&mnt->mnt);
+               wait_for_completion(&undone);
                return;
        }
        if (unlikely(mnt->mnt.mnt_flags & MNT_DOOMED)) {
@@ -1018,7 +1021,10 @@ static void mntput_no_expire(struct mount *mnt)
         * queue where the stack is guaranteed to be shallow.
         */
        init_completion(&undone);
-       mnt->mnt_undone = &undone;
+       if (!mnt->mnt_undone)
+               mnt->mnt_undone = &undone;
+       else
+               complete(&undone);
 
        INIT_WORK(&mnt->mnt_cleanup_work, cleanup_mnt_work);
        schedule_work(&mnt->mnt_cleanup_work);