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" <ebied...@xmission.com>
---
 fs/namespace.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index ac589ad9f22d..b10db3d69943 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1015,11 +1015,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)) {
@@ -1048,7 +1051,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);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to