From patchwork Thu Jun 19 14:50:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4384361 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 A578DBEEAA for ; Thu, 19 Jun 2014 14:52:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D04F920384 for ; Thu, 19 Jun 2014 14:52:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 11FB420394 for ; Thu, 19 Jun 2014 14:52:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932354AbaFSOwz (ORCPT ); Thu, 19 Jun 2014 10:52:55 -0400 Received: from mail-qg0-f45.google.com ([209.85.192.45]:56141 "EHLO mail-qg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932295AbaFSOwy (ORCPT ); Thu, 19 Jun 2014 10:52:54 -0400 Received: by mail-qg0-f45.google.com with SMTP id 63so2152657qgz.4 for ; Thu, 19 Jun 2014 07:52:53 -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=sxl4yREzWyJ4A2CqNsFrujwUjAbHvWYytps4V+1ks9E=; b=e5U9pIUSVaoSy+o2T4HB7dNgnHHl9LbNiN77K3a7XdbiwujtX1sbtACGA8lNJ4d/Iq 47hmQMs77HCiQkcw6lBpRyjAIMj1V7DUpHL1QrLJa/sIElXWg1h6WezPDtdSrUWbVMdl m35fNfVfB1N4achx6V0tw4lOCHwrOdopGV0CiRkPr/zEKrL4SzL8dtDK3FVGethyXEDW ehfFSyLMiH6dPtPpLZ7CDAL6Jin0UnwG4JcIRFJJDum2OqoRX9IT1nJpTzShgAzrAwAY TgOAMwa8ADjgJYo9R9IwwQQMPcUQ5ROA/rzXvL8GXZAHBNmZGJzEp33wqmcUThTGuODZ e9dA== X-Gm-Message-State: ALoCoQmuCBmxRUbRNpg4D0Tpt5XSJ85477Eg463Af4OZPeGwrS+CFeYkiD77qfxsNA7AGrsJOZtL X-Received: by 10.140.31.131 with SMTP id f3mr7067718qgf.59.1403189573817; Thu, 19 Jun 2014 07:52:53 -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.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jun 2014 07:52:52 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org Subject: [PATCH v1 081/104] nfsd: don't destroy clients that are busy Date: Thu, 19 Jun 2014 10:50:27 -0400 Message-Id: <1403189450-18729-82-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 It's possible that we'll have an in-progress call on some of the clients while we may be destroying the thing. Be sure to try and mark the client expired first, so that the refcount is respected. Signed-off-by: Jeff Layton --- fs/nfsd/nfs4state.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 8f7742d3ec7b..17fd48561cf8 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -2089,8 +2089,11 @@ nfsd4_exchange_id(struct svc_rqst *rqstp, /* case 1 (normal case) */ out_new: - if (conf) - unhash_client_locked(conf); + if (conf) { + status = mark_client_expired_locked(conf); + if (status) + goto out; + } new->cl_minorversion = cstate->minorversion; new->cl_mach_cred = (exid->spa_how == SP4_MACH_CRED); @@ -2703,6 +2706,9 @@ nfsd4_destroy_clientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *csta status = nfserr_clientid_busy; goto out; } + status = mark_client_expired_locked(conf); + if (status) + goto out; clp = conf; } else if (unconf) clp = unconf;