Commit e7c9e3e9 authored by Theodore Ts'o's avatar Theodore Ts'o

ext4: fix locking typo in mballoc which could cause soft lockup hangs

Smatch (http://repo.or.cz/w/smatch.git/) complains about the locking in
ext4_mb_add_n_trim() from fs/ext4/mballoc.c

  4438          list_for_each_entry_rcu(tmp_pa, &lg->lg_prealloc_list[order],
  4439                                                  pa_inode_list) {
  4440                  spin_lock(&tmp_pa->pa_lock);
  4441                  if (tmp_pa->pa_deleted) {
  4442                          spin_unlock(&pa->pa_lock);
  4443                          continue;
  4444                  }

Brown paper bag time...
Reported-by: default avatarDan Carpenter <error27@gmail.com>
Reviewed-by: default avatarEric Sandeen <sandeen@redhat.com>
Reviewed-by: default avatarAneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
Cc: stable@kernel.org
parent a7b19448
...@@ -4392,7 +4392,7 @@ static void ext4_mb_add_n_trim(struct ext4_allocation_context *ac) ...@@ -4392,7 +4392,7 @@ static void ext4_mb_add_n_trim(struct ext4_allocation_context *ac)
pa_inode_list) { pa_inode_list) {
spin_lock(&tmp_pa->pa_lock); spin_lock(&tmp_pa->pa_lock);
if (tmp_pa->pa_deleted) { if (tmp_pa->pa_deleted) {
spin_unlock(&pa->pa_lock); spin_unlock(&tmp_pa->pa_lock);
continue; continue;
} }
if (!added && pa->pa_free < tmp_pa->pa_free) { if (!added && pa->pa_free < tmp_pa->pa_free) {
......
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