From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF247C3A5A9 for ; Wed, 4 Sep 2019 16:05:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AF9B320820 for ; Wed, 4 Sep 2019 16:05:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567613140; bh=dz3ZAh8uhkziH89Cqtb57Ig1Dfn4IwRMxgvdjvoB64c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=fwZvSBXRKGBx1RwPqk33wQhDvJ3YiJoe4CsSyQOiswZKa3OIQqFEn0MtIxQax0RaB RAaPeixr0Q3wEQ4/fReXKnqpvWt681t4BJmiitl8n2JnzrxOBcGKLkIdGQwdYGWAG7 M/Mm77vg1OKfF8HP+QCA94kqxoHnMShqFomC/3TE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732744AbfIDQFk (ORCPT ); Wed, 4 Sep 2019 12:05:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:38904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732805AbfIDQCp (ORCPT ); Wed, 4 Sep 2019 12:02:45 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2AC5D22CF5; Wed, 4 Sep 2019 16:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567612964; bh=dz3ZAh8uhkziH89Cqtb57Ig1Dfn4IwRMxgvdjvoB64c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oZX6IIopNARhdhxtPJS8Y+OaAThreQJmNEpWwGcSLkGNl21OkGzwc13BhXHYcXhoj Wpd8nVOL5qOS6N+999ylyrJGae6GtOOrZDTsEq7EnJhj1KZ9yXI8cYYMJh93DeJcrp Sf3dgvVuMN4ami5Am2qmCbMFA0l2k2DAT3jrB/0s= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Trond Myklebust , Sasha Levin , linux-nfs@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 16/27] NFSv2: Fix eof handling Date: Wed, 4 Sep 2019 12:02:09 -0400 Message-Id: <20190904160220.4545-16-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190904160220.4545-1-sashal@kernel.org> References: <20190904160220.4545-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust [ Upstream commit 71affe9be45a5c60b9772e1b2701710712637274 ] If we received a reply from the server with a zero length read and no error, then that implies we are at eof. Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- fs/nfs/proc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index b7bca83039895..f3e8bcbd29a09 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c @@ -588,7 +588,8 @@ static int nfs_read_done(struct rpc_task *task, struct nfs_pgio_header *hdr) /* Emulate the eof flag, which isn't normally needed in NFSv2 * as it is guaranteed to always return the file attributes */ - if (hdr->args.offset + hdr->res.count >= hdr->res.fattr->size) + if ((hdr->res.count == 0 && hdr->args.count > 0) || + hdr->args.offset + hdr->res.count >= hdr->res.fattr->size) hdr->res.eof = 1; } return 0; -- 2.20.1