From patchwork Thu Jun 19 14:50: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: 4384231 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 AEECEBEEAA for ; Thu, 19 Jun 2014 14:52:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EBD6C20384 for ; Thu, 19 Jun 2014 14:52:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1B16120396 for ; Thu, 19 Jun 2014 14:52:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932308AbaFSOwh (ORCPT ); Thu, 19 Jun 2014 10:52:37 -0400 Received: from mail-qc0-f171.google.com ([209.85.216.171]:65462 "EHLO mail-qc0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932295AbaFSOwg (ORCPT ); Thu, 19 Jun 2014 10:52:36 -0400 Received: by mail-qc0-f171.google.com with SMTP id w7so2305658qcr.30 for ; Thu, 19 Jun 2014 07:52:36 -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=Mz3DdKyoxalPUyyWYSkOjVPxraMUv9XiHwE9INZL1Mo=; b=JHm9MjfKe8sVBH80S7NAuNpzVhxakov3w7AyfnrpxuaUwuY41+NCpTRck2GOfnxIqZ 6yPmjeQYHjidD9bKO8cLriW/ztmOkkh8YSVaoW5FfDQoT06vfxe1oYG5Fmt+8MFeVdM1 5kndRoPRNheHw1Zknjy1tnVyTaIns94ZbWSwssj/PtXwYVfek6MBgOr5uoYjJDgRE5UY 5R1x3FlMVolMNJGtvfvrs8Ikj5vwNHQWVIH1g2UrTUOPMy0d/jMBi3MxeEy3KnZZSLgX mz4hX+8mNHLMsyL1S2PdxCjnrEIWMspY4HaobzgzvF2fSQd6jSUX30M5CtpBTk0dq7Bq kQ5w== X-Gm-Message-State: ALoCoQk/h014gjYucIYY8LtWCuEMo0VdK6Bna2GOv43cxJ26rcXXqD23m1pANg1fmancn5ZF5oOj X-Received: by 10.224.137.193 with SMTP id x1mr8307807qat.0.1403189556335; Thu, 19 Jun 2014 07:52:36 -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.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jun 2014 07:52:35 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org Subject: [PATCH v1 068/104] NFSd: Ensure that the laundromat unhashes the client before releasing locks Date: Thu, 19 Jun 2014 10:50:14 -0400 Message-Id: <1403189450-18729-69-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 If we leave the client on the confirmed/unconfirmed tables, and leave the sessions visible on the sessionid_hashtbl, then someone might find them before we've had a chance to destroy them. Signed-off-by: Trond Myklebust --- fs/nfsd/nfs4state.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 9d6cc32fd2fb..7982f44aae83 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -3949,13 +3949,15 @@ nfs4_laundromat(struct nfsd_net *nn) clp->cl_clientid.cl_id); continue; } - list_move(&clp->cl_lru, &reaplist); + unhash_client_locked(clp); + list_add(&clp->cl_lru, &reaplist); } spin_unlock(&nn->client_lock); list_for_each_safe(pos, next, &reaplist) { clp = list_entry(pos, struct nfs4_client, cl_lru); dprintk("NFSD: purging unused client (clientid %08x)\n", clp->cl_clientid.cl_id); + list_del_init(&clp->cl_lru); expire_client(clp); } spin_lock(&state_lock);