[PATCH 15/21] Fix hang in ngnfs_block_sync() if nothing is dirty

Valerie Aurora val at versity.com
Tue Feb 11 13:19:12 PST 2025


If there are no dirty blocks, return success from ngnfs_block_sync()
immediately. Otherwise it hangs forever because nothing in the logic
will wake it up if there aren't any dirty blocks to write.

Signed-off-by: Valerie Aurora <val at versity.com>
---
 shared/block.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/shared/block.c b/shared/block.c
index 9c7f8c6..9068781 100644
--- a/shared/block.c
+++ b/shared/block.c
@@ -782,6 +782,9 @@ int ngnfs_block_sync(struct ngnfs_fs_info *nfi)
 	struct ngnfs_block_info *blinf = nfi->block_info;
 	struct ngnfs_block *bl;
 
+	if (atomic_read(&blinf->nr_dirty) == 0)
+		return 0;
+
 	bl = alloc_block(0, false);
 	if (IS_ERR(bl))
 		return PTR_ERR(bl);
-- 
2.48.1




More information about the ngnfs-devel mailing list