From patchwork Wed Jul 30 12:27:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4648001 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 CDB0AC0338 for ; Wed, 30 Jul 2014 12:28:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0E0A3200E9 for ; Wed, 30 Jul 2014 12:28:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E90E520121 for ; Wed, 30 Jul 2014 12:28:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754704AbaG3M2F (ORCPT ); Wed, 30 Jul 2014 08:28:05 -0400 Received: from mail-qa0-f42.google.com ([209.85.216.42]:35064 "EHLO mail-qa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753244AbaG3M2C (ORCPT ); Wed, 30 Jul 2014 08:28:02 -0400 Received: by mail-qa0-f42.google.com with SMTP id j15so1178979qaq.29 for ; Wed, 30 Jul 2014 05:28:01 -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=JS/+2OZfeJ+4hAPBjD8ionvUPSwHF9gEuJ4yO/oX3ZY=; b=L/o79ut2qtce+X2ISNe61BpJZtp4I4KCLVlM+RO8CmyO/OSJvnwpexifP4KDkwZdkC lBfCB4Ng6i0nYSbik8KaGIV6OiMVjwaUv0HWJnCjkfdJ24yFdd7fsaXYVb6T2Kyhp+fl HKZvRutnggaS7Zj9s8wRAGFOQYPQArgV7fH9GHJ0t+xYTW71TCzKzETdtdEtR5kTLx/A KF7Ek+Fiq0uAuIcGtRhhg8uZ5D23PEH9ShNnHSEeacTzV7eBvyl3Cp4henCdgEmGPPwI fEoKwiAZtfJaRBtDBf/DTlOM18XR+DgLEoN21pFzS+IuRBsjUU6HfraVorUACCRDYZeB e0mQ== X-Gm-Message-State: ALoCoQnrogYcMyWMmGtHExJEivIzDEVSfN5h980nYx7d41z+yoMX2yK4RI6/ftwrxhFrk6x6ciWY X-Received: by 10.140.82.242 with SMTP id h105mr5923201qgd.98.1406723281730; Wed, 30 Jul 2014 05:28:01 -0700 (PDT) Received: from tlielax.poochiereds.net ([2001:470:8:d63:3a60:77ff:fe93:a95d]) by mx.google.com with ESMTPSA id t23sm2384767qge.13.2014.07.30.05.28.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Jul 2014 05:28:00 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, hch@infradead.org Subject: [PATCH 12/37] nfsd: don't destroy client if mark_client_expired_locked fails Date: Wed, 30 Jul 2014 08:27:13 -0400 Message-Id: <1406723258-8512-13-git-send-email-jlayton@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1406723258-8512-1-git-send-email-jlayton@primarydata.com> References: <1406723258-8512-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=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 If it fails, it means that the client is in use and so destroying it would be bad. Currently, the client_mutex prevents this from happening but once we remove it, we won't be able to do this. Signed-off-by: Jeff Layton --- fs/nfsd/nfs4state.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 56999cbe84a7..43e66fc1b90d 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -2496,8 +2496,10 @@ nfsd4_create_session(struct svc_rqst *rqstp, old = find_confirmed_client_by_name(&unconf->cl_name, nn); if (old) { status = mark_client_expired_locked(old); - if (status) + if (status) { + old = NULL; goto out_free_conn; + } } move_to_confirmed(unconf); conf = unconf; @@ -3041,8 +3043,10 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, old = find_confirmed_client_by_name(&unconf->cl_name, nn); if (old) { status = mark_client_expired_locked(old); - if (status) + if (status) { + old = NULL; goto out; + } } move_to_confirmed(unconf); conf = unconf;