Skip to content

Commit

Permalink
Btrfs: fix missing mutex_unlock in btrfs_del_dir_entries_in_log()
Browse files Browse the repository at this point in the history
It is necessary to unlock mutex_lock before it return an error when
btrfs_alloc_path() fails.

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Tsutomu Itoh authored and Chris Mason committed Apr 25, 2011
1 parent f65647c commit a62f44a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fs/btrfs/tree-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -2209,8 +2209,10 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,

log = root->log_root;
path = btrfs_alloc_path();
if (!path)
return -ENOMEM;
if (!path) {
err = -ENOMEM;
goto out_unlock;
}

di = btrfs_lookup_dir_item(trans, log, path, dir->i_ino,
name, name_len, -1);
Expand Down Expand Up @@ -2271,6 +2273,7 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
}
fail:
btrfs_free_path(path);
out_unlock:
mutex_unlock(&BTRFS_I(dir)->log_mutex);
if (ret == -ENOSPC) {
root->fs_info->last_trans_log_full_commit = trans->transid;
Expand Down

0 comments on commit a62f44a

Please sign in to comment.