1 Star 0 Fork 18

swf504/dpu-utilities

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0005-modify-qtfs_dentry_revalidate.patch 1.93 KB
一键复制 编辑 原始数据 按行查看 历史
swf504 提交于 2023-07-07 03:49 . Upgrade to new version of dpu-utilities
From 607c1e329ac107087fdadca0c997d3e0f66b3b06 Mon Sep 17 00:00:00 2001
From: yangxin <245051644@qq.com>
Date: Thu, 8 Jun 2023 06:54:09 +0000
Subject: modify qtfs_dentry_revalidate
Signed-off-by: yangxin <245051644@qq.com>
---
qtfs/qtfs/sb.c | 32 ++++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)
diff --git a/qtfs/qtfs/sb.c b/qtfs/qtfs/sb.c
index b6bb3d7..2038c55 100644
--- a/qtfs/qtfs/sb.c
+++ b/qtfs/qtfs/sb.c
@@ -1510,29 +1510,41 @@ const struct xattr_handler *qtfs_xattr_handlers[] = {
int qtfs_dentry_revalidate(struct dentry *dentry, unsigned int flags)
{
struct qtfs_conn_var_s *pvar = NULL;
- struct qtreq_mount *req = NULL;
- struct qtrsp_mount *rsp = NULL;
-
- // 1 means valid; 0 means invalid
- if (dentry && dentry->d_inode && S_ISDIR(dentry->d_inode->i_mode)) {
+ struct qtreq_getattr *req;
+ struct qtrsp_getattr *rsp;
+ struct inode *inode = dentry->d_inode;
+ if (dentry && dentry->d_inode) {
if (jiffies - dentry->d_time < 2000)
return 1;
-
pvar = qtfs_conn_get_param();
- if (!pvar)
+ if (!pvar) {
+ qtfs_err("Failed to get qtfs sock var\n");
return 0;
+ }
req = pvar->conn_ops->get_conn_msg_buf(pvar, QTFS_SEND);
qtfs_fullname(req->path, dentry, PATH_MAX);
- rsp = qtfs_remote_run(pvar, QTFS_REQ_MOUNT, strlen(req->path));
- if (IS_ERR_OR_NULL(rsp) || rsp->ret != QTFS_OK) {
+ req->request_mask = STATX_BASIC_STATS;
+ req->query_flags = 0;
+
+ rsp = qtfs_remote_run(pvar, QTFS_REQ_GETATTR, QTFS_SEND_SIZE(struct qtreq_getattr, req->path));
+ if (IS_ERR_OR_NULL(rsp)) {
+ qtfs_conn_put_param(pvar);
+ return 0;
+ }
+ if (rsp->ret) {
qtfs_conn_put_param(pvar);
return 0;
}
+ if (!inode || inode->i_ino != rsp->stat.ino || inode->i_mode != rsp->stat.mode) {
+ if (inode->i_nlink > 0)
+ drop_nlink(inode);
+ qtfs_conn_put_param(pvar);
+ return 0;
+ }
qtfs_conn_put_param(pvar);
dentry->d_time = jiffies;
- return 1;
}
return 1;
}
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/swf504/dpu-utilities.git
git@gitee.com:swf504/dpu-utilities.git
swf504
dpu-utilities
dpu-utilities
master

搜索帮助