From 40eb99e606f6b0fe1d47c6f45d3e08771aa8dbbd Mon Sep 17 00:00:00 2001 From: liuzerun Date: Mon, 22 Jul 2024 08:26:43 +0000 Subject: [PATCH] fsdata Signed-off-by: liuzerun --- fs/hmdfs/inode_cloud.c | 5 +++++ fs/hmdfs/inode_local.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/hmdfs/inode_cloud.c b/fs/hmdfs/inode_cloud.c index 289e05a39842..4fde1d5880b5 100644 --- a/fs/hmdfs/inode_cloud.c +++ b/fs/hmdfs/inode_cloud.c @@ -286,6 +286,10 @@ static struct dentry *hmdfs_lookup_cloud_dentry(struct inode *parent_inode, if (in_share_dir(child_dentry)) gdi->file_type = HM_SHARE; inode = fill_inode_cloud(sb, lookup_result, parent_inode); + if (IS_ERR(inode)) { + ret = ERR_CAST(inode); + goto out; + } check_and_fixup_ownership_remote(parent_inode, inode, @@ -297,6 +301,7 @@ static struct dentry *hmdfs_lookup_cloud_dentry(struct inode *parent_inode, ret = ERR_PTR(-ENOENT); } +out: kfree(lookup_result); return ret; } diff --git a/fs/hmdfs/inode_local.c b/fs/hmdfs/inode_local.c index a6dff05efb0e..da1db4cbc7c5 100644 --- a/fs/hmdfs/inode_local.c +++ b/fs/hmdfs/inode_local.c @@ -38,7 +38,6 @@ int init_hmdfs_dentry_info(struct hmdfs_sb_info *sbi, struct dentry *dentry, if (!info) return -ENOMEM; - dentry->d_fsdata = info; INIT_LIST_HEAD(&info->cache_list_head); INIT_LIST_HEAD(&info->remote_cache_list_head); spin_lock_init(&info->cache_list_lock); @@ -47,6 +46,7 @@ int init_hmdfs_dentry_info(struct hmdfs_sb_info *sbi, struct dentry *dentry, spin_lock_init(&info->lock); info->dentry_type = dentry_type; info->device_id = 0; + dentry->d_fsdata = info; if (dentry_type == HMDFS_LAYER_ZERO || dentry_type == HMDFS_LAYER_FIRST_DEVICE || dentry_type == HMDFS_LAYER_SECOND_LOCAL || -- Gitee