Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp277915pxj; Tue, 18 May 2021 03:13:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxH5CVka2xI2lE1e4Qv7MyWvAQKv9fUJr8dMSG1VJQ2Xh4fpw0ojalogL/cWEsenRqFfkZ X-Received: by 2002:a05:6402:11c7:: with SMTP id j7mr6107978edw.129.1621332783695; Tue, 18 May 2021 03:13:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621332783; cv=none; d=google.com; s=arc-20160816; b=pe0a4YCq3seg/QteQ0Y83b2Z+KJUlqgGX1jyeuQ4gNan6sLRJ8MRrj+YOXCzDCf2CJ cnmUzSP6wTZZ/idJ5wpWH76bTbM2xjqCf2PEMQZiP2d6XRh8RCl5zMKmFPt04uZRlfzo jmRaeESEAU0LeTSw1ROawPNxhQADExsiAWLn53UqCMFGlA/HOWKPjkvRNIB3sn6zC8FH qLCuBcXwesMUrn9iP0AHD4qwbJRfrMmaH65gpyge4hW08ohcQDbd6SncOqzcArCzpvHZ asC3bJFBioZlMfc+l5EGawd95rLAZ0a6MZWi9VTqOYF0GAPuj1PgGxbuDz7PbCbZzcpt YqaQ== 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=0DGfKj2Fe9Z8k10psZd/CNYOfEu9PimBW6piK7UT4Gw=; b=b75CuUnOTmW2FS/sxz81KG+ac9zargWvHpqse/UP4EKSlDN+IAIR63TCfF3envAUJV rUcDz6hPh2yqEdy31N9bgc6FDT02p5fgugl/mzWVbaE1lLzcWPV5NGYmMGHwdMr1rBzG mz5DqLMn7tT6W5CpTm+ne3YBAEwEKkIP4sOPL1C0/BnjT+wBNjzp9gTmlTAE42clBUd7 Q+prHhHJ7pMP+6zk6vo9ZASP32QNkTmhD4KZKLuSYI1AWuHchsN1RT53Pt6FLubvb/f/ 3ogw7Yec98GRvkQOqIdTfGhlEOXuq6dsKK4pTmvJkW223LMbzGgZxDtzX7UrRwVR2Nrx YxEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bCOMNyYB; 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 h3si17171695edw.187.2021.05.18.03.12.40; Tue, 18 May 2021 03:13:03 -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=bCOMNyYB; 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 S241384AbhEQPMI (ORCPT + 99 others); Mon, 17 May 2021 11:12:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:60014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239933AbhEQPCg (ORCPT ); Mon, 17 May 2021 11:02:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C718E61A13; Mon, 17 May 2021 14:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261658; bh=tF9+NaIMTVI/hTZTGJpNqhAQ5iXTTR/6B8dyOruPJRY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bCOMNyYB0n3sbGU12WtBMhlXo2Z4sSWiDUroU+hc5WY6O5Ans+KapXVYkg67MKVQ6 5lUdA3PD3LMtoOOZDw2o6FBz2gq+AovdaNLYCU1zNsg8DuNWb78KI6zLw7Becowk0K UfM3lvgaqp+cmlAIPqUHRXVIJ4Qd5/ooZN4HCJVA= 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.11 146/329] NFSv4.2 fix handling of sr_eof in SEEKs reply Date: Mon, 17 May 2021 16:00:57 +0200 Message-Id: <20210517140307.056534039@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.043055203@linuxfoundation.org> References: <20210517140302.043055203@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 7add6332016a..b85f7d56a155 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