Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp460720pxj; Thu, 20 May 2021 13:29:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXpxt2r/u/497pxuSK9q5tdRDl5AVakWuinqk4ynBqEcmbxpEMgSGOeTr9QEf/Lwu/Pxqh X-Received: by 2002:a5d:9343:: with SMTP id i3mr7506900ioo.77.1621542581455; Thu, 20 May 2021 13:29:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621542581; cv=none; d=google.com; s=arc-20160816; b=IU7XJl/QU2reQ/JvQMdfejBpBwBUthG6x/CNA2g/wXE/q8LL/z1kSZNEqspwnrMaF3 RtZJJyMbOipYdqifuxci6uFxq5XYYhQ1ONPi8TxMKtQN1B0dLkbzuQ4xDqOl8KWRwJdS pDFAmzUdyFhSmOKDXLfPBBAyuxBYIx/n/rJqnH94WkI9AcvnSu14pcCfIlrtY2bPV+11 Gi3HvPo4vPUhYtamrk1WNzeWgTFjt300fkl3ye66As5kzzDz6OETL/7coXooP1i80vZ7 usLjruyL+OWvheP0i85r/azBpIiZDY9O5WVeWp2jR6XU52/X2c86ENcKuVKQYzMPS2QH Ad+Q== 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=2T974hsAzJJKPstrCUq16P5WfrwqI5U1G3qGb38Pe00=; b=RQvrOCeRzPswPTm/i/UVtfusHWLVUdoKV+L0ycuzvHK3eD+tIbOJdQ3hu2jk5un9CC AVT44BINGzkGRYHyOjBmLzPwI6vowttguv3z+RmSYbUbTm+P3FGeBkCA1YAtFA9aK5fe DgFRLQ/hQgYOBZs0cyq5xr9zoj1eOfu4MPB2hISfAkpk9MHxflNayPjFhbbDPtmKRsmi 0d/OsW1ivMpUJpVKQTBJThScFGpRWmskgSwBKIGyHXurD+L308QbkiUeTTsI7Jw5j/6O snDiuSAPq6vTjFTXCkYCFSwrvCpXyIl6WSEhE066v3Af96RWzNSPwndzR+Kml3D8G2LB RxAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ybvVCBRf; 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 m17si3315380ilg.130.2021.05.20.13.29.28; Thu, 20 May 2021 13:29:41 -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=ybvVCBRf; 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 S239111AbhETKyb (ORCPT + 99 others); Thu, 20 May 2021 06:54:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:42054 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237415AbhETKiF (ORCPT ); Thu, 20 May 2021 06:38:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ABA3C6124C; Thu, 20 May 2021 09:54:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504484; bh=DtFV3Wqo/7PG62HucM/2btXMTajYH5p0FkeVxlfwrRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ybvVCBRfEIyiOgoAtgah1H+wV047162+Bc3zJuWuUPXGZcKiCKAj7W/aP/Ucikgxa y9AHpNV4OrZPvrc6DusmwvlYZJU8liSgLnN5n+aAfG+3Azxzz9rXPqZpR/34ak5Jbj YX8u3tcsXDLCgAu8kuAI15VYuJjqqPuytA8FsOTk= 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.14 266/323] NFSv4.2 fix handling of sr_eof in SEEKs reply Date: Thu, 20 May 2021 11:22:38 +0200 Message-Id: <20210520092129.335986771@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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 1c4361aed415..a61792f777be 100644 --- a/fs/nfs/nfs42proc.c +++ b/fs/nfs/nfs42proc.c @@ -305,7 +305,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