From 7fb6d78324c09546e3cb433ee4f5bbcaad61f845 Mon Sep 17 00:00:00 2001 From: tl Date: Sat, 28 Sep 2024 10:47:57 +0800 Subject: [PATCH 1/3] sharefs truncate Signed-off-by: tl --- fs/sharefs/inode.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/fs/sharefs/inode.c b/fs/sharefs/inode.c index 7bd08abe79ea..080feb318201 100644 --- a/fs/sharefs/inode.c +++ b/fs/sharefs/inode.c @@ -266,6 +266,7 @@ static int sharefs_rename(struct inode *old_dir, struct dentry *old_dentry, static int sharefs_setattr(struct dentry *dentry, struct iattr *ia) { + sharefs_info("[tl] sharefs_setattr start"); int err; struct dentry *lower_dentry; struct inode *inode; @@ -306,6 +307,7 @@ static int sharefs_setattr(struct dentry *dentry, struct iattr *ia) if (err) goto out; truncate_setsize(inode, ia->ia_size); + sharefs_info("[tl] sharefs_truncate_setsize end"); } /* @@ -343,6 +345,21 @@ static int sharefs_setattr(struct dentry *dentry, struct iattr *ia) out_err: return err; } + +// static int sharefs_truncate(struct dentry *dentry, uint64_t size) +// { +// struct inode *inode = dentry->d_inode; +// struct inode *lower_inode = sharefs_lower_inode(inode); +// struct path lower_path = { 0 }; +// struct dentry *lower_dentry; +// kuid_t tmp_uid; +// int err; + +// sharefs_get_lower_path(dentry, &lower_path); +// lower_dentry = lower_path.dentry; + +// err = dentry_tr +// } #endif const struct inode_operations sharefs_symlink_iops = { -- Gitee From e9f66b33e43a38374823077f5633924312d06d65 Mon Sep 17 00:00:00 2001 From: tl Date: Wed, 9 Oct 2024 16:28:20 +0800 Subject: [PATCH 2/3] test truncate Signed-off-by: tl --- fs/sharefs/inode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/sharefs/inode.c b/fs/sharefs/inode.c index 080feb318201..57077feae65c 100644 --- a/fs/sharefs/inode.c +++ b/fs/sharefs/inode.c @@ -17,6 +17,7 @@ static int sharefs_getattr(const struct path *path, struct kstat *stat, u32 request_mask, unsigned int flags) { + sharefs_info("[tl] sharefs_getattr start"); struct path lower_path; int ret; @@ -29,6 +30,7 @@ static int sharefs_getattr(const struct path *path, struct kstat *stat, stat->dev = 0; stat->rdev = 0; sharefs_put_lower_path(path->dentry, &lower_path); + sharefs_info("[tl] sharefs_getattr end ,ret : %d", ret); return ret; } -- Gitee From a4bd6e743365e010e249cf3d29509df04d11a692 Mon Sep 17 00:00:00 2001 From: tl Date: Thu, 10 Oct 2024 15:37:52 +0800 Subject: [PATCH 3/3] test truncate Signed-off-by: tl --- fs/attr.c | 3 +++ fs/sharefs/inode.c | 25 +++++-------------------- fs/sharefs/lookup.c | 1 + 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/fs/attr.c b/fs/attr.c index fefcdc778028..8139f6978d88 100644 --- a/fs/attr.c +++ b/fs/attr.c @@ -280,6 +280,9 @@ EXPORT_SYMBOL(setattr_copy); */ int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **delegated_inode) { + if (strstr(dentry->d_name.name, "DocumentViewPicker02.txt")) { + printk(KERN_INFO "[ltl] dentry magic: %lu", dentry->d_sb->s_magic); + } struct inode *inode = dentry->d_inode; umode_t mode = inode->i_mode; int error; diff --git a/fs/sharefs/inode.c b/fs/sharefs/inode.c index 57077feae65c..38b0a245c4c3 100644 --- a/fs/sharefs/inode.c +++ b/fs/sharefs/inode.c @@ -265,10 +265,11 @@ static int sharefs_rename(struct inode *old_dir, struct dentry *old_dentry, sharefs_put_lower_path(new_dentry, &lower_new_path); return err; } +#endif static int sharefs_setattr(struct dentry *dentry, struct iattr *ia) { - sharefs_info("[tl] sharefs_setattr start"); + sharefs_info("[ltl] sharefs_setattr start"); int err; struct dentry *lower_dentry; struct inode *inode; @@ -348,22 +349,6 @@ static int sharefs_setattr(struct dentry *dentry, struct iattr *ia) return err; } -// static int sharefs_truncate(struct dentry *dentry, uint64_t size) -// { -// struct inode *inode = dentry->d_inode; -// struct inode *lower_inode = sharefs_lower_inode(inode); -// struct path lower_path = { 0 }; -// struct dentry *lower_dentry; -// kuid_t tmp_uid; -// int err; - -// sharefs_get_lower_path(dentry, &lower_path); -// lower_dentry = lower_path.dentry; - -// err = dentry_tr -// } -#endif - const struct inode_operations sharefs_symlink_iops = { .permission = sharefs_permission, .getattr = sharefs_getattr, @@ -382,15 +367,15 @@ const struct inode_operations sharefs_dir_iops = { .rename = sharefs_rename, .create = sharefs_create, .mkdir = sharefs_mkdir, - .setattr = sharefs_setattr, #endif + .setattr = sharefs_setattr, }; const struct inode_operations sharefs_main_iops = { .permission = sharefs_permission, .getattr = sharefs_getattr, .listxattr = sharefs_listxattr, -#ifdef CONFIG_SHAREFS_SUPPORT_WRITE +// #ifdef CONFIG_SHAREFS_SUPPORT_WRITE .setattr = sharefs_setattr, -#endif +// #endif }; diff --git a/fs/sharefs/lookup.c b/fs/sharefs/lookup.c index 0b0c30ef46f1..7d4c476e6665 100644 --- a/fs/sharefs/lookup.c +++ b/fs/sharefs/lookup.c @@ -288,6 +288,7 @@ static struct dentry *__sharefs_lookup(struct dentry *dentry, struct dentry *sharefs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) { + sharefs_info("[tllookup] sharefs_setattr start"); int err; struct dentry *ret, *parent; struct path lower_parent_path; -- Gitee