Linux NFS development
 help / color / mirror / Atom feed
* [PATCH] NFS: handle wait_on_bit_action() errors in nfs_vm_page_mkwrite()
@ 2025-03-03 14:03 Wentao Liang
  2025-03-07 17:29 ` Markus Elfring
  0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2025-03-03 14:03 UTC (permalink / raw)
  To: trondmy, anna; +Cc: linux-nfs, linux-kernel, Wentao Liang

Add error handling for wait_on_bit_action() failures in the page
fault path. Return VM_FAULT_SIGBUS instead of proceeding with
folio operations when wait_on_bit_action() fails.

Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 fs/nfs/file.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 1bb646752e46..9e492391687b 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -590,6 +590,7 @@ static vm_fault_t nfs_vm_page_mkwrite(struct vm_fault *vmf)
 	struct file *filp = vmf->vma->vm_file;
 	struct inode *inode = file_inode(filp);
 	unsigned pagelen;
+	int r;
 	vm_fault_t ret = VM_FAULT_NOPAGE;
 	struct address_space *mapping;
 	struct folio *folio = page_folio(vmf->page);
@@ -607,9 +608,13 @@ static vm_fault_t nfs_vm_page_mkwrite(struct vm_fault *vmf)
 		goto out;
 	}
 
-	wait_on_bit_action(&NFS_I(inode)->flags, NFS_INO_INVALIDATING,
+	r = wait_on_bit_action(&NFS_I(inode)->flags, NFS_INO_INVALIDATING,
 			   nfs_wait_bit_killable,
 			   TASK_KILLABLE|TASK_FREEZABLE_UNSAFE);
+	if (r) {
+		ret = VM_FAULT_SIGBUS;
+		goto out;
+	}
 
 	folio_lock(folio);
 	mapping = folio->mapping;
-- 
2.42.0.windows.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] NFS: handle wait_on_bit_action() errors in nfs_vm_page_mkwrite()
  2025-03-03 14:03 [PATCH] NFS: handle wait_on_bit_action() errors in nfs_vm_page_mkwrite() Wentao Liang
@ 2025-03-07 17:29 ` Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2025-03-07 17:29 UTC (permalink / raw)
  To: vulab, linux-nfs; +Cc: LKML, Anna Schumaker, Trond Myklebust

> Add error handling for wait_on_bit_action() failures in the page
> fault path. Return VM_FAULT_SIGBUS instead of proceeding with
> folio operations when wait_on_bit_action() fails.

                                             call failed?

How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.14-rc5#n145

Regards,
Markus

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-07 17:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-03 14:03 [PATCH] NFS: handle wait_on_bit_action() errors in nfs_vm_page_mkwrite() Wentao Liang
2025-03-07 17:29 ` Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox