From patchwork Fri May 5 17:07:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 9713945 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A869C60362 for ; Fri, 5 May 2017 17:07:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 958B728329 for ; Fri, 5 May 2017 17:07:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8950228625; Fri, 5 May 2017 17:07:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7D9728329 for ; Fri, 5 May 2017 17:07:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750784AbdEERHH (ORCPT ); Fri, 5 May 2017 13:07:07 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:34696 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750835AbdEERHF (ORCPT ); Fri, 5 May 2017 13:07:05 -0400 Received: by mail-it0-f68.google.com with SMTP id c26so1519911itd.1 for ; Fri, 05 May 2017 10:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=cT9OUtD3w7WcCBCA5bDeAgHKMLlqmQV/zUl9jB7/fv8=; b=A8SFbf2YlidcKCSLRrRAdrpMOmnQdid7p1sjXTNmmh1I+hJQKYfRK9C6wSt1Cq4XE5 E+Vl5JLLhZ+u+XD693xd2+3rH0Gp6TIppOhSY49/0YfJBkwINdhkZzj/cWYePbeWYXVS 1YmpmdqsMv0PNx/uhYVmcILzddtoQeDJ0gJvd9DHzBKEtRF1r+vGq3V1zbuGmVR1VqIV 7zHG4h0JlgBOfqvH12e2k+8NqOfgsjv9WVu/SB5+VTNdoGouxNLJh703V03F5iEE/W1w dnt9XiRT0JD8q62FHxdBnTWZNHGlfx40tvuzHkthiF0yKNe9tOTG+qUPuvhlmT66B7T4 azUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=cT9OUtD3w7WcCBCA5bDeAgHKMLlqmQV/zUl9jB7/fv8=; b=NfXF8cc3JQ4bW5JUhPgyBTVB5JHgUHuHjyxuoBRXIsrh7h7qCFmZaZPT4UzsIH7xsE HNKf1sjncXoepyqTCrpRamZSEpqc+W7GjD1n8jFuO0Y9HPkLlUe2mpRMdNCv+6aUeK+v 2hPulY3SrhSdDW+YH7DH6WIheRKkMl8ulHnIiEPEgBjoNff+nvuHB93Zj4f76YBzQ13Q s0+4JnL5E0mCHVoYwMzBBGTatt+CXXH7XLWUQ6QtsQ0FJnHcRs+QqwK16JH5Z97rrbMf xiN+xL9Q0GIs4K1fl76ar7o53q8AToPw4VGD+TjseBTqdOJnnAp7Q3ohmswLVIpny4iT 4nXw== X-Gm-Message-State: AN3rC/6zg9D2tkbP8cyJEzsk6FKEiJWocy0D/1eb0MHfxBQdpDFhnR5V YrEthdtTgG51RWvtg50= X-Received: by 10.36.139.67 with SMTP id g64mr9376864ite.18.1494004024907; Fri, 05 May 2017 10:07:04 -0700 (PDT) Received: from localhost.localdomain (c-68-49-162-121.hsd1.mi.comcast.net. [68.49.162.121]) by smtp.gmail.com with ESMTPSA id p65sm12115649ioe.3.2017.05.05.10.07.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 May 2017 10:07:04 -0700 (PDT) From: Trond Myklebust To: Jason Yan Cc: linux-nfs@vger.kernel.org Subject: [PATCH] NFSv4: Fix an rcu lock leak Date: Fri, 5 May 2017 13:07:02 -0400 Message-Id: <20170505170702.7226-1-trond.myklebust@primarydata.com> X-Mailer: git-send-email 2.9.3 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The intention in the original patch was to release the lock when we put the inode, however something got screwed up. Reported-by: Jason Yan Fixes: 7b410d9ce460f ("pNFS: Delay getting the layout header in..") Cc: stable@vger.kernel.org # v4.10+ Signed-off-by: Trond Myklebust Reviewed-by: Christoph Hellwig --- fs/nfs/callback_proc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index e7f041447afd..52479f180ea1 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c @@ -131,10 +131,11 @@ static struct inode *nfs_layout_find_inode_by_stateid(struct nfs_client *clp, if (!inode) continue; if (!nfs_sb_active(inode->i_sb)) { - rcu_read_lock(); + rcu_read_unlock(); spin_unlock(&clp->cl_lock); iput(inode); spin_lock(&clp->cl_lock); + rcu_read_lock(); goto restart; } return inode; @@ -170,10 +171,11 @@ static struct inode *nfs_layout_find_inode_by_fh(struct nfs_client *clp, if (!inode) continue; if (!nfs_sb_active(inode->i_sb)) { - rcu_read_lock(); + rcu_read_unlock(); spin_unlock(&clp->cl_lock); iput(inode); spin_lock(&clp->cl_lock); + rcu_read_lock(); goto restart; } return inode;