Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp692650pxf; Wed, 31 Mar 2021 13:39:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHSXd6rJX3ULT74lYJUbZ2mZ3HJtgR6wqq0mtMv+r5VrtyJjiHToJJk1vZMElkP3NYq/oq X-Received: by 2002:a17:906:f2d2:: with SMTP id gz18mr5580589ejb.454.1617223156671; Wed, 31 Mar 2021 13:39:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617223156; cv=none; d=google.com; s=arc-20160816; b=hxMx0ZjXIyKzQSfpF20hi/EiEnMmclgHf5rfl1As3Wg3m+9nrjK3MZ4KSzMYX0nwTA QA4hT0f9r/gHiB+SeTHYPywQ/VlNxLJzZ5xyzUv7rAKZjLckbABtxevXINI/12IpPQgL G9+JL0lC/tvRTQuo6srymdaLV+thIXzshuL1l8d4gIL6wL1dnWqLRIi2WbFcMIc9ulG2 5fe12peHJlKc3b705zw/p+rka8nXNsGMYK87ElHkg13quSKcPgaDh5BjyCEHUDLXLSgr 7ZrOb+VjTOT8V+nNhHn+Bxg0NU+dr7hiHDcXHrlUi7EWMUX5INLrlrtyutrmD8aUKr4h IYyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=cLgVCN874/goqJzqDdFAh/n5hKJJpo3VZokiGocwErg=; b=mpxgNfmJaGq55dLaxHfOFtTe0E0CAjwwg/A+rhakW1jIHvSD5fPfMLgvF/pNVlSsXb mU7LYfRR8Bqn7A+VAHrJwxZhsOXuKuxB9UAtACUu69v3tsNYcpym9+ra5JAslzwahbWZ AxLIED0DUiT4Xfv7/+CyNpFtEQ01leAEhSm0ew1EBupnbUDsGFJcbJhLCnGfly7KdDuz Ddmif3RVujGHuBG/yoCR6Ew2amIFoA6klbzyEEfX+MKwhT8PxPeAVmm+N9umGr6Kpdu6 ept1sEqHyXau4+opxP2x2xlRNo8h2XFS/6SA8W5dIne6T8D/iIEC3TSuVq+cbpisTHOx tV4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DczBFBwq; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sb9si2944783ejb.29.2021.03.31.13.38.52; Wed, 31 Mar 2021 13:39:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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=@gmail.com header.s=20161025 header.b=DczBFBwq; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236545AbhCaUfW (ORCPT + 99 others); Wed, 31 Mar 2021 16:35:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236438AbhCaUfI (ORCPT ); Wed, 31 Mar 2021 16:35:08 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15A7FC061574 for ; Wed, 31 Mar 2021 13:35:08 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id kt15so31984786ejb.12 for ; Wed, 31 Mar 2021 13:35:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cLgVCN874/goqJzqDdFAh/n5hKJJpo3VZokiGocwErg=; b=DczBFBwqK1iky7RwyX7ayw15T1sbvD16gHoMxkpgMP186brXijI7TLPiQVdvqmIojc RCXMIEymYUHiulfEukyUZidJq+qq1zNclsbp++UWV1jusexkyf2QIBHo422yqZpMJJax YqwU2yuLv1qPGHt01zYf6q3QFHHoyt7z4ekPPU9zmqxreUrsSRMfUVJV8KAJmGizo8i3 G1ouzGUu3rj0C15AUtgXzpKR9cBNlZmhDuf1JC/usrzGjLdHKROQc/m4iQo/PK3ZAIRe LeN6IkLoS4BPNZwf0IY98+QnGVQ1eUTNUQblA7sa+xk6yhsOyjOy5bpYOYX/kwfKjtKk aMVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cLgVCN874/goqJzqDdFAh/n5hKJJpo3VZokiGocwErg=; b=XZDkYsHS7zpStXTSXdLotH7xIDKk2QEY6RAPT7xbPfqWFMrVsHfxRHPYeKczUeClVz ivZmuIrgQQ45EpksC23NNJQQnVes5O6tClw3GFHWuMC+kdMXLxCmRrc8mysFNL+VlGYE DyjB4jyac5dIO8ceSXj4fpwztTMVgG1YDLWc9jnRufVNw2QYjyu2yYunIsx3+y1lJuzg RTYfylS0cOO/+FOfnpt7e0PWeu2thJbcF9eZ9yT+G4ow6jAvAYKVV9M3cc0rKmQJP090 m0uXbFFDSGV4B4vo7nqP7TC9mzkefrNguz3jNMgSsrvMnNd8tE9FaHrAxZ9G/ANWPcH/ RZYg== X-Gm-Message-State: AOAM531yc/985/oPLOnsUUxtPLB1X2qOKXh2U8H7u5TfPaFczx83JMsk XRTYQlV/OQRnfMoTRH2oY4bKqwrVhCKbxB3B9mY= X-Received: by 2002:a17:906:a0d4:: with SMTP id bh20mr5604306ejb.348.1617222906607; Wed, 31 Mar 2021 13:35:06 -0700 (PDT) MIME-Version: 1.0 References: <20210331193025.25724-1-olga.kornievskaia@gmail.com> <0ca40f087491acec8f26816b43b6d64bb624c35e.camel@hammerspace.com> In-Reply-To: <0ca40f087491acec8f26816b43b6d64bb624c35e.camel@hammerspace.com> From: Olga Kornievskaia Date: Wed, 31 Mar 2021 16:34:55 -0400 Message-ID: Subject: Re: [PATCH 1/1] NFSv4.2 fix handling of sr_eof in SEEK's reply To: Trond Myklebust Cc: "anna.schumaker@netapp.com" , "linux-nfs@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Wed, Mar 31, 2021 at 3:42 PM Trond Myklebust wrote: > > On Wed, 2021-03-31 at 15:30 -0400, Olga Kornievskaia wrote: > > From: Olga Kornievskaia > > > > 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 > > --- > > 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 094024b0aca1..d359e712c11d 100644 > > --- a/fs/nfs/nfs42proc.c > > +++ b/fs/nfs/nfs42proc.c > > @@ -659,7 +659,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) > > Don't we also need to deal with SEEK_HOLE with the offset being greater > than the end-of-file in the same way? We do not because if there is no hole extent after the requested offset, then there is an implied hole which is at the end of the file. So if sr_eof is true we still need to pay attention to the returned offset (ie it should be end of the file) and it's not an error condition. > > -- > Trond Myklebust > Linux NFS client maintainer, Hammerspace > trond.myklebust@hammerspace.com > >