[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250710073619.4083422-1-chao@kernel.org>
Date: Thu, 10 Jul 2025 15:36:18 +0800
From: Chao Yu <chao@...nel.org>
To: xiang@...nel.org
Cc: linux-erofs@...ts.ozlabs.org,
linux-kernel@...r.kernel.org,
Yue Hu <zbestahu@...il.com>,
Jeffle Xu <jefflexu@...ux.alibaba.com>,
Sandeep Dhavale <dhavale@...gle.com>,
Hongbo Li <lihongbo22@...wei.com>,
Chao Yu <chao@...nel.org>
Subject: [PATCH 1/2] erofs: allow readdir() to be interrupted
In a quick slow device, readdir() may loop for long time in large
directory, let's give a chance to allow it to be interrupted by
userspace.
Signed-off-by: Chao Yu <chao@...nel.org>
---
fs/erofs/dir.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/fs/erofs/dir.c b/fs/erofs/dir.c
index 2fae209d0274..cff61c5a172b 100644
--- a/fs/erofs/dir.c
+++ b/fs/erofs/dir.c
@@ -58,6 +58,13 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx)
struct erofs_dirent *de;
unsigned int nameoff, maxsize;
+ /* allow readdir() to be interrupted */
+ if (fatal_signal_pending(current)) {
+ err = -ERESTARTSYS;
+ break;
+ }
+ cond_resched();
+
de = erofs_bread(&buf, dbstart, true);
if (IS_ERR(de)) {
erofs_err(sb, "failed to readdir of logical block %llu of nid %llu",
--
2.49.0
Powered by blists - more mailing lists