Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp434929pxj; Tue, 18 May 2021 06:44:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCY5jMBBInKJ7mNoNqIW3PHrvfwNwwCyXrfUpZK4PP9Do6NDIOsZaLihOf+Gup5uf/FaWX X-Received: by 2002:a05:6638:37a6:: with SMTP id w38mr5579653jal.106.1621345463376; Tue, 18 May 2021 06:44:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621345463; cv=none; d=google.com; s=arc-20160816; b=WPHkSGcGAb6/NlGfoTFkafsxKSUK2ch6YJr7VJuN3Q5e66zZ/Gr5ztJwhEpViLom0G WPVa5skfZE3UZ6q8ZHQ/L752UV92UYYguYmQm+4BzijH2EpsC8EMcj5kXZ4W/3kNbQSx d0c2FOPnDB6DU7QMYqQ41tlLruEv9AS7bzbSgPl9gkMPEyegD0ka9kXz8cF/SndghlzO TiFo4ywLZkqzpE5PYhA/uXnJyow/YdEZmEmO+ML0fCriwZiNHIAOiufol42y3+uG2c+Y smnUV5EvTI70uXBgpIcE6SP8C9o8lr0mE4QM6SF/EMnB1P4AkD2e6IAh2ZZW5EMe07Eu E19g== 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=WxJjTwbcZNCNZuf8qAJw5XK3tNQwx17CpPQksfTjrqU=; b=SA2M9Ww0xCTUPQzXnhXEqlLlZa0L4XFBj7wg7+DKoiO+ZJm7m66DvmZpgAk1WkLCXz tEJ2256pW1h8U+usHxwVWeW89qpoAqp6E0Z1AN7EvpApIpnRnTPQBlraJrLI09blV3h3 ZIhh4gbzmpZxsiiRXjoutgGbJp5Qb2YbzaicP5/aGSTvn8aht9MIjCIlf4Dq3Qm6xKrP YmFKN7tqKUVHPPUAlHwYBxTmWJpETFGsVA9RyqVrWXho1WeVal5MUneVfsiAMcqssjht h9PTYctgRgP593g8C2ntStMzTM4RuQUGs0Kw6U1He2/Y/8KgLEcQXkc0PwbIbiJZCyfG lhqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fhSZyx6G; 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 t23si19591401ioj.71.2021.05.18.06.44.10; Tue, 18 May 2021 06:44:23 -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=fhSZyx6G; 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 S1343908AbhEQPj7 (ORCPT + 99 others); Mon, 17 May 2021 11:39:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:41350 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245098AbhEQPYh (ORCPT ); Mon, 17 May 2021 11:24:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5212561C93; Mon, 17 May 2021 14:35:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262153; bh=rPzfRhXVwvUYNERhAyxZi2v+rFlGSzdr0h5b84aoilM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fhSZyx6GN6WUUTQyBl0BJgiPna4pCRsRRjs31n31pARxEZOJyvVRMr2Ei1JU9ke/P DqyXA4vzQTK4P5RzV7NJlOf3cfBTha4+wxnvcsUA30aPy+6Q/PNpJUMGNzdZGHB2TN ItXaSMVEwAJUDbQNA6UkuB8DOeixxRI+uUn8+0u8= 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.10 122/289] NFSv4.2 fix handling of sr_eof in SEEKs reply Date: Mon, 17 May 2021 16:00:47 +0200 Message-Id: <20210517140309.269363928@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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 948a4c69687c..4ebcd9dd1535 100644 --- a/fs/nfs/nfs42proc.c +++ b/fs/nfs/nfs42proc.c @@ -665,7 +665,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