Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp262420pxj; Tue, 18 May 2021 02:48:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1QbJ2/6uDUlq4LnjrPiNxqMzuDNTmzt7pMubtNEWoFpnvaHYhpZXb9NVCCJi85f9Nu6GY X-Received: by 2002:a02:c98a:: with SMTP id b10mr4581934jap.103.1621331331169; Tue, 18 May 2021 02:48:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621331331; cv=none; d=google.com; s=arc-20160816; b=x9uXOmyanFbRx56q+UBbJeA2iD+ghKS2YKvjhrSRS1+abBaR8MGOG3gS2DcrzBfXeM 9DYphohRzOIyTfm/eUxEk2JRedmuWCLDYKOJ0ipivb+64x1SV8z1w7QyNWfqxEUWzcqU ggUZCYgn99q0ON98ddy74QNcWDkwM2AGgojL/AH4jTKCzjjK6FzIoKeyjrT7kIg6RzWg QcAWF+pUHwFqQjMKijz9HjO67UWUN47b5/Jc5MLOT3OGegdZPnW3IUL3Os4wYhTUGCWP uq+NySTz0uIh8X3RsZ8eEnAkc2YWqYlK+97Dl8cbwzkzqnmS5EsPQ8lY/qv4L2musEqQ +nTw== 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=BQVuP/BJ30/oxJ7ed0619l+ekSqyqxDb8ic0bdT3iPw=; b=eAsEH522JpJhNkzzwDhLjvdXk+ld3qiaR4kXj1oXfx7CcM7/3DHDwmcLRKTS8d8D1n P0zAneUEBhwAaNm27ud5s99CNuOzYS72x8SQZ0SwHwL81FXnPM9D5B8Apr1tcvkxLURo WQEXT7sNeajjPzhV4qKJfLRhQ7B6NBjw0cFO9H72CKAvlGKE9hRIzFbKEdyb443scspl bXTgxgot45n2suEfujDt+lP7U6+mXsz2zwvJxcPUwASOdw+lmZnRxOrtDWEEa42eTcA6 Z1wpmy+afl+qhtnJosRZkE5Qr6sdxgWgoGdEdOMyQHBQ9Un0rkfdE+J5uUxvU9taUtH8 XjnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PqjgmK7a; 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 x9si22149455ilu.78.2021.05.18.02.48.38; Tue, 18 May 2021 02:48:51 -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=PqjgmK7a; 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 S243088AbhEQPJL (ORCPT + 99 others); Mon, 17 May 2021 11:09:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:32850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241962AbhEQO7F (ORCPT ); Mon, 17 May 2021 10:59:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DFB9B619C6; Mon, 17 May 2021 14:26:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261587; bh=12x5PIXfBeEvut5Zn2rLhzSuwywtSimHMDMBn61Q4Fo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PqjgmK7aeQem15BTJ2x5FE7pYnC74urGQ97I4Rd1LIzfNGbYQPsJQqURaiZo05GlL iF0HcQqIGIko86TfFoXNra2He5KqWfuv4Nsz64EZX5PIGSC8IROaI+W5BBsoybgazr tT+E1UZ2Smv8OxjGR6Do4p1PnS7X7fzN3DApFMi0= 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 5.4 062/141] NFSv4.2 fix handling of sr_eof in SEEKs reply Date: Mon, 17 May 2021 16:01:54 +0200 Message-Id: <20210517140244.853295972@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140242.729269392@linuxfoundation.org> References: <20210517140242.729269392@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 5c84e5b8c0d6..6b7c926824ae 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