diff --git a/patches.suse/pNFS-Fix-the-pnfs-block-driver-s-calculation-of-layo.patch b/patches.suse/pNFS-Fix-the-pnfs-block-driver-s-calculation-of-layo.patch new file mode 100644 index 0000000..4f869ed --- /dev/null +++ b/patches.suse/pNFS-Fix-the-pnfs-block-driver-s-calculation-of-layo.patch @@ -0,0 +1,81 @@ +From: Trond Myklebust +Date: Fri, 17 Nov 2023 06:25:13 -0500 +Subject: [PATCH] pNFS: Fix the pnfs block driver's calculation of layoutget + size +Git-commit: 8a6291bf3b0eae1bf26621e6419a91682f2d6227 +Patch-mainline: v6.8 +References: git-fixes + +Instead of relying on the value of the 'bytes_left' field, we should +calculate the layout size based on the offset of the request that is +being written out. + +Reported-by: Benjamin Coddington +Signed-off-by: Trond Myklebust +Fixes: 954998b60caa ("NFS: Fix error handling for O_DIRECT write scheduling") +Reviewed-by: Benjamin Coddington +Tested-by: Benjamin Coddington +Reviewed-by: Christoph Hellwig +Signed-off-by: Anna Schumaker +Acked-by: NeilBrown + +--- + fs/nfs/blocklayout/blocklayout.c | 5 ++--- + fs/nfs/direct.c | 5 +++-- + fs/nfs/internal.h | 2 +- + fs/nfs/pnfs.c | 3 ++- + 4 files changed, 8 insertions(+), 7 deletions(-) + +--- a/fs/nfs/blocklayout/blocklayout.c ++++ b/fs/nfs/blocklayout/blocklayout.c +@@ -847,10 +847,9 @@ bl_pg_init_write(struct nfs_pageio_descr + } + + if (pgio->pg_dreq == NULL) +- wb_size = pnfs_num_cont_bytes(pgio->pg_inode, +- req->wb_index); ++ wb_size = pnfs_num_cont_bytes(pgio->pg_inode, req->wb_index); + else +- wb_size = nfs_dreq_bytes_left(pgio->pg_dreq); ++ wb_size = nfs_dreq_bytes_left(pgio->pg_dreq, req_offset(req)); + + pnfs_generic_pg_init_write(pgio, req, wb_size); + } +--- a/fs/nfs/direct.c ++++ b/fs/nfs/direct.c +@@ -267,9 +267,10 @@ static void nfs_direct_req_release(struc + kref_put(&dreq->kref, nfs_direct_req_free); + } + +-ssize_t nfs_dreq_bytes_left(struct nfs_direct_req *dreq) ++ssize_t nfs_dreq_bytes_left(struct nfs_direct_req *dreq, loff_t offset) + { +- return dreq->bytes_left; ++ loff_t start = offset - dreq->io_start; ++ return dreq->max_count - start; + } + EXPORT_SYMBOL_GPL(nfs_dreq_bytes_left); + +--- a/fs/nfs/internal.h ++++ b/fs/nfs/internal.h +@@ -577,7 +577,7 @@ extern int nfs_sillyrename(struct inode + /* direct.c */ + void nfs_init_cinfo_from_dreq(struct nfs_commit_info *cinfo, + struct nfs_direct_req *dreq); +-extern ssize_t nfs_dreq_bytes_left(struct nfs_direct_req *dreq); ++extern ssize_t nfs_dreq_bytes_left(struct nfs_direct_req *dreq, loff_t offset); + + /* nfs4proc.c */ + extern struct nfs_client *nfs4_init_client(struct nfs_client *clp, +--- a/fs/nfs/pnfs.c ++++ b/fs/nfs/pnfs.c +@@ -2173,7 +2173,8 @@ pnfs_generic_pg_init_read(struct nfs_pag + if (pgio->pg_dreq == NULL) + rd_size = i_size_read(pgio->pg_inode) - req_offset(req); + else +- rd_size = nfs_dreq_bytes_left(pgio->pg_dreq); ++ rd_size = nfs_dreq_bytes_left(pgio->pg_dreq, ++ req_offset(req)); + + pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, + req->wb_context, diff --git a/series.conf b/series.conf index cb1269a..2dae868 100644 --- a/series.conf +++ b/series.conf @@ -64968,6 +64968,7 @@ patches.suse/ACPI-extlog-fix-NULL-pointer-dereference-check.patch patches.suse/pstore-ram_core-fix-possible-overflow-in-persistent_ram_init_ecc.patch patches.suse/NFSv4.1-pnfs-Ensure-we-handle-the-error-NFS4ERR_RETU.patch + patches.suse/pNFS-Fix-the-pnfs-block-driver-s-calculation-of-layo.patch patches.suse/KVM-s390-fix-setting-of-fpc-register.patch patches.suse/md-bypass-block-throttle-for-superblock-update-d6e0.patch patches.suse/Revert-md-raid5-Wait-for-MD_SB_CHANGE_PENDING-in-rai.patch