From patchwork Wed Jul 12 23:10:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 9837561 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 77F4760393 for ; Wed, 12 Jul 2017 23:11:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A1E528610 for ; Wed, 12 Jul 2017 23:11:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5EAC128636; Wed, 12 Jul 2017 23:11:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F376A28569 for ; Wed, 12 Jul 2017 23:11:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751258AbdGLXLI (ORCPT ); Wed, 12 Jul 2017 19:11:08 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:35944 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751240AbdGLXLH (ORCPT ); Wed, 12 Jul 2017 19:11:07 -0400 Received: by mail-it0-f67.google.com with SMTP id k3so4446521ita.3 for ; Wed, 12 Jul 2017 16:11:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=1P0pAlUQtmc7C0SaxvVF/Q0ZsP5mOjWIgGvgPnNfTJc=; b=u3hCvJf7xWzhsDZZojtjKtQLfNZHdp0dNQd09M3FGIRepyrksS62jDH5TYc5kwDZ/5 W5Upt4GQF1nItsmmkS3uMn1YDAjAM6S+Ge5oJX+pjHjEjC9DmFiEWxx/x3w2ztlxdU6u sa41yuBQuBwfG4udNlnsTyBXYqRkaECptgnPRicdR454B8V0+itB7qXD8MPS4EvB6mga GInFFXgC3twzD5fBEeYMu6eByIr1Ka6HU9Bmpwh9l6RlkM7GTQM6o7s2lisgUrcwButY 8uqg/atANvrHT1O2S0Bo5PPZyJhVTTVzVNrMHHKUkTzG2QqUUi6qVKY+PNypO5UP6cR5 bEQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=1P0pAlUQtmc7C0SaxvVF/Q0ZsP5mOjWIgGvgPnNfTJc=; b=uLeNS3yWayFbOg5kZ+R+4l+rLT0E91hHWjLnXg0Bm0WS0pNX9g3h4kOu1xigbAW3tJ WB93RDvj4B9UG+dDscl52UcAi61FBJyBlUDjObp56LivsBlqaSCBtowAn+efb1I132gL UJmoIp6O9R2ANkt0JgH8WouFIo/cWGUhikhvS+eXsU9gJXbq/y3SPcnW1wtTjlPpk3TO MEsYSW4T3G4YAR9AmTndjSttpORfRM9zdnSuFgDevR0QQW2HuHJuC7pkKOQzaZvn7yQO +9W5cpIur6IhaaO1OgshjVgLR/6vEz9OHGBosaaoTIyto6fpO1F4AS0jKgjgVbcDHoUl Pr3Q== X-Gm-Message-State: AIVw111Q2pdvx6TwG4dB7i9q+fZJlICobSpL7Z0ezFLkzo4fYW64nnee eYtQlwodkBgnRBkW56c= X-Received: by 10.36.214.136 with SMTP id o130mr8357532itg.68.1499901066522; Wed, 12 Jul 2017 16:11:06 -0700 (PDT) Received: from leira.trondhjem.org (c-68-49-162-121.hsd1.mi.comcast.net. [68.49.162.121]) by smtp.gmail.com with ESMTPSA id q81sm1989546itb.28.2017.07.12.16.11.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Jul 2017 16:11:06 -0700 (PDT) From: Trond Myklebust To: anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 2/4] NFS: Fix another COMMIT race in pNFS Date: Wed, 12 Jul 2017 19:10:57 -0400 Message-Id: <20170712231059.32293-3-trond.myklebust@primarydata.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170712231059.32293-2-trond.myklebust@primarydata.com> References: <20170712231059.32293-1-trond.myklebust@primarydata.com> <20170712231059.32293-2-trond.myklebust@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We must make sure that cinfo->ds->ncommitting is in sync with the commit list, since it is checked as part of pnfs_commit_list(). Signed-off-by: Trond Myklebust --- fs/nfs/pnfs_nfs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/nfs/pnfs_nfs.c b/fs/nfs/pnfs_nfs.c index 3e6de85faf42..7ceb86627e54 100644 --- a/fs/nfs/pnfs_nfs.c +++ b/fs/nfs/pnfs_nfs.c @@ -187,6 +187,7 @@ static void pnfs_generic_retry_commit(struct nfs_commit_info *cinfo, int idx) struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds; struct pnfs_commit_bucket *bucket; struct pnfs_layout_segment *freeme; + struct list_head *pos; LIST_HEAD(pages); int i; @@ -197,6 +198,8 @@ static void pnfs_generic_retry_commit(struct nfs_commit_info *cinfo, int idx) continue; freeme = bucket->clseg; bucket->clseg = NULL; + list_for_each(pos, &bucket->committing) + cinfo->ds->ncommitting--; list_splice_init(&bucket->committing, &pages); spin_unlock(&cinfo->inode->i_lock); nfs_retry_commit(&pages, freeme, cinfo, i); @@ -247,9 +250,12 @@ void pnfs_fetch_commit_bucket_list(struct list_head *pages, struct nfs_commit_info *cinfo) { struct pnfs_commit_bucket *bucket; + struct list_head *pos; bucket = &cinfo->ds->buckets[data->ds_commit_index]; spin_lock(&cinfo->inode->i_lock); + list_for_each(pos, &bucket->committing) + cinfo->ds->ncommitting--; list_splice_init(&bucket->committing, pages); data->lseg = bucket->clseg; bucket->clseg = NULL; @@ -334,7 +340,6 @@ pnfs_generic_commit_pagelist(struct inode *inode, struct list_head *mds_pages, } } out: - cinfo->ds->ncommitting = 0; return PNFS_ATTEMPTED; } EXPORT_SYMBOL_GPL(pnfs_generic_commit_pagelist);