From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9ECD358373; Thu, 30 Jul 2026 15:51:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785426708; cv=none; b=HUz2+8ANMPLdG6n/Nc0BpVmc+3FnksUZYIv6oEKzJN2uUYVFXGa4rUwMx5obz6r/lwbmWRYpHzsOo49uVJjmO6pYmmqZEp14Hq7JhSR0L63BmmFS/jB7EG9wHx1fSAuLek1vR2j0DduIxClAv06+1CnUCeNURH76gwl6brsDbQk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785426708; c=relaxed/simple; bh=L3Js+iurvMLyBby4WwC+oyR72wscu4jILKK7IZdBArs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KX7utIt5/AYVj8W3zIsNd/9NUTejbnUO3QiJe6M15tyYMFhviLScf7M9xCVh1RPkzRJXPE6Oap6XutWOC2iZ9R757koCw1Q4IxCUHPO4rsiKeeD5C7XJmqhGNAb+F6sWbUWE3qxNjSrcgpisedBsjoNQOMSKTeyrgDmHhFcorSY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xHAmny6j; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="xHAmny6j" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 154771F00A3A; Thu, 30 Jul 2026 15:51:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785426707; bh=HgyanRfM1yYm0AeEtfvn+YV2Nxf3lONwR6g2TclqQ4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=xHAmny6jqbvDV8tGJqtJECBmxaiw5qevENnGC/HYi8r5JlyrgigzX43/5b4H5GrXq WRWIHG+ZJVs9B2V5bK/n07m2dtjl1ZZYwxbS7MdoWsisreeVLw0k3yZ40Osuf72kZw e4KPu4AH2BhryMYxPA5ZGS9pgHzu9a7iX78b56LQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mike Snitzer , Jeff Layton , NeilBrown , Christoph Hellwig , Chuck Lever , Sasha Levin Subject: [PATCH 6.12 512/602] NFSD: pass nfsd_file to nfsd_iter_read() Date: Thu, 30 Jul 2026 16:15:04 +0200 Message-ID: <20260730141446.758420917@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260730141435.976815864@linuxfoundation.org> References: <20260730141435.976815864@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mike Snitzer [ Upstream commit 803bc849f0039291f546ba0e2237faebeb5c073e ] Prepare for nfsd_iter_read() to use the DIO alignment stored in nfsd_file by passing the nfsd_file to nfsd_iter_read() rather than just the file which is associaed with the nfsd_file. This means nfsd4_encode_readv() now also needs the nfsd_file rather than the file. Instead of changing the file arg to be the nfsd_file, we discard the file arg as the nfsd_file (and indeed the file) is already available via the "read" argument. Signed-off-by: Mike Snitzer Reviewed-by: Jeff Layton Reviewed-by: NeilBrown Reviewed-by: Christoph Hellwig Signed-off-by: Chuck Lever Stable-dep-of: 18c1cc698861 ("SUNRPC: Return an error from xdr_buf_to_bvec() on overflow") Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/nfs4xdr.c | 8 ++++---- fs/nfsd/vfs.c | 7 ++++--- fs/nfsd/vfs.h | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -4384,7 +4384,7 @@ out_err: static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp, struct nfsd4_read *read, - struct file *file, unsigned long maxcount) + unsigned long maxcount) { struct xdr_stream *xdr = resp->xdr; unsigned int base = xdr->buf->page_len & ~PAGE_MASK; @@ -4395,7 +4395,7 @@ static __be32 nfsd4_encode_readv(struct if (xdr_reserve_space_vec(xdr, maxcount) < 0) return nfserr_resource; - nfserr = nfsd_iter_read(resp->rqstp, read->rd_fhp, file, + nfserr = nfsd_iter_read(resp->rqstp, read->rd_fhp, read->rd_nf, read->rd_offset, &maxcount, base, &read->rd_eof); read->rd_length = maxcount; @@ -4444,7 +4444,7 @@ nfsd4_encode_read(struct nfsd4_compoundr if (file->f_op->splice_read && splice_ok) nfserr = nfsd4_encode_splice_read(resp, read, file, maxcount); else - nfserr = nfsd4_encode_readv(resp, read, file, maxcount); + nfserr = nfsd4_encode_readv(resp, read, maxcount); if (nfserr) { xdr_truncate_encode(xdr, starting_len); return nfserr; @@ -5311,7 +5311,7 @@ nfsd4_encode_read_plus_data(struct nfsd4 if (file->f_op->splice_read && splice_ok) nfserr = nfsd4_encode_splice_read(resp, read, file, maxcount); else - nfserr = nfsd4_encode_readv(resp, read, file, maxcount); + nfserr = nfsd4_encode_readv(resp, read, maxcount); if (nfserr) return nfserr; --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -1067,7 +1067,7 @@ __be32 nfsd_splice_read(struct svc_rqst * nfsd_iter_read - Perform a VFS read using an iterator * @rqstp: RPC transaction context * @fhp: file handle of file to be read - * @file: opened struct file of file to be read + * @nf: opened struct nfsd_file of file to be read * @offset: starting byte offset * @count: IN: requested number of bytes; OUT: number of bytes read * @base: offset in first page of read buffer @@ -1080,9 +1080,10 @@ __be32 nfsd_splice_read(struct svc_rqst * returned. */ __be32 nfsd_iter_read(struct svc_rqst *rqstp, struct svc_fh *fhp, - struct file *file, loff_t offset, unsigned long *count, + struct nfsd_file *nf, loff_t offset, unsigned long *count, unsigned int base, u32 *eof) { + struct file *file = nf->nf_file; unsigned long v, total; struct iov_iter iter; loff_t ppos = offset; @@ -1283,7 +1284,7 @@ __be32 nfsd_read(struct svc_rqst *rqstp, if (file->f_op->splice_read && nfsd_read_splice_ok(rqstp)) err = nfsd_splice_read(rqstp, fhp, file, offset, count, eof); else - err = nfsd_iter_read(rqstp, fhp, file, offset, count, 0, eof); + err = nfsd_iter_read(rqstp, fhp, nf, offset, count, 0, eof); nfsd_file_put(nf); trace_nfsd_read_done(rqstp, fhp, offset, *count); --- a/fs/nfsd/vfs.h +++ b/fs/nfsd/vfs.h @@ -122,7 +122,7 @@ __be32 nfsd_splice_read(struct svc_rqst unsigned long *count, u32 *eof); __be32 nfsd_iter_read(struct svc_rqst *rqstp, struct svc_fh *fhp, - struct file *file, loff_t offset, + struct nfsd_file *nf, loff_t offset, unsigned long *count, unsigned int base, u32 *eof); bool nfsd_read_splice_ok(struct svc_rqst *rqstp);