Signed-off-by: yangxin <245051644@qq.com> (cherry picked from commit e556669024b48179538e59c99b02bc8f1fd1bbe1)
43 lines
1.5 KiB
Diff
43 lines
1.5 KiB
Diff
From 86c4ef6bc5d845b0c1919ddb80702f2896a75d4f Mon Sep 17 00:00:00 2001
|
|
From: yangxin <245051644@qq.com>
|
|
Date: Thu, 15 Dec 2022 10:14:53 +0800
|
|
Subject: [PATCH 4/4] Fix inode sync error between client and server.
|
|
|
|
Signed-off-by: yangxin <245051644@qq.com>
|
|
---
|
|
qtfs/qtfs/sb.c | 11 +++++++++--
|
|
1 file changed, 9 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/qtfs/qtfs/sb.c b/qtfs/qtfs/sb.c
|
|
index 5fd2c8f..aad153b 100644
|
|
--- a/qtfs/qtfs/sb.c
|
|
+++ b/qtfs/qtfs/sb.c
|
|
@@ -1146,6 +1146,7 @@ int qtfs_getattr(const struct path *path, struct kstat *stat, u32 req_mask, unsi
|
|
struct qtfs_sock_var_s *pvar = qtfs_conn_get_param();
|
|
struct qtreq_getattr *req;
|
|
struct qtrsp_getattr *rsp;
|
|
+ struct inode *inode = path->dentry->d_inode;
|
|
int ret;
|
|
|
|
if (!pvar) {
|
|
@@ -1172,8 +1173,14 @@ int qtfs_getattr(const struct path *path, struct kstat *stat, u32 req_mask, unsi
|
|
return ret;
|
|
}
|
|
*stat = rsp->stat;
|
|
- qtfs_debug("qtfs getattr success:<%s> blksiz:%u size:%lld mode:%o ino:%llu pathino:%lu.\n", req->path, rsp->stat.blksize,
|
|
- rsp->stat.size, rsp->stat.mode, rsp->stat.ino, path->dentry->d_inode->i_ino);
|
|
+ qtfs_debug("qtfs getattr success:<%s> blksiz:%u size:%lld mode:%o ino:%llu pathino:%lu. %s\n", req->path, rsp->stat.blksize,
|
|
+ rsp->stat.size, rsp->stat.mode, rsp->stat.ino, inode->i_ino, rsp->stat.ino != inode->i_ino ? "delete current inode" : "");
|
|
+ if (inode->i_ino != rsp->stat.ino) {
|
|
+ if (inode->i_nlink > 0){
|
|
+ drop_nlink(inode);
|
|
+ }
|
|
+ d_invalidate(path->dentry);
|
|
+ }
|
|
qtfs_conn_put_param(pvar);
|
|
return 0;
|
|
}
|
|
--
|
|
2.33.0
|
|
|