diff options
author | Chao Yu <yuchao0@huawei.com> | 2017-10-13 13:01:34 +0300 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2017-10-26 11:44:18 +0300 |
commit | 4414dea8d32bb2a351e1e84eebcdc7bff22864b0 (patch) | |
tree | e6592c2108a3391da8b072f0b5dbfcbb69052216 | |
parent | e97a3c4c6f0af13fa48e251348f98881d82b5135 (diff) | |
download | linux-4414dea8d32bb2a351e1e84eebcdc7bff22864b0.tar.xz |
f2fs: allow readdir() to be interrupted
This patch follows ext4 to allow readdir() in large empty directory to
be interrupted. Referenced commit of ext4: 1f60fbe72749 ("ext4: allow
readdir()'s of large empty directories to be interrupted").
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | fs/f2fs/dir.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 148927f5bc93..1ebd206a4085 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -10,6 +10,7 @@ */ #include <linux/fs.h> #include <linux/f2fs_fs.h> +#include <linux/sched/signal.h> #include "f2fs.h" #include "node.h" #include "acl.h" @@ -875,6 +876,14 @@ static int f2fs_readdir(struct file *file, struct dir_context *ctx) min(npages - n, (pgoff_t)MAX_DIR_RA_PAGES)); for (; n < npages; n++) { + + /* allow readdir() to be interrupted */ + if (fatal_signal_pending(current)) { + err = -ERESTARTSYS; + goto out_free; + } + cond_resched(); + dentry_page = get_lock_data_page(inode, n, false); if (IS_ERR(dentry_page)) { err = PTR_ERR(dentry_page); |