From patchwork Thu Jun 19 14:50:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4384291 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D19CEBEECB for ; Thu, 19 Jun 2014 14:52:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D3FF520384 for ; Thu, 19 Jun 2014 14:52:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D86F12038F for ; Thu, 19 Jun 2014 14:52:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757883AbaFSOwp (ORCPT ); Thu, 19 Jun 2014 10:52:45 -0400 Received: from mail-qc0-f181.google.com ([209.85.216.181]:63468 "EHLO mail-qc0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757787AbaFSOwp (ORCPT ); Thu, 19 Jun 2014 10:52:45 -0400 Received: by mail-qc0-f181.google.com with SMTP id x13so2234429qcv.40 for ; Thu, 19 Jun 2014 07:52:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=qI83mxgeeMnqKtJwE+b7Yf9ullBn5jod+nVFlQv/I0A=; b=kAbljLbYukxfjLtsQX3P4s0fzAWKm3Eo29VTMDE0CZx/80T2dJKltE07L+4YXXO0Mf xG7TRt1FEd/vg7VifQz9WewsmgxDQIsOmsxmvUBWOlV9F10ttAdzDCThHdV/b9XF0Jhq dGj/CD7F9igtgTZvFwnDbPP6Qzp3gHgEwEqccXJW3VtI7BySzdBFnPwOE7tdvXUBwqkE nGIKZRaBygADhackquHQQA9mjkleYV0d+vZQEISS3BGaa+0bb8frOXk/+mt2RIiuvXJh g5DC1hYF8Qv1I791m/Ie01b/TokY8ulTv4dvozdT19Eeoijosx6ZRyDMwsN/Aw4Dxzag BCyw== X-Gm-Message-State: ALoCoQkVB/EqQhVATrljvGUzYgJsssd4sSsSmqs8bQ3f0/EC+vQz5KhIbwI8JJvvNJ9Qnc93zSh3 X-Received: by 10.140.39.164 with SMTP id v33mr7081973qgv.99.1403189564532; Thu, 19 Jun 2014 07:52:44 -0700 (PDT) Received: from tlielax.poochiereds.net (cpe-107-015-124-230.nc.res.rr.com. [107.15.124.230]) by mx.google.com with ESMTPSA id r60sm3364044qgd.26.2014.06.19.07.52.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jun 2014 07:52:43 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org Subject: [PATCH v1 074/104] NFSd: Ensure lookup_clientid() takes client_lock Date: Thu, 19 Jun 2014 10:50:20 -0400 Message-Id: <1403189450-18729-75-git-send-email-jlayton@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1403189450-18729-1-git-send-email-jlayton@primarydata.com> References: <1403189450-18729-1-git-send-email-jlayton@primarydata.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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 From: Trond Myklebust Ensure that the client lookup is done safely under the client_lock. Signed-off-by: Trond Myklebust --- fs/nfsd/nfs4state.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 955027d4dc85..6e6d34111f5f 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -3880,12 +3880,14 @@ static __be32 lookup_clientid(clientid_t *clid, * if we don't have one cached already then we know this is for * is for v4.0 and "sessions" will be false. */ + spin_lock(&nn->client_lock); found = find_confirmed_client(clid, false, nn); /* Cache the nfs4_client in cstate! */ if (found) { cstate->clp = found; atomic_inc(&found->cl_refcount); } + spin_unlock(&nn->client_lock); } return found ? nfs_ok : nfserr_expired; }