Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp21845208ybl; Mon, 6 Jan 2020 12:27:58 -0800 (PST) X-Google-Smtp-Source: APXvYqxeZPuEc6eOjVHNW9ne6IdJaWEonMhZXMiMb8vAsqrUOEduuvcg+z6xKiM68XQDbGim4Z03 X-Received: by 2002:a05:6830:1e09:: with SMTP id s9mr101365381otr.139.1578342478906; Mon, 06 Jan 2020 12:27:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578342478; cv=none; d=google.com; s=arc-20160816; b=ND4ahrokF0JOAnvM+CHvWCPodQU6drE4/wqwO+uOa3j+2IP9OL6886ebZybBoCBOni f2MMySo/A5FuRmiPXiM1nWc32ywpit1gZMTPog5JnLYtARy8bkasXTLvnZUMspZ+nYWL KcaqWmgI9OIl+KD9o7ZWcJc7oQUFfTUmdP3rUkhLBQSvoj3GsFl+DMPbEkHZI5JaBpGj 7VyyJj16/6/l+qefvnSKAWB0/KhH06gjR2sI/S/jLd1/e6+8voyymp6OAgxkY9l8HR6f PJKuP/r/k1dassRKATnbTvaNFGVMKb+/iQdDRY5ZFpgCxGWC1Mc+Oxd367sraag4VsoX VgQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Q3RZF081h0n2EOEc31Pc7IloAelAP8r+igP5Mlubtyk=; b=K4c8uuPVuGKC0HbGiPUMuiy4x8NkaPGq0k1EhzcXwjg3UDugXOYJZ9ElEABH8TAglq magv9MMP6DMmChp9d3urE2mrE6evmciv6aVV/PRDy2MkZ0v1dHDD285oxw3z1KOje78i BKWHetoMJ8x6Ic2tErWcgAzbpp5jvAxPsDord7FasmyqW5BWvrH6HaBhKYdwP/n9RXAk BThK2IXv/2HQvMAzov/l4mdR2H5ic+Uip8qopdQy745O9xgorb0p5fubvbFmMr5oZkjJ a7B7dpqYUhYaDOQ61yjTuvC14KLRYDbPIHnD8DZkfgcYNlU9ZbqMIb9gY6SipJLyIeYd tq3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Y4O/7kyn"; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t14si30280926otp.210.2020.01.06.12.27.47; Mon, 06 Jan 2020 12:27:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Y4O/7kyn"; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726781AbgAFU1q (ORCPT + 99 others); Mon, 6 Jan 2020 15:27:46 -0500 Received: from mail-yb1-f195.google.com ([209.85.219.195]:36343 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726735AbgAFU1q (ORCPT ); Mon, 6 Jan 2020 15:27:46 -0500 Received: by mail-yb1-f195.google.com with SMTP id w126so20729422yba.3 for ; Mon, 06 Jan 2020 12:27:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q3RZF081h0n2EOEc31Pc7IloAelAP8r+igP5Mlubtyk=; b=Y4O/7kynJ063IwPSbStbiygP6oEh7CgCjbWr3yWYwFKuxj3Sn1idlYPKWSbthgJgcV UIV74+uSGJe/tVqZdKalEZodcd4X/sNu1WVWSnKsSihbWXIhOegbGuC8b9yIj2Nv63B1 RzJfOIzHHaLf55QSgyf3PSgjGRdPq5jFmiYLbImLt64lNUStAmzr9RgyG1HgXZGMiCT+ HCsEORW3NEoLWgxzMqQo40Fga6zOETk9U79WGT1hKR8/AmQolb01h3yP3y6GRyL3/6RO XHVR+LkbpfAVbtwFoR8YLTAXzMkg7LuMLmoH+wBacFUh9Vqhpy5ftFMVy2chyRl0u0qy OQ1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q3RZF081h0n2EOEc31Pc7IloAelAP8r+igP5Mlubtyk=; b=GpaLqUTX/5wGWzJUBz0s7YbjVBm3QQop3gxruToMcXws++FH4yTr6BetmxRAnO5R1X SKViY+7teSqzlG49gmwin2nVEqVe+qt6kUnUVINqln/BcPrr6VXJuyd75ulDoxO3Wf0d 0qM2KOEfTX8dDD5Q2Stx2XIqKknTcEVcsZtca7E6zBoavRMb4b14KDDGzKgSpzEloAoN sbvZrbja/GwoijJ799OiZIjJOjBBNCBGElfdrpcVTzW6m2OmHnua0VTtFTdTNbFNpOPB NcvMD4fXuILt4YkCqW+gD1fZ2LSeAfuV5Cr2WFIV+qjDOA3UHAvaCPIRoi+em4UrDrbv kiLw== X-Gm-Message-State: APjAAAXfIJVFnBX4BoY6xSnd6AQIR7gs3io8WDgnJO+Fj5gElFDpYgVi hEOtAMuFR3oM97CzlfmzgA== X-Received: by 2002:a25:7ac2:: with SMTP id v185mr44063564ybc.331.1578342465028; Mon, 06 Jan 2020 12:27:45 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id l200sm28723579ywl.106.2020.01.06.12.27.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 12:27:44 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 15/15] NFS: Fix nfs_direct_write_reschedule_io() Date: Mon, 6 Jan 2020 15:25:14 -0500 Message-Id: <20200106202514.785483-16-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106202514.785483-15-trond.myklebust@hammerspace.com> References: <20200106202514.785483-1-trond.myklebust@hammerspace.com> <20200106202514.785483-2-trond.myklebust@hammerspace.com> <20200106202514.785483-3-trond.myklebust@hammerspace.com> <20200106202514.785483-4-trond.myklebust@hammerspace.com> <20200106202514.785483-5-trond.myklebust@hammerspace.com> <20200106202514.785483-6-trond.myklebust@hammerspace.com> <20200106202514.785483-7-trond.myklebust@hammerspace.com> <20200106202514.785483-8-trond.myklebust@hammerspace.com> <20200106202514.785483-9-trond.myklebust@hammerspace.com> <20200106202514.785483-10-trond.myklebust@hammerspace.com> <20200106202514.785483-11-trond.myklebust@hammerspace.com> <20200106202514.785483-12-trond.myklebust@hammerspace.com> <20200106202514.785483-13-trond.myklebust@hammerspace.com> <20200106202514.785483-14-trond.myklebust@hammerspace.com> <20200106202514.785483-15-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org The 'hdr->good_bytes' is defined as the number of bytes we expect to read or write starting at offset hdr->io_start. In the case of a partial read/write we may end up adjusting hdr->args.offset and hdr->args.count to skip I/O for data that was already read/written, and so we must ensure the calculation takes that into account. Signed-off-by: Trond Myklebust --- fs/nfs/direct.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 29f00da8a0b7..b768a0b42e82 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -824,7 +824,8 @@ static void nfs_direct_write_reschedule_io(struct nfs_pgio_header *hdr) dreq->flags = NFS_ODIRECT_RESCHED_WRITES; /* fake unstable write to let common nfs resend pages */ hdr->verf.committed = NFS_UNSTABLE; - hdr->good_bytes = hdr->args.count; + hdr->good_bytes = hdr->args.offset + hdr->args.count - + hdr->io_start; } spin_unlock(&dreq->lock); } -- 2.24.1