From patchwork Thu Jun 26 19:13:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4430931 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 417E1BEEAA for ; Thu, 26 Jun 2014 19:15:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 74FE5201BB for ; Thu, 26 Jun 2014 19:15:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D1C292028D for ; Thu, 26 Jun 2014 19:15:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751877AbaFZTPi (ORCPT ); Thu, 26 Jun 2014 15:15:38 -0400 Received: from mail-qc0-f177.google.com ([209.85.216.177]:60466 "EHLO mail-qc0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750986AbaFZTPg (ORCPT ); Thu, 26 Jun 2014 15:15:36 -0400 Received: by mail-qc0-f177.google.com with SMTP id r5so3542974qcx.36 for ; Thu, 26 Jun 2014 12:15: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=Ufiey77Nn5cUCmVwKOhHRb5PPrTTNIt7BQTythR82Ec=; b=Pi7q/kuSqo1zf1r4K3MjglYslLZdoswY7ZJvjQMZH3Y+cnPNzHTifIhHDvy7HDIFP4 rafjCnSij518vYFmnjdu+gamnQWESUOAHiGhm/J5GWoPHgo7/XOuWTcyl/74gvlGYCM7 U+mLCXtn4P0gYbbCCF+KfzoY2t2VOpTM3kUfz9lMT5usIvgRMMMHD/NEuHdSUX3xu2vf NFwJAzlf22kTrwJXR2GVSG3ItLlYtmviIeSFU+cRVI2bW1JqKd/teHleE8pHfNgQa8yh wdSc/trsmiWh+T+MLnADuN7o2rxHzBii/Z+cOU8PEa+M22tbDl2/PxBWTsGEy2wukDWp IkSA== X-Gm-Message-State: ALoCoQmuUMkgNnDqaTamuG5igCvGAnIzFF5kCjg56Qf6j0PQvsQH6K/sitOucQ6sj1C21IKMbQq3 X-Received: by 10.224.22.12 with SMTP id l12mr26201950qab.88.1403810135966; Thu, 26 Jun 2014 12:15:35 -0700 (PDT) Received: from tlielax.poochiereds.net ([2001:470:8:d63:3a60:77ff:fe93:a95d]) by mx.google.com with ESMTPSA id 88sm4763039qgh.5.2014.06.26.12.15.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jun 2014 12:15:35 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, Trond Myklebust Subject: [PATCH v2 081/117] nfsd: Ensure that the laundromat unhashes the client before releasing locks Date: Thu, 26 Jun 2014 15:13:01 -0400 Message-Id: <1403810017-16062-82-git-send-email-jlayton@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1403810017-16062-1-git-send-email-jlayton@primarydata.com> References: <1403810017-16062-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 8a973601718e..889854591557 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -4085,13 +4085,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);