Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp1220993ybj; Fri, 20 Sep 2019 07:05:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBDm0xQnPnKoop/etg+cAorSi2IAKxI8UFdV8r6YnGkV8Rb6GJ1+9+7IckjL+l/0PnS5fJ X-Received: by 2002:a17:906:6dc1:: with SMTP id j1mr19489796ejt.85.1568988353316; Fri, 20 Sep 2019 07:05:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568988353; cv=none; d=google.com; s=arc-20160816; b=pRAZsnGir0nYAjG1berRcLpKjz696lMoLFcflxh/RD6VNfC5KY0Nf1Sctizr4KaDv1 JGZgwtW54Xy6xlqRCisoQ5cDKaCj2O0/29DcnGYkPa2Rl+anQi1/Qcirg5dLMKR6j4kT MZ+mspd6l5EJFiL1y4n9zjsTtk3V0vXFQav+gfFE2ew9Ulewk5OxTg44L31yBUq+xmFb 4UsDjw+7qgjznIV3NAGOa6BYv5pOroFEaJ5IQ/cPpqrXmN3TM9ntXXdULVY7BmjvCzvo 8Wcw6RteGSV74gMyFZlXRcPv3j1habaOPZDUYN/hBtGot8+37Tn2bL0abZsnTPKG5pGD 9Ldg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aRyJEh5uaqB3ZVx+bXyTs6AjCgHm1TxMmzirjzmgI5I=; b=x/QPtUSPjYK0AvrGFksSWWQnwUi4+5if1Ai8ukzcKZQfbylzC6U0zpdbTC2nBVNHPb MTgDy4hCvseO7osjIjGkaduxy6py1iXsKRc1futX03Fe7YKefGuE3uyuLhevYboZb/rr Wzk/6biMjuOySJA7Qok6ltk3s41cUqWtTsoZLFg21DLq33I71Cz+9VVx91aMxdl3TrYT PmSWQb8Z07XH0I5c4wl/utdGnYKIpeVrX4qUsmTC7OAqpwSciiOtYu4CtmcmZjrxUnwY Z62a1zc9sjkap5JvKVxHPFqT+yNrCCEuN1K1f5sIl94aWz49nKBUBho7FAWOyfniieou l/VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EOHdaFdH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i16si1458091ede.86.2019.09.20.07.05.29; Fri, 20 Sep 2019 07:05:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@kernel.org header.s=default header.b=EOHdaFdH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727273AbfISWSU (ORCPT + 99 others); Thu, 19 Sep 2019 18:18:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:59772 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393884AbfISWSQ (ORCPT ); Thu, 19 Sep 2019 18:18:16 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 627EA222BD; Thu, 19 Sep 2019 22:18:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568931495; bh=cz8gFurWnBpxuSWFcIrMIt/2/3SrCjZwpN/ECWAf+vg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EOHdaFdH4BZW/fAPlkStkDFcoS03pbIoG2M6nHmfZxOxxfdZdCihZ6zk6UVy8rhXq rp/oQ+8rBxMRXyZcs2wwfFdudTioIdy1SCeTbXjJbRvAa5KKs+iN6eY73q6y2Refew rRFDx03AF61HFQM4UMFsZoYcZZg9AZcsxTFQw0Ro= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Sasha Levin Subject: [PATCH 4.14 32/59] NFSv2: Fix eof handling Date: Fri, 20 Sep 2019 00:03:47 +0200 Message-Id: <20190919214805.839751995@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919214755.852282682@linuxfoundation.org> References: <20190919214755.852282682@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 f7fd9192d4bc8..73d1f7277e482 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c @@ -589,7 +589,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