代码拉取完成,页面将自动刷新
From 645c009ced7f759d0d26c6f0a0b53a084cf82db5 Mon Sep 17 00:00:00 2001
From: liqiang <liqiang64@huawei.com>
Date: Wed, 10 Jul 2024 02:37:00 +0000
Subject: [PATCH] fix readdir bug in devtmpfs if /dev/ have a large number of
files, readdir can't get whole informations, because of direct save and use
file->f_pos is not correct in devtmpfs
Just use vfs_llseek to instead.
Signed-off-by: liqiang <liqiang64@huawei.com>
---
qtfs/qtfs_server/fsops.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/qtfs/qtfs_server/fsops.c b/qtfs/qtfs_server/fsops.c
index cd7365d..f2f3749 100644
--- a/qtfs/qtfs_server/fsops.c
+++ b/qtfs/qtfs_server/fsops.c
@@ -668,14 +668,20 @@ static int handle_readdir(struct qtserver_arg *arg)
rsp->d.vldcnt = 0;
return sizeof(struct qtrsp_readdir) - sizeof(rsp->dirent);
}
- file->f_pos = req->pos;
+ if (vfs_llseek(file, req->pos, SEEK_SET) < 0) {
+ qtfs_err("handle readdir error, file path:%s seek set:%lld failed", req->path, req->pos);
+ rsp->d.ret = QTFS_ERR;
+ rsp->d.vldcnt = 0;
+ filp_close(file, NULL);
+ return sizeof(struct qtrsp_readdir) - sizeof(rsp->dirent);
+ }
ret = iterate_dir(file, &buf.ctx);
- rsp->d.pos = file->f_pos;
+ rsp->d.pos = vfs_llseek(file, 0, SEEK_CUR);
rsp->d.ret = QTFS_OK;
rsp->d.vldcnt = buf.vldcnt;
rsp->d.over = (req->pos == rsp->d.pos) ? 1 : 0;
qtfs_info("handle readdir ret:%d, pos:%lld path:%s, valid count:%d, leftcount:%d validbyte:%lu\n",
- ret, req->pos, req->path, buf.vldcnt, buf.count, sizeof(rsp->dirent) - buf.count);
+ ret, req->pos, req->path, buf.vldcnt, buf.count, req->count - buf.count);
filp_close(file, NULL);
return sizeof(struct qtrsp_readdir_len) + req->count;
--
2.37.1 (Apple Git-137.1)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。