Revision 6f1b228529ae49b0f85ab89bcdb6c365df401558 authored by Gautham Ananthakrishna on 28 October 2021, 21:36:17 UTC, committed by Linus Torvalds on 29 October 2021, 00:18:55 UTC
Encountered a race between ocfs2_test_bg_bit_allocatable() and
jbd2_journal_put_journal_head() resulting in the below vmcore.

  PID: 106879  TASK: ffff880244ba9c00  CPU: 2   COMMAND: "loop3"
  Call trace:
    panic
    oops_end
    no_context
    __bad_area_nosemaphore
    bad_area_nosemaphore
    __do_page_fault
    do_page_fault
    page_fault
      [exception RIP: ocfs2_block_group_find_clear_bits+316]
    ocfs2_block_group_find_clear_bits [ocfs2]
    ocfs2_cluster_group_search [ocfs2]
    ocfs2_search_chain [ocfs2]
    ocfs2_claim_suballoc_bits [ocfs2]
    __ocfs2_claim_clusters [ocfs2]
    ocfs2_claim_clusters [ocfs2]
    ocfs2_local_alloc_slide_window [ocfs2]
    ocfs2_reserve_local_alloc_bits [ocfs2]
    ocfs2_reserve_clusters_with_limit [ocfs2]
    ocfs2_reserve_clusters [ocfs2]
    ocfs2_lock_refcount_allocators [ocfs2]
    ocfs2_make_clusters_writable [ocfs2]
    ocfs2_replace_cow [ocfs2]
    ocfs2_refcount_cow [ocfs2]
    ocfs2_file_write_iter [ocfs2]
    lo_rw_aio
    loop_queue_work
    kthread_worker_fn
    kthread
    ret_from_fork

When ocfs2_test_bg_bit_allocatable() called bh2jh(bg_bh), the
bg_bh->b_private NULL as jbd2_journal_put_journal_head() raced and
released the jounal head from the buffer head.  Needed to take bit lock
for the bit 'BH_JournalHead' to fix this race.

Link: https://lkml.kernel.org/r/1634820718-6043-1-git-send-email-gautham.ananthakrishna@oracle.com
Signed-off-by: Gautham Ananthakrishna <gautham.ananthakrishna@oracle.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: <rajesh.sivaramasubramaniom@oracle.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 337546e
History
File Mode Size
LSM
acpi
aoe
auxdisplay
blockdev
cgroup-v1
cifs
device-mapper
gpio
hw-vuln
kdump
laptops
media
mm
namespaces
nfs
perf
pm
sysctl
README.rst -rw-r--r-- 18.3 KB
abi-obsolete.rst -rw-r--r-- 345 bytes
abi-removed.rst -rw-r--r-- 101 bytes
abi-stable.rst -rw-r--r-- 408 bytes
abi-testing.rst -rw-r--r-- 731 bytes
abi.rst -rw-r--r-- 157 bytes
bcache.rst -rw-r--r-- 24.1 KB
binderfs.rst -rw-r--r-- 3.6 KB
binfmt-misc.rst -rw-r--r-- 7.2 KB
bootconfig.rst -rw-r--r-- 9.2 KB
braille-console.rst -rw-r--r-- 1.7 KB
btmrvl.rst -rw-r--r-- 2.7 KB
bug-bisect.rst -rw-r--r-- 2.1 KB
bug-hunting.rst -rw-r--r-- 15.3 KB
cgroup-v2.rst -rw-r--r-- 103.3 KB
clearing-warn-once.rst -rw-r--r-- 275 bytes
cpu-load.rst -rw-r--r-- 3.0 KB
cputopology.rst -rw-r--r-- 4.0 KB
dell_rbu.rst -rw-r--r-- 4.9 KB
devices.rst -rw-r--r-- 11.9 KB
devices.txt -rw-r--r-- 104.4 KB
dynamic-debug-howto.rst -rw-r--r-- 13.3 KB
edid.rst -rw-r--r-- 2.3 KB
efi-stub.rst -rw-r--r-- 3.8 KB
ext4.rst -rw-r--r-- 27.6 KB
features.rst -rw-r--r-- 86 bytes
highuid.rst -rw-r--r-- 2.6 KB
hw_random.rst -rw-r--r-- 3.8 KB
index.rst -rw-r--r-- 2.3 KB
init.rst -rw-r--r-- 2.6 KB
initrd.rst -rw-r--r-- 14.3 KB
iostats.rst -rw-r--r-- 9.7 KB
java.rst -rw-r--r-- 10.9 KB
jfs.rst -rw-r--r-- 2.6 KB
kernel-parameters.rst -rw-r--r-- 8.9 KB
kernel-parameters.txt -rw-r--r-- 225.3 KB
kernel-per-CPU-kthreads.rst -rw-r--r-- 12.6 KB
lcd-panel-cgram.rst -rw-r--r-- 1.2 KB
ldm.rst -rw-r--r-- 4.6 KB
lockup-watchdogs.rst -rw-r--r-- 4.1 KB
md.rst -rw-r--r-- 27.1 KB
module-signing.rst -rw-r--r-- 11.1 KB
mono.rst -rw-r--r-- 2.6 KB
numastat.rst -rw-r--r-- 2.4 KB
parport.rst -rw-r--r-- 9.3 KB
perf-security.rst -rw-r--r-- 14.6 KB
pnp.rst -rw-r--r-- 6.9 KB
pstore-blk.rst -rw-r--r-- 8.8 KB
ramoops.rst -rw-r--r-- 6.2 KB
rapidio.rst -rw-r--r-- 2.2 KB
ras.rst -rw-r--r-- 42.1 KB
reporting-issues.rst -rw-r--r-- 94.6 KB
rtc.rst -rw-r--r-- 7.0 KB
security-bugs.rst -rw-r--r-- 4.4 KB
serial-console.rst -rw-r--r-- 4.3 KB
spkguide.txt -rw-r--r-- 69.0 KB
svga.rst -rw-r--r-- 11.8 KB
syscall-user-dispatch.rst -rw-r--r-- 4.2 KB
sysfs-rules.rst -rw-r--r-- 9.4 KB
sysrq.rst -rw-r--r-- 12.1 KB
tainted-kernels.rst -rw-r--r-- 8.3 KB
thunderbolt.rst -rw-r--r-- 14.7 KB
ufs.rst -rw-r--r-- 1.3 KB
unicode.rst -rw-r--r-- 7.1 KB
vga-softcursor.rst -rw-r--r-- 1.9 KB
video-output.rst -rw-r--r-- 1.1 KB
xfs.rst -rw-r--r-- 21.3 KB

README.rst

back to top