From patchwork Fri Sep 21 20:50:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 1493361 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 89C5D3FE65 for ; Fri, 21 Sep 2012 20:51:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932603Ab2IUUvr (ORCPT ); Fri, 21 Sep 2012 16:51:47 -0400 Received: from mx2.netapp.com ([216.240.18.37]:52474 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932599Ab2IUUvq (ORCPT ); Fri, 21 Sep 2012 16:51:46 -0400 X-IronPort-AV: E=Sophos;i="4.80,464,1344236400"; d="scan'208";a="692515844" Received: from smtp1.corp.netapp.com ([10.57.156.124]) by mx2-out.netapp.com with ESMTP; 21 Sep 2012 13:51:46 -0700 Received: from lade.trondhjem.org.com (lade.trondhjem.org [10.63.228.34] (may be forged)) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id q8LKoiBd029417; Fri, 21 Sep 2012 13:51:41 -0700 (PDT) From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH v2 10/26] NFSv4.1: pnfs_layout_io_test_failed must clear invalid lsegs before a retry Date: Fri, 21 Sep 2012 16:50:05 -0400 Message-Id: <1348260621-10294-10-git-send-email-Trond.Myklebust@netapp.com> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1348260621-10294-9-git-send-email-Trond.Myklebust@netapp.com> References: <1348260621-10294-1-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-2-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-3-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-4-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-5-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-6-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-7-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-8-git-send-email-Trond.Myklebust@netapp.com> <1348260621-10294-9-git-send-email-Trond.Myklebust@netapp.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org If pnfs_layout_io_test_failed() authorises a retry of the failed layoutgets, it should first clear the existing layout segments so that we start afresh. Signed-off-by: Trond Myklebust --- fs/nfs/pnfs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index cbbb0fc..80aaaba 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -256,7 +256,8 @@ pnfs_layout_io_set_failed(struct pnfs_layout_hdr *lo, u32 iomode) } static bool -pnfs_layout_io_test_failed(struct pnfs_layout_hdr *lo, u32 iomode) +pnfs_layout_io_test_failed(struct pnfs_layout_hdr *lo, u32 iomode, + struct list_head *head) { unsigned long start, end; if (test_bit(pnfs_iomode_to_fail_bit(iomode), &lo->plh_flags) == 0) @@ -267,6 +268,7 @@ pnfs_layout_io_test_failed(struct pnfs_layout_hdr *lo, u32 iomode) /* It is time to retry the failed layoutgets */ clear_bit(NFS_LAYOUT_RW_FAILED, &lo->plh_flags); clear_bit(NFS_LAYOUT_RO_FAILED, &lo->plh_flags); + pnfs_mark_matching_lsegs_invalid(lo, head, NULL); return false; } return true; @@ -1058,6 +1060,7 @@ pnfs_update_layout(struct inode *ino, struct nfs_client *clp = server->nfs_client; struct pnfs_layout_hdr *lo; struct pnfs_layout_segment *lseg = NULL; + LIST_HEAD(tmp_list); bool first = false; if (!pnfs_enabled_sb(NFS_SERVER(ino))) @@ -1081,7 +1084,7 @@ pnfs_update_layout(struct inode *ino, } /* if LAYOUTGET already failed once we don't try again */ - if (pnfs_layout_io_test_failed(nfsi->layout, iomode)) + if (pnfs_layout_io_test_failed(nfsi->layout, iomode, &tmp_list)) goto out_unlock; /* Check to see if the layout for the given range already exists */ @@ -1127,6 +1130,7 @@ pnfs_update_layout(struct inode *ino, } atomic_dec(&lo->plh_outstanding); out: + pnfs_free_lseg_list(&tmp_list); pnfs_put_layout_hdr(lo); dprintk("%s end, state 0x%lx lseg %p\n", __func__, nfsi->layout ? nfsi->layout->plh_flags : -1, lseg);