Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp382267pxj; Thu, 20 May 2021 11:30:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6moClfHRHillasNVnLKzq367HptYglElywV3jpGOqOQsI0eqs4iYF1+iSinlGMMjWVYuA X-Received: by 2002:a17:907:760b:: with SMTP id jx11mr6064485ejc.344.1621535411403; Thu, 20 May 2021 11:30:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621535411; cv=none; d=google.com; s=arc-20160816; b=W+U9/v6bIYk7qpRwcQkY5DLksl3U7QXwqJcQ/N/adwqKYDYMdwIcXxbTWxJz2lCkZ0 JD1axkfUT5y4N/8TbEJosDxlu5wUvcNrfgoSjOBmCoqPKpy9C/DKzf2vmgIEOn7TmAZ/ 3ohgItvmi+yI3K5HS7pjP7lcma9KLWIP5rXKhXZfDcK8I/WkDIf850QzAUfAwdkp+vwO cF0qcJl+0t8ImyjQddczE07vKpeoTHn6XVlt4Xw6U17jznK6Uz2E4Pzc0y1Uvc9my8wP zhyHsjJ7OynCzyO274UWXd5jhCJdaGNFgfwWhjxhbwYPT2oVPIGY3h+bKa6jE0WbpSn9 iqHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Lx4lUFDUAywlc0/aFIcirUzG5JwmHzCJO9+x+St5mAE=; b=CkDe3rxCBI+QFIT/dxOgYoCgprZRKwBMEcnT07peG/nK6Ik8PJwtfvio0wUL9m6Zan 4HgnMbogTF3P1rgh3CvkHwtU/kLAUU7HL22RSrlpKPbN2VjeiaNXIBzVClmNQGwEbYx/ AjqeZfNr15XJCbQzKXk+R7lo20kwO/7DRFArwB22ERONnl8FAfjW/5zX+sWLJSgNSUpp S+t8+MLofRHvhEsMWcqTkwbo+nVOddWFNX/MFovxxdd//N+9xEqzSwAKwRBtxTLUXO7F WzOJard625wsW64OiSUKmj6wrEPYYCtwDat9j92iD9JtjtfqwNVpdIV3yCUtzeMKVWhV G3IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oY8NpjVc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k2si2932790ejx.546.2021.05.20.11.29.47; Thu, 20 May 2021 11:30:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oY8NpjVc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235479AbhETKQ7 (ORCPT + 99 others); Thu, 20 May 2021 06:16:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:42286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235668AbhETKHZ (ORCPT ); Thu, 20 May 2021 06:07:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F293661947; Thu, 20 May 2021 09:41:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503705; bh=twAlOi9R6M04C1uNcRCrHsajzJm3UaO7LOHVLdj2GQg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oY8NpjVc63DEnYAvGdKajdYrYUtLiNxFapK7QNbA4dhd6aMGvyDvPoXRg5CW4khJ9 XwqB2cn8kGL6xOxpHcQQJVb3GGyvWeLhjLr+knixi6emN8EDqb4EHB5Rg6FhhhvKLs xim035Cj9i0/MOBSoMexLumhAAzJxhpvomcl2Dhk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kornievskaia , Trond Myklebust , Sasha Levin Subject: [PATCH 4.19 343/425] NFSv4.2 fix handling of sr_eof in SEEKs reply Date: Thu, 20 May 2021 11:21:52 +0200 Message-Id: <20210520092142.685085289@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Olga Kornievskaia [ Upstream commit 73f5c88f521a630ea1628beb9c2d48a2e777a419 ] Currently the client ignores the value of the sr_eof of the SEEK operation. According to the spec, if the server didn't find the requested extent and reached the end of the file, the server would return sr_eof=true. In case the request for DATA and no data was found (ie in the middle of the hole), then the lseek expects that ENXIO would be returned. Fixes: 1c6dcbe5ceff8 ("NFS: Implement SEEK") Signed-off-by: Olga Kornievskaia Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- fs/nfs/nfs42proc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c index da7b73ad811f..be252795a6f7 100644 --- a/fs/nfs/nfs42proc.c +++ b/fs/nfs/nfs42proc.c @@ -500,7 +500,10 @@ static loff_t _nfs42_proc_llseek(struct file *filep, if (status) return status; - return vfs_setpos(filep, res.sr_offset, inode->i_sb->s_maxbytes); + if (whence == SEEK_DATA && res.sr_eof) + return -NFS4ERR_NXIO; + else + return vfs_setpos(filep, res.sr_offset, inode->i_sb->s_maxbytes); } loff_t nfs42_proc_llseek(struct file *filep, loff_t offset, int whence) -- 2.30.2