From mboxrd@z Thu Jan 1 00:00:00 1970 From: ebiederm@xmission.com (Eric W. Biederman) Subject: [PATCH 4/4] vfs: Block intuitively in the case of BSD accounting files Date: Mon, 14 Apr 2014 00:42:09 -0700 Message-ID: <87bnw4uzla.fsf_-_@x220.int.ebiederm.org> References: <87sipmbe8x.fsf@x220.int.ebiederm.org> <20140409175322.GZ18016@ZenIV.linux.org.uk> <20140409182830.GA18016@ZenIV.linux.org.uk> <87txa286fu.fsf@x220.int.ebiederm.org> <87fvlm860e.fsf_-_@x220.int.ebiederm.org> <20140409232423.GB18016@ZenIV.linux.org.uk> <87lhva5h4k.fsf@x220.int.ebiederm.org> <20140413053956.GM18016@ZenIV.linux.org.uk> <87zjjp3e7w.fsf@x220.int.ebiederm.org> <87ppkl1xb7.fsf@x220.int.ebiederm.org> <20140413215242.GP18016@ZenIV.linux.org.uk> <87y4z8uzqw.fsf_-_@x220.int.ebiederm.org> Mime-Version: 1.0 Content-Type: text/plain Cc: Linus Torvalds , "Serge E. Hallyn" , Linux-Fsdevel , Kernel Mailing List , Andy Lutomirski , Rob Landley , Miklos Szeredi , Christoph Hellwig , Karel Zak , "J. Bruce Fields" , Fengguang Wu , tytso@mit.edu To: Al Viro Return-path: In-Reply-To: <87y4z8uzqw.fsf_-_@x220.int.ebiederm.org> (Eric W. Biederman's message of "Mon, 14 Apr 2014 00:38:47 -0700") Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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 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