Skip to content

Commit 2eb8d53

Browse files
sbashirogregkh
authored andcommitted
pNFS: Handle RPC size limit for layoutcommits
[ Upstream commit d897d81 ] When there are too many block extents for a layoutcommit, they may not all fit into the maximum-sized RPC. This patch allows the generic pnfs code to properly handle -ENOSPC returned by the block/scsi layout driver and trigger additional layoutcommits if necessary. Co-developed-by: Konstantin Evtushenko <koevtushenko@yandex.com> Signed-off-by: Konstantin Evtushenko <koevtushenko@yandex.com> Signed-off-by: Sergey Bashirov <sergeybashirov@gmail.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20250630183537.196479-5-sergeybashirov@gmail.com Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent ad466c0 commit 2eb8d53

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

fs/nfs/pnfs.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3332,6 +3332,7 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)
33323332
struct nfs_inode *nfsi = NFS_I(inode);
33333333
loff_t end_pos;
33343334
int status;
3335+
bool mark_as_dirty = false;
33353336

33363337
if (!pnfs_layoutcommit_outstanding(inode))
33373338
return 0;
@@ -3383,19 +3384,23 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)
33833384
if (ld->prepare_layoutcommit) {
33843385
status = ld->prepare_layoutcommit(&data->args);
33853386
if (status) {
3386-
put_cred(data->cred);
3387+
if (status != -ENOSPC)
3388+
put_cred(data->cred);
33873389
spin_lock(&inode->i_lock);
33883390
set_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags);
33893391
if (end_pos > nfsi->layout->plh_lwb)
33903392
nfsi->layout->plh_lwb = end_pos;
3391-
goto out_unlock;
3393+
if (status != -ENOSPC)
3394+
goto out_unlock;
3395+
spin_unlock(&inode->i_lock);
3396+
mark_as_dirty = true;
33923397
}
33933398
}
33943399

33953400

33963401
status = nfs4_proc_layoutcommit(data, sync);
33973402
out:
3398-
if (status)
3403+
if (status || mark_as_dirty)
33993404
mark_inode_dirty_sync(inode);
34003405
dprintk("<-- %s status %d\n", __func__, status);
34013406
return status;

0 commit comments

Comments
 (0)