Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 132f6448 authored by Sergey Bashirov's avatar Sergey Bashirov Committed by Greg Kroah-Hartman
Browse files

pNFS: Handle RPC size limit for layoutcommits



[ Upstream commit d897d81671bc4615c80f4f3bd5e6b218f59df50c ]

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: default avatarKonstantin Evtushenko <koevtushenko@yandex.com>
Signed-off-by: default avatarKonstantin Evtushenko <koevtushenko@yandex.com>
Signed-off-by: default avatarSergey Bashirov <sergeybashirov@gmail.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20250630183537.196479-5-sergeybashirov@gmail.com


Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent a0799e0b
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -3047,6 +3047,7 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)
	struct nfs_inode *nfsi = NFS_I(inode);
	loff_t end_pos;
	int status;
	bool mark_as_dirty = false;

	if (!pnfs_layoutcommit_outstanding(inode))
		return 0;
@@ -3098,19 +3099,23 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)
	if (ld->prepare_layoutcommit) {
		status = ld->prepare_layoutcommit(&data->args);
		if (status) {
			if (status != -ENOSPC)
				put_cred(data->cred);
			spin_lock(&inode->i_lock);
			set_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags);
			if (end_pos > nfsi->layout->plh_lwb)
				nfsi->layout->plh_lwb = end_pos;
			if (status != -ENOSPC)
				goto out_unlock;
			spin_unlock(&inode->i_lock);
			mark_as_dirty = true;
		}
	}


	status = nfs4_proc_layoutcommit(data, sync);
out:
	if (status)
	if (status || mark_as_dirty)
		mark_inode_dirty_sync(inode);
	dprintk("<-- %s status %d\n", __func__, status);
	return status;