From patchwork Wed Jun 17 07:51:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 6622571 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E85EBC0433 for ; Wed, 17 Jun 2015 07:51:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 18F7220834 for ; Wed, 17 Jun 2015 07:51:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2655420836 for ; Wed, 17 Jun 2015 07:51:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758120AbbFQHva (ORCPT ); Wed, 17 Jun 2015 03:51:30 -0400 Received: from mail-pd0-f179.google.com ([209.85.192.179]:35182 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758112AbbFQHv3 (ORCPT ); Wed, 17 Jun 2015 03:51:29 -0400 Received: by pdbnf5 with SMTP id nf5so32928847pdb.2; Wed, 17 Jun 2015 00:51:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=mAtGQKL2g/HgULeAPQRan/HlxOXNHfo4TffwYhHz1x8=; b=SAaO/KKlujbEuuYGhYryYPaewlfKhhvQwzOfc75+q7+YaGR/stl2Vs1TRNLHTNucw4 b0o9lvwxP1362EKOhT6/gwfYvgPj2TRqYukReqBB2N77ayOoH/vgkJbDT+f7tf+aI1It HUBoiVGx/nPvL3fyHK8UAshaZMFoZ2bFRQrRGpzEVqygLMYyxAo/zZMQ4da0BNPuui1F Z+UlrjHoSLrTY60WU1gedTIsVzWmm+Iz+wpEuNGiNDAU1HWrrdc1KCjGEy1/ptc0E3sm RdDMJJZUnx9vDsz7rhJrVf8pnhYIa0w9qj8gN9HsvDaH9GGgH54REHVZzTuKJbmG8ef8 08Xw== X-Received: by 10.68.87.35 with SMTP id u3mr8241430pbz.127.1434527488776; Wed, 17 Jun 2015 00:51:28 -0700 (PDT) Received: from [192.168.99.30] ([104.143.41.79]) by mx.google.com with ESMTPSA id ks7sm3668215pbc.34.2015.06.17.00.51.25 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jun 2015 00:51:28 -0700 (PDT) Message-ID: <558126FA.8050608@gmail.com> Date: Wed, 17 Jun 2015 15:51:22 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Al Viro , "J. Bruce Fields" , "linux-nfs@vger.kernel.org" , linux-fsdevel@vger.kernel.org CC: NeilBrown , Trond Myklebust , kinglongmee@gmail.com Subject: [PATCH 3/6 v5] fs_pin: Kill fs_pin under a reference of vfsmnt References: <5581266C.9080404@gmail.com> In-Reply-To: <5581266C.9080404@gmail.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP v5, new patch Signed-off-by: Kinglong Mee --- fs/namespace.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index 1b9e111..3f08a48 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1049,8 +1049,6 @@ static void cleanup_mnt(struct mount *mnt) * so mnt_get_writers() below is safe. */ WARN_ON(mnt_get_writers(mnt)); - if (unlikely(mnt->mnt_pins.first)) - mnt_pin_kill(mnt); fsnotify_vfsmount_delete(&mnt->mnt); dput(mnt->mnt.mnt_root); deactivate_super(mnt->mnt.mnt_sb); @@ -1078,6 +1076,7 @@ static DECLARE_DELAYED_WORK(delayed_mntput_work, delayed_mntput); static void mntput_no_expire(struct mount *mnt) { +put_again: rcu_read_lock(); mnt_add_count(mnt, -1); if (likely(mnt->mnt_ns)) { /* shouldn't be the last one */ @@ -1090,6 +1089,13 @@ static void mntput_no_expire(struct mount *mnt) unlock_mount_hash(); return; } + if (unlikely(mnt->mnt_pins.first)) { + mnt_add_count(mnt, 1); + rcu_read_unlock(); + unlock_mount_hash(); + mnt_pin_kill(mnt); + goto put_again; + } if (unlikely(mnt->mnt.mnt_flags & MNT_DOOMED)) { rcu_read_unlock(); unlock_mount_hash();