diff --git a/fs/hmdfs/hmdfs_server.c b/fs/hmdfs/hmdfs_server.c index ae4a941a4d71f4cec084f98f589dcb44a8346fec..0a570225b11824cf52c9c9e2d087b143a6a6ba9b 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 94ff9793d092c5e2ea1f946ebbc2f090d2b7d60c..01e214436d84935b7a701c65b3342c862656d481 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;