From patchwork Wed Dec 24 07:12:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Haynes X-Patchwork-Id: 5536991 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 C5CA69F326 for ; Wed, 24 Dec 2014 07:14:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 053C8201B9 for ; Wed, 24 Dec 2014 07:14:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 330A5200F0 for ; Wed, 24 Dec 2014 07:14:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751728AbaLXHN6 (ORCPT ); Wed, 24 Dec 2014 02:13:58 -0500 Received: from mail-ie0-f178.google.com ([209.85.223.178]:61170 "EHLO mail-ie0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751821AbaLXHN5 (ORCPT ); Wed, 24 Dec 2014 02:13:57 -0500 Received: by mail-ie0-f178.google.com with SMTP id vy18so5506248iec.9 for ; Tue, 23 Dec 2014 23:13:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZqeyuQ4HuLatsuRG2ako7OPGAL8X8j1xH3Vm86pQdZE=; b=B7UomOBi3aSZ93C8WN44YDoNHF4gK2qUFhFFJOiMnFGNN+/Qta57Muq9RoDTIhNyVP kWcGK2/WapV+ByjnqSGJFV7LnUEE134DM+4Z9xOliWZHm8xVgfX1CoD8wl7LRuNVzMn7 h0jB1E8jG6UCKK+FwzMf9GRCVjl6JAX6vIt8R5VZxm84Lm4YGaV1YntVtj/7zn9YDmv3 nuUzB2FUgMAtkrbUuh13arbKnx7V3il5FNZ9IFjDynrr+b5b0wLDVHa46eYhDeIWmGJw qUnxn5YSDU4wf60YeN92UuEwxMp+ulhpPNbDCSsNILFAqpAexYfuL/fB+thjJ6uyHz+H QGFg== X-Gm-Message-State: ALoCoQkl6A0QwSJEw1143UVgjHtNlUJ/jbZodMqF/1do542kEMR9CQkdV4KI0SxdSpLombsbIe4p X-Received: by 10.107.34.149 with SMTP id i143mr23694422ioi.20.1419405236291; Tue, 23 Dec 2014 23:13:56 -0800 (PST) Received: from localhost.localdomain (c-68-40-185-14.hsd1.mi.comcast.net. [68.40.185.14]) by mx.google.com with ESMTPSA id 37sm8821410iog.39.2014.12.23.23.13.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Dec 2014 23:13:55 -0800 (PST) From: Tom Haynes X-Google-Original-From: Tom Haynes To: Trond Myklebust Cc: Linux NFS Mailing List Subject: [PATCH v2 20/49] nfs41: close a small race window when adding new layout to global list Date: Tue, 23 Dec 2014 23:12:59 -0800 Message-Id: <1419405208-25975-21-git-send-email-loghyr@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1419405208-25975-1-git-send-email-loghyr@primarydata.com> References: <1419405208-25975-1-git-send-email-loghyr@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: Peng Tao Signed-off-by: Peng Tao Signed-off-by: Tom Haynes --- fs/nfs/pnfs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 2d25670..fa00b56 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -1288,7 +1288,6 @@ pnfs_update_layout(struct inode *ino, struct nfs_client *clp = server->nfs_client; struct pnfs_layout_hdr *lo; struct pnfs_layout_segment *lseg = NULL; - bool first; if (!pnfs_enabled_sb(NFS_SERVER(ino))) goto out; @@ -1321,16 +1320,15 @@ pnfs_update_layout(struct inode *ino, if (pnfs_layoutgets_blocked(lo, 0)) goto out_unlock; atomic_inc(&lo->plh_outstanding); - - first = list_empty(&lo->plh_layouts) ? true : false; spin_unlock(&ino->i_lock); - if (first) { + if (list_empty(&lo->plh_layouts)) { /* The lo must be on the clp list if there is any * chance of a CB_LAYOUTRECALL(FILE) coming in. */ spin_lock(&clp->cl_lock); - list_add_tail(&lo->plh_layouts, &server->layouts); + if (list_empty(&lo->plh_layouts)) + list_add_tail(&lo->plh_layouts, &server->layouts); spin_unlock(&clp->cl_lock); }