From 36c9fbb41e1e438394ef0a919ac1689c9087a775 Mon Sep 17 00:00:00 2001 From: liuzerun Date: Fri, 2 Aug 2024 08:21:47 +0000 Subject: [PATCH] =?UTF-8?q?bugfix=20merge=20to=204.0=20release=20=EF=BC=88?= =?UTF-8?q?cherry=20picked=20commit=20from=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fs/hmdfs/hmdfs_server.c | 7 +++++++ fs/hmdfs/inode_local.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/hmdfs/hmdfs_server.c b/fs/hmdfs/hmdfs_server.c index ae4a941a4d71..0a570225b118 100644 --- a/fs/hmdfs/hmdfs_server.c +++ b/fs/hmdfs/hmdfs_server.c @@ -375,11 +375,13 @@ static struct file *hmdfs_open_file(struct hmdfs_peer *con, return file; } + get_file(file); id = insert_file_into_conn(con, file); if (id < 0) { hmdfs_err("file_id alloc failed! err=%d", id); reset_item_opened_status(con->sbi, filename); hmdfs_close_path(file); + hmdfs_close_path(file); return ERR_PTR(id); } *file_id = id; @@ -576,11 +578,13 @@ void hmdfs_server_open(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd, remove_file_from_conn(con, info->file_id); hmdfs_close_path(info->file); } + hmdfs_close_path(info->file); kfree(resp); kfree(info); return; err_close: + hmdfs_close_path(info->file); remove_file_from_conn(con, info->file_id); hmdfs_close_path(info->file); err_free: @@ -680,11 +684,13 @@ static int hmdfs_dentry_open(struct hmdfs_peer *con, return err; } + get_file(info->file); info->file_id = insert_file_into_conn(con, info->file); if (info->file_id < 0) { err = info->file_id; hmdfs_err("file_id alloc failed! err %d", err); hmdfs_close_path(info->file); + hmdfs_close_path(info->file); return err; } @@ -727,6 +733,7 @@ static int hmdfs_server_do_atomic_open(struct hmdfs_peer *con, if (err) { remove_file_from_conn(con, info->file_id); hmdfs_close_path(info->file); + hmdfs_close_path(info->file); } put_child: path_put(&child_path); diff --git a/fs/hmdfs/inode_local.c b/fs/hmdfs/inode_local.c index 94ff9793d092..01e214436d84 100644 --- a/fs/hmdfs/inode_local.c +++ b/fs/hmdfs/inode_local.c @@ -601,9 +601,9 @@ int hmdfs_unlink_local_dentry(struct inode *dir, struct dentry *dentry) hmdfs_drop_remote_cache_dents(dentry->d_parent); d_drop(dentry); - hmdfs_put_lower_path(&lower_path); path_err: + hmdfs_put_lower_path(&lower_path); if (error) hmdfs_clear_drop_flag(dentry->d_parent); return error; -- Gitee