From patchwork Thu Aug 21 16:09:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 4758771 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 5C19E9F2E8 for ; Thu, 21 Aug 2014 16:07:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7771F20179 for ; Thu, 21 Aug 2014 16:07:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3BC5420160 for ; Thu, 21 Aug 2014 16:07:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750854AbaHUQHZ (ORCPT ); Thu, 21 Aug 2014 12:07:25 -0400 Received: from casper.infradead.org ([85.118.1.10]:51176 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751694AbaHUQHY (ORCPT ); Thu, 21 Aug 2014 12:07:24 -0400 Received: from ip-64-134-168-64.public.wayport.net ([64.134.168.64] helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1XKUtX-00009A-2o for linux-nfs@vger.kernel.org; Thu, 21 Aug 2014 16:07:23 +0000 From: Christoph Hellwig To: linux-nfs@vger.kernel.org Subject: [PATCH 03/19] pnfs: force a layout commit when encountering busy segments during recall Date: Thu, 21 Aug 2014 11:09:19 -0500 Message-Id: <1408637375-11343-4-git-send-email-hch@lst.de> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1408637375-11343-1-git-send-email-hch@lst.de> References: <1408637375-11343-1-git-send-email-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org See http://www.infradead.org/rpr.html Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Expedite layout recall processing by forcing a layout commit when we see busy segments. Without it the layout recall might have to wait until the VM decided to start writeback for the file, which can introduce long delays. Signed-off-by: Christoph Hellwig --- fs/nfs/callback_proc.c | 16 +++++++++++----- fs/nfs/pnfs.c | 3 +++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index 41db525..bf017b0 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c @@ -164,6 +164,7 @@ static u32 initiate_file_draining(struct nfs_client *clp, struct inode *ino; struct pnfs_layout_hdr *lo; u32 rv = NFS4ERR_NOMATCHING_LAYOUT; + bool need_commit = false; LIST_HEAD(free_me_list); lo = get_layout_by_fh(clp, &args->cbl_fh, &args->cbl_stateid); @@ -172,16 +173,21 @@ static u32 initiate_file_draining(struct nfs_client *clp, ino = lo->plh_inode; spin_lock(&ino->i_lock); - if (test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags) || - pnfs_mark_matching_lsegs_invalid(lo, &free_me_list, - &args->cbl_range)) + if (test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) { rv = NFS4ERR_DELAY; - else - rv = NFS4ERR_NOMATCHING_LAYOUT; + } else if (pnfs_mark_matching_lsegs_invalid(lo, &free_me_list, + &args->cbl_range)) { + need_commit = true; + rv = NFS4ERR_DELAY; + } + pnfs_set_layout_stateid(lo, &args->cbl_stateid, true); spin_unlock(&ino->i_lock); pnfs_free_lseg_list(&free_me_list); pnfs_put_layout_hdr(lo); + + if (need_commit) + pnfs_layoutcommit_inode(ino, false); iput(ino); out: return rv; diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 6e0fa71..242e73f 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -604,6 +604,9 @@ pnfs_layout_free_bulk_destroy_list(struct list_head *layout_list, spin_unlock(&inode->i_lock); pnfs_free_lseg_list(&lseg_list); pnfs_put_layout_hdr(lo); + + if (ret) + pnfs_layoutcommit_inode(inode, false); iput(inode); } return ret;