From patchwork Tue Jul 8 18:04:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4507841 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 91C879F433 for ; Tue, 8 Jul 2014 18:06:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C3FA6200E5 for ; Tue, 8 Jul 2014 18:06:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C03022021F for ; Tue, 8 Jul 2014 18:06:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755393AbaGHSGV (ORCPT ); Tue, 8 Jul 2014 14:06:21 -0400 Received: from mail-qg0-f42.google.com ([209.85.192.42]:54466 "EHLO mail-qg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755388AbaGHSGS (ORCPT ); Tue, 8 Jul 2014 14:06:18 -0400 Received: by mail-qg0-f42.google.com with SMTP id e89so5471072qgf.15 for ; Tue, 08 Jul 2014 11:06:17 -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=Emjz5+a3YPhTrjZnNUBFEBG0jufLcc0O4FeCoY3XJeY=; b=b2l+4gi75Q8BB6BEoHhQno4gOXOHF10iQsXNXetvZVwG8Ux/Cuuao1jbYF965RR9nE fDpi17rJRDivT3KUseH8bUqNK2Er6VYjVtU7Xyc1IDYxSMw2cio4lnOBIdKzNMHsCzjl akInzoNpLIw9MD1XijPKvJlBcwhLf8FKtX/+mOsSizIQFcfeUUtvsqYNRoUxa784e3SQ rcwRhafnplEjszjc3rXhxhRmA5UsNzpASmFYTAR9DHXDDN4oWMv205ttcX+Ajgs6fEOK 0V5QtMho2vIsQHm00qmFah2jaJOKG3ORinqcp0yrs3wUqbLA6eQGBs1vN/u87YSWOzVS /gEQ== X-Gm-Message-State: ALoCoQnADzRv4q9H3QYx5EHqOeE+AISuRpmVGzwHIW7SrsCNJr+YzBEaAEHlGjBK82FGK2rcuyRe X-Received: by 10.229.106.136 with SMTP id x8mr59453302qco.15.1404842777493; Tue, 08 Jul 2014 11:06:17 -0700 (PDT) Received: from tlielax.poochiereds.net ([2001:470:8:d63:3a60:77ff:fe93:a95d]) by mx.google.com with ESMTPSA id r4sm62396458qah.39.2014.07.08.11.06.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Jul 2014 11:06:16 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org Subject: [PATCH v4 076/100] nfsd: don't destroy clients that are busy Date: Tue, 8 Jul 2014 14:04:04 -0400 Message-Id: <1404842668-22521-77-git-send-email-jlayton@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1404842668-22521-1-git-send-email-jlayton@primarydata.com> References: <1404842668-22521-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 d11906845398..4aa8f51f7dda 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -2240,8 +2240,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); @@ -2854,6 +2857,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;