Commit 1c167b87 authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba

btrfs: remove unnecessary NULL check for the new inode during rename exchange

At the very end of btrfs_rename_exchange(), in case an error happened, we
are checking if 'new_inode' is NULL, but that is not needed since during a
rename exchange, unlike regular renames, 'new_inode' can never be NULL,
and if it were, we would have a crashed much earlier when we dereference it
multiple times.

So remove the check because it is not necessary and because it is causing
static checkers to emit a warning. I probably introduced the check by
copy-pasting similar code from btrfs_rename(), where 'new_inode' can be
NULL, in commit 86e8aa0e ("Btrfs: unpin logs if rename exchange
operation fails").
Reported-by: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent dce28150
...@@ -9523,8 +9523,7 @@ static int btrfs_rename_exchange(struct inode *old_dir, ...@@ -9523,8 +9523,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
if (btrfs_inode_in_log(BTRFS_I(old_dir), fs_info->generation) || if (btrfs_inode_in_log(BTRFS_I(old_dir), fs_info->generation) ||
btrfs_inode_in_log(BTRFS_I(new_dir), fs_info->generation) || btrfs_inode_in_log(BTRFS_I(new_dir), fs_info->generation) ||
btrfs_inode_in_log(BTRFS_I(old_inode), fs_info->generation) || btrfs_inode_in_log(BTRFS_I(old_inode), fs_info->generation) ||
(new_inode && btrfs_inode_in_log(BTRFS_I(new_inode), fs_info->generation))
btrfs_inode_in_log(BTRFS_I(new_inode), fs_info->generation)))
btrfs_set_log_full_commit(trans); btrfs_set_log_full_commit(trans);
if (root_log_pinned) { if (root_log_pinned) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment