From patchwork Wed Jul 30 12:27:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4648021 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 745C9C0338 for ; Wed, 30 Jul 2014 12:28:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AFE6C200E9 for ; Wed, 30 Jul 2014 12:28:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CAC9D20121 for ; Wed, 30 Jul 2014 12:28:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753291AbaG3M2E (ORCPT ); Wed, 30 Jul 2014 08:28:04 -0400 Received: from mail-qg0-f45.google.com ([209.85.192.45]:33032 "EHLO mail-qg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754704AbaG3M2D (ORCPT ); Wed, 30 Jul 2014 08:28:03 -0400 Received: by mail-qg0-f45.google.com with SMTP id f51so1287570qge.18 for ; Wed, 30 Jul 2014 05:28:03 -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=tXP0uwbHhkkHjCkJ2U4q57ISUL2FqUDApq8OkijjxDQ=; b=Iqzr0M193NQRazcYRK77Ir9yIo3186Bb+uiqbXV3DEGdigT/lC22/z5iyKMC/H0Y9T 6U8+7gW6IXWV2Vxa8O/XSdWhD+1qTR7j/UJCoyvv5y7npoCeDLi5VY+h0rUrNd9coyUy ArtA6XjdFknWsIjD34hQQpbS6ESy5Q+QFM9+Nc6zbdjdDlKknkdfx504QrQvEYqXOf5F DlaScjWDiXhaBm4lDrp78Q67OJ57Ja4OGFER+SocB1uuQDLyQb7H7sCzxq8xW+r5Qm1W ZtLgGoarMuIM1kYlce37CDx22w5xthq8gWFtSBWi1awhjWlkNCSrITfz+IO6tuAHbZNy Z0LA== X-Gm-Message-State: ALoCoQlGXjFpiZcL17ehzMJh3rntDo4+vXLT2v453y430EBfk+0VkpeVhyH+t/BvZ6SR/cv1ghY/ X-Received: by 10.140.98.195 with SMTP id o61mr5822412qge.41.1406723283110; Wed, 30 Jul 2014 05:28:03 -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.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Jul 2014 05:28:02 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, hch@infradead.org Subject: [PATCH 13/37] nfsd: don't destroy clients that are busy Date: Wed, 30 Jul 2014 08:27:14 -0400 Message-Id: <1406723258-8512-14-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 It's possible that we'll have an in-progress call on some of the clients while a rogue EXCHANGE_ID or DESTROY_CLIENTID call comes in. Be sure to try and mark the client expired first, so that the refcount is respected. This will only be a problem once the client_mutex is removed. 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 43e66fc1b90d..1fd8a4773191 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -2263,8 +2263,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); @@ -2877,6 +2880,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;