From: Sergey Bashirov <sergeybashirov@gmail.com>
To: Christoph Hellwig <hch@infradead.org>,
Trond Myklebust <trondmy@kernel.org>,
Anna Schumaker <anna@kernel.org>
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
Konstantin Evtushenko <koevtushenko@yandex.com>,
Sergey Bashirov <sergeybashirov@gmail.com>
Subject: [PATCH 4/4] pNFS: Handle RPC size limit for layoutcommits
Date: Mon, 30 Jun 2025 21:35:29 +0300 [thread overview]
Message-ID: <20250630183537.196479-5-sergeybashirov@gmail.com> (raw)
In-Reply-To: <20250630183537.196479-1-sergeybashirov@gmail.com>
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>
---
fs/nfs/pnfs.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 3adb7d0dbec7..48dc22916f06 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -3338,6 +3338,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;
@@ -3389,19 +3390,23 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)
if (ld->prepare_layoutcommit) {
status = ld->prepare_layoutcommit(&data->args);
if (status) {
- put_cred(data->cred);
+ 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;
- goto out_unlock;
+ 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;
--
2.43.0
next prev parent reply other threads:[~2025-06-30 18:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-30 18:35 [PATCH 0/4] pNFS: Fix layoutcommit handling in block/scsi driver Sergey Bashirov
2025-06-30 18:35 ` [PATCH 1/4] pNFS: Fix uninited ptr deref in block/scsi layout Sergey Bashirov
2025-07-03 13:17 ` Christoph Hellwig
2025-06-30 18:35 ` [PATCH 2/4] pNFS: Fix extent encoding " Sergey Bashirov
2025-07-03 13:18 ` Christoph Hellwig
2025-06-30 18:35 ` [PATCH 3/4] pNFS: Add prepare commit trace to " Sergey Bashirov
2025-07-03 13:18 ` Christoph Hellwig
2025-06-30 18:35 ` Sergey Bashirov [this message]
2025-07-03 13:18 ` [PATCH 4/4] pNFS: Handle RPC size limit for layoutcommits Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250630183537.196479-5-sergeybashirov@gmail.com \
--to=sergeybashirov@gmail.com \
--cc=anna@kernel.org \
--cc=hch@infradead.org \
--cc=koevtushenko@yandex.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.