From 3efe1ac78e996da8e141b86667cc15758aad4366 Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Mon, 14 Apr 2014 00:26:51 -0700 Subject: [PATCH] vfs: Block intuitively in the case of BSD accounting files 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" --- fs/namespace.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/namespace.c b/fs/namespace.c index 1d92f888f4dc..128c051041be 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -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); -- 2.39.5