linux-stable/fs/ocfs2
Joseph Qi ddf4b773aa ocfs2: fix a deadlock when commit trans
commit 6f1b228529 introduces a regression which can deadlock as
follows:

  Task1:                              Task2:
  jbd2_journal_commit_transaction     ocfs2_test_bg_bit_allocatable
  spin_lock(&jh->b_state_lock)        jbd_lock_bh_journal_head
  __jbd2_journal_remove_checkpoint    spin_lock(&jh->b_state_lock)
  jbd2_journal_put_journal_head
  jbd_lock_bh_journal_head

Task1 and Task2 lock bh->b_state and jh->b_state_lock in different
order, which finally result in a deadlock.

So use jbd2_journal_[grab|put]_journal_head instead in
ocfs2_test_bg_bit_allocatable() to fix it.

Link: https://lkml.kernel.org/r/20220121071205.100648-3-joseph.qi@linux.alibaba.com
Fixes: 6f1b228529 ("ocfs2: fix race between searching chunks and release journal_head from buffer_head")
Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Reported-by: Gautham Ananthakrishna <gautham.ananthakrishna@oracle.com>
Tested-by: Gautham Ananthakrishna <gautham.ananthakrishna@oracle.com>
Reported-by: Saeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Jun Piao <piaojun@huawei.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-01-30 09:56:58 +02:00
..
cluster bitmap patches for 5.17-rc1 2022-01-23 06:20:44 +02:00
dlm all: replace find_next{,_zero}_bit with find_first{,_zero}_bit where appropriate 2022-01-15 08:47:31 -08:00
dlmfs treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
Kconfig ocfs2: replace HTTP links with HTTPS ones 2020-08-07 11:33:22 -07:00
Makefile ocfs2: improve ocfs2 Makefile 2018-12-28 12:11:45 -08:00
acl.c vfs: add rcu argument to ->get_acl() callback 2021-08-18 22:08:24 +02:00
acl.h vfs: add rcu argument to ->get_acl() callback 2021-08-18 22:08:24 +02:00
alloc.c ocfs2: remove redundant assignment to pointer root_bh 2022-01-15 16:30:24 +02:00
alloc.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
aops.c ocfs2: clearly handle ocfs2_grab_pages_for_write() return value 2022-01-15 16:30:24 +02:00
aops.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
blockcheck.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
blockcheck.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
buffer_head_io.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
buffer_head_io.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
dcache.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
dcache.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
dir.c ocfs2: remove redundant assignment to variable free_space 2022-01-15 16:30:25 +02:00
dir.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
dlmglue.c ocfs2: drop acl cache for directories too 2021-09-24 16:13:34 -07:00
dlmglue.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
export.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
export.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
extent_map.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
extent_map.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
file.c ocfs2: fix data corruption on truncate 2021-11-06 13:30:32 -07:00
file.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
filecheck.c ocfs2: use default_groups in kobj_type 2022-01-15 16:30:24 +02:00
filecheck.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
heartbeat.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
heartbeat.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
inode.c ocfs2: cleanup journal init and shutdown 2021-11-06 13:30:32 -07:00
inode.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
ioctl.c ocfs2: convert to fileattr 2021-04-12 15:04:30 +02:00
ioctl.h ocfs2: convert to fileattr 2021-04-12 15:04:30 +02:00
journal.c ocfs2: use BUG_ON instead of if condition followed by BUG. 2022-01-15 16:30:24 +02:00
journal.h ocfs2: cleanup journal init and shutdown 2021-11-06 13:30:32 -07:00
localalloc.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
localalloc.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
locks.c fs: remove mandatory file locking support 2021-08-23 06:15:36 -04:00
locks.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
mmap.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
mmap.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
move_extents.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
move_extents.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
namei.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
namei.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
ocfs1_fs_compat.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
ocfs2.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
ocfs2_fs.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
ocfs2_ioctl.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
ocfs2_lockid.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
ocfs2_lockingver.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
ocfs2_trace.h ocfs2: fix the application IO timeout when fstrim is running 2019-03-05 21:07:13 -08:00
quota.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
quota_global.c ocfs2: quota_local: fix possible uninitialized-variable access in ocfs2_local_read_info() 2021-09-03 09:58:09 -07:00
quota_local.c ocfs2: quota_local: fix possible uninitialized-variable access in ocfs2_local_read_info() 2021-09-03 09:58:09 -07:00
refcounttree.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
refcounttree.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
reservations.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
reservations.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
resize.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
resize.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
slot_map.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
slot_map.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
stack_o2cb.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
stack_user.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
stackglue.c ocfs2: fix subdirectory registration with register_sysctl() 2022-01-28 18:15:16 +02:00
stackglue.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
suballoc.c ocfs2: fix a deadlock when commit trans 2022-01-30 09:56:58 +02:00
suballoc.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
super.c mm: remove cleancache 2022-01-22 08:33:38 +02:00
super.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
symlink.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
symlink.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
sysfile.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
sysfile.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
uptodate.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
uptodate.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
xattr.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
xattr.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00