50 lines
2.0 KiB
Diff
50 lines
2.0 KiB
Diff
From 091ae21631ba7c93ba4673cdd69d199687851864 Mon Sep 17 00:00:00 2001
|
|
From: liqiang <liqiang64@huawei.com>
|
|
Date: Wed, 13 Dec 2023 16:58:22 +0800
|
|
Subject: [PATCH 12/12] not updata iattr invalid data to inode
|
|
|
|
Signed-off-by: liqiang <liqiang64@huawei.com>
|
|
---
|
|
qtfs/CMakeLists.txt | 2 +-
|
|
qtfs/qtfs/sb.c | 11 ++++-------
|
|
2 files changed, 5 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/qtfs/CMakeLists.txt b/qtfs/CMakeLists.txt
|
|
index 4d0e9e3..5f97eef 100644
|
|
--- a/qtfs/CMakeLists.txt
|
|
+++ b/qtfs/CMakeLists.txt
|
|
@@ -24,7 +24,7 @@ target_link_libraries(engine PRIVATE glib-2.0 pthread)
|
|
target_compile_options(engine PRIVATE "-DQTFS_SERVER")
|
|
|
|
if (DEFINED UDS_TEST_MODE OR DEFINED QTFS_TEST_MODE)
|
|
- target_compile_options(engine PRIVATE "-DUDS_TEST_MODE")
|
|
+ target_compile_options(engine PRIVATE "-DUDS_TEST_MODE" "-DQTFS_TEST_MODE")
|
|
target_compile_options(udsproxyd PRIVATE "-DUDS_TEST_MODE")
|
|
message(WARNING "Important risk warning: the test mode is turned on, and qtfs will expose the network port, \
|
|
which will bring security risks and is only for testing! If you do not understand the risks,\
|
|
diff --git a/qtfs/qtfs/sb.c b/qtfs/qtfs/sb.c
|
|
index 4ecbf50..71aba49 100644
|
|
--- a/qtfs/qtfs/sb.c
|
|
+++ b/qtfs/qtfs/sb.c
|
|
@@ -1364,13 +1364,10 @@ int qtfs_getattr(const struct path *path, struct kstat *stat, u32 req_mask, unsi
|
|
|
|
static void qtfs_copy_iattr_inode(struct inode *inode, struct iattr *attr)
|
|
{
|
|
- inode->i_mode = attr->ia_mode;
|
|
- inode->i_uid = attr->ia_uid;
|
|
- inode->i_gid = attr->ia_gid;
|
|
- inode->i_size = attr->ia_size;
|
|
- inode->i_atime = attr->ia_atime;
|
|
- inode->i_mtime = attr->ia_mtime;
|
|
- inode->i_ctime = attr->ia_ctime;
|
|
+ inode->i_mode = (attr->ia_valid & ATTR_MODE) ? attr->ia_mode : inode->i_mode;
|
|
+ inode->i_uid = (attr->ia_valid & ATTR_UID) ? attr->ia_uid : inode->i_uid;
|
|
+ inode->i_gid = (attr->ia_valid & ATTR_GID) ? attr->ia_gid : inode->i_gid;
|
|
+ inode->i_size = (attr->ia_valid & ATTR_SIZE) ? attr->ia_size : inode->i_size;
|
|
}
|
|
|
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0))
|
|
--
|
|
2.37.1 (Apple Git-137.1)
|
|
|