From patchwork Fri Apr 1 15:42:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weston Andros Adamson X-Patchwork-Id: 8725631 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DAFE39FC82 for ; Fri, 1 Apr 2016 15:42:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CEDF1203E5 for ; Fri, 1 Apr 2016 15:42:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7F3F820412 for ; Fri, 1 Apr 2016 15:42:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751910AbcDAPmg (ORCPT ); Fri, 1 Apr 2016 11:42:36 -0400 Received: from mail-io0-f177.google.com ([209.85.223.177]:36509 "EHLO mail-io0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751281AbcDAPmf (ORCPT ); Fri, 1 Apr 2016 11:42:35 -0400 Received: by mail-io0-f177.google.com with SMTP id q128so153519172iof.3 for ; Fri, 01 Apr 2016 08:42:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=primarydata-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Jk3TNBkKRja/kwW+iG/Ma6qAyalw91Xd8iDZozKIYh8=; b=0UofTWGEY/oSBGsARh6hrEND9AokC1VibIhQ4pCINychuSSeNNaZ41JRCxBlJDF3e9 4clYqHeMXWO6nn6ivtoOzDNQYK2NSDmItfp4YbIkVYXNaAoOaiUQxCRwUcFQ1KbvAWld pYg9GqAwB6nXPqrJb6pTMIGoCPoHF0k7N+DO9etctbIHR2tS5VsC2Ucyeb3W67CJqa5Y 24F+gYbFiS60olhgrz4WMQa3kjyfdUDZax39oYmmdXmpo/5DGkvkdL6ONAJAc+YZBiJ9 U9qQ/b02FaBIy0y1WBMxCnTn3PYVhAaEk288+/wc2aVWUi82hiEDf6X1Cm8GFihITxyU 3Zaw== 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=Jk3TNBkKRja/kwW+iG/Ma6qAyalw91Xd8iDZozKIYh8=; b=kG3WoRTXlo+QBGKVdLVUlbo3BYCD+kWZnCXfLunAhh3P2/YVrOKhPu5fbkdTOHepnF S6WKS7JeiB/HM5YOTrImLhmG0kt/PqFSnbN0Sh0RQIAMFqXz9T9FXqVIj/WroHaZ5tKx lzusJPw+KkFNiRky2KxgoIKsyWoqZorUk80NZwlMhPzW/4R4O2PwFPyeXvQw8S8atqu9 t/ITnAORxDyEkrLbKAI0QhFsHewTdldysSNcmEKbnjy12GOgxA0K3/xTBq/ULeE8Ye7e 6vsLa5++hOC7I/5hkGosQzEnYJPqNicEUiDuJRaz2Fqq0xOcOKeadXgWwKYJj73/C9bE lCrQ== X-Gm-Message-State: AD7BkJJt7vFn5OhRKfUJQ8s53psHSUKA36sYA5YqT+8Q8SUN7EPBLyW68X8c/w7e/0ARWhRc X-Received: by 10.107.137.201 with SMTP id t70mr5275960ioi.164.1459525354694; Fri, 01 Apr 2016 08:42:34 -0700 (PDT) Received: from dhcp-56.robotsandstuff.fake (c-68-49-175-159.hsd1.mi.comcast.net. [68.49.175.159]) by smtp.gmail.com with ESMTPSA id i187sm6017870ioi.33.2016.04.01.08.42.33 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 01 Apr 2016 08:42:34 -0700 (PDT) From: Weston Andros Adamson To: trond.myklebust@primarydata.com Cc: linux-nfs@vger.kernel.org, Weston Andros Adamson Subject: [PATCH 1/2 vers 2] pnfs: set NFS_IOHDR_REDO in pnfs_read_resend_pnfs Date: Fri, 1 Apr 2016 11:42:28 -0400 Message-Id: <1459525349-6100-2-git-send-email-dros@primarydata.com> X-Mailer: git-send-email 2.6.4 (Apple Git-63) In-Reply-To: <1459525349-6100-1-git-send-email-dros@primarydata.com> References: <1459525349-6100-1-git-send-email-dros@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=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Like other resend paths, mark the (old) hdr as NFS_IOHDR_REDO. This ensures the hdr completion function will not count the (old) hdr as good bytes. Also, vector the error back through the hdr->task.tk_status like other retry calls. This fixes a bug with the FlexFiles layout where libaio was reporting more bytes read than requested. Signed-off-by: Weston Andros Adamson --- fs/nfs/pnfs.c | 14 ++++++++------ fs/nfs/pnfs.h | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 2fa483e6dbe2..15e5a8b3babf 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -2143,12 +2143,15 @@ pnfs_try_to_read_data(struct nfs_pgio_header *hdr, } /* Resend all requests through pnfs. */ -int pnfs_read_resend_pnfs(struct nfs_pgio_header *hdr) +void pnfs_read_resend_pnfs(struct nfs_pgio_header *hdr) { struct nfs_pageio_descriptor pgio; - nfs_pageio_init_read(&pgio, hdr->inode, false, hdr->completion_ops); - return nfs_pageio_resend(&pgio, hdr); + if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) { + nfs_pageio_init_read(&pgio, hdr->inode, false, + hdr->completion_ops); + hdr->task.tk_status = nfs_pageio_resend(&pgio, hdr); + } } EXPORT_SYMBOL_GPL(pnfs_read_resend_pnfs); @@ -2158,12 +2161,11 @@ pnfs_do_read(struct nfs_pageio_descriptor *desc, struct nfs_pgio_header *hdr) const struct rpc_call_ops *call_ops = desc->pg_rpc_callops; struct pnfs_layout_segment *lseg = desc->pg_lseg; enum pnfs_try_status trypnfs; - int err = 0; trypnfs = pnfs_try_to_read_data(hdr, call_ops, lseg); if (trypnfs == PNFS_TRY_AGAIN) - err = pnfs_read_resend_pnfs(hdr); - if (trypnfs == PNFS_NOT_ATTEMPTED || err) + pnfs_read_resend_pnfs(hdr); + if (trypnfs == PNFS_NOT_ATTEMPTED || hdr->task.tk_status) pnfs_read_through_mds(desc, hdr); } diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index 1ac1db5f6dad..7222d3a35439 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h @@ -282,7 +282,7 @@ int _pnfs_return_layout(struct inode *); int pnfs_commit_and_return_layout(struct inode *); void pnfs_ld_write_done(struct nfs_pgio_header *); void pnfs_ld_read_done(struct nfs_pgio_header *); -int pnfs_read_resend_pnfs(struct nfs_pgio_header *); +void pnfs_read_resend_pnfs(struct nfs_pgio_header *); struct pnfs_layout_segment *pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx, loff_t pos,