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
partitions
Kconfig -rw-r--r-- 6.6 KB
Kconfig.iosched -rw-r--r-- 1.3 KB
Makefile -rw-r--r-- 1.7 KB
badblocks.c -rw-r--r-- 14.1 KB
bdev.c -rw-r--r-- 26.9 KB
bfq-cgroup.c -rw-r--r-- 38.7 KB
bfq-iosched.c -rw-r--r-- 255.3 KB
bfq-iosched.h -rw-r--r-- 37.4 KB
bfq-wf2q.c -rw-r--r-- 52.7 KB
bio-integrity.c -rw-r--r-- 12.3 KB
bio.c -rw-r--r-- 47.3 KB
blk-cgroup-rwstat.c -rw-r--r-- 3.4 KB
blk-cgroup-rwstat.h -rw-r--r-- 3.9 KB
blk-cgroup.c -rw-r--r-- 49.9 KB
blk-core.c -rw-r--r-- 47.2 KB
blk-crypto-fallback.c -rw-r--r-- 18.5 KB
blk-crypto-internal.h -rw-r--r-- 5.4 KB
blk-crypto.c -rw-r--r-- 11.9 KB
blk-exec.c -rw-r--r-- 3.0 KB
blk-flush.c -rw-r--r-- 15.3 KB
blk-integrity.c -rw-r--r-- 11.9 KB
blk-ioc.c -rw-r--r-- 10.1 KB
blk-iocost.c -rw-r--r-- 96.4 KB
blk-iolatency.c -rw-r--r-- 28.0 KB
blk-ioprio.c -rw-r--r-- 6.4 KB
blk-ioprio.h -rw-r--r-- 332 bytes
blk-lib.c -rw-r--r-- 11.5 KB
blk-map.c -rw-r--r-- 14.1 KB
blk-merge.c -rw-r--r-- 30.2 KB
blk-mq-cpumap.c -rw-r--r-- 2.2 KB
blk-mq-debugfs-zoned.c -rw-r--r-- 435 bytes
blk-mq-debugfs.c -rw-r--r-- 24.9 KB
blk-mq-debugfs.h -rw-r--r-- 2.7 KB
blk-mq-pci.c -rw-r--r-- 1.3 KB
blk-mq-rdma.c -rw-r--r-- 1.3 KB
blk-mq-sched.c -rw-r--r-- 18.1 KB
blk-mq-sched.h -rw-r--r-- 2.5 KB
blk-mq-sysfs.c -rw-r--r-- 7.0 KB
blk-mq-tag.c -rw-r--r-- 17.7 KB
blk-mq-tag.h -rw-r--r-- 2.6 KB
blk-mq-virtio.c -rw-r--r-- 1.3 KB
blk-mq.c -rw-r--r-- 100.2 KB
blk-mq.h -rw-r--r-- 10.1 KB
blk-pm.c -rw-r--r-- 6.8 KB
blk-pm.h -rw-r--r-- 763 bytes
blk-rq-qos.c -rw-r--r-- 7.0 KB
blk-rq-qos.h -rw-r--r-- 5.3 KB
blk-settings.c -rw-r--r-- 28.4 KB
blk-stat.c -rw-r--r-- 4.8 KB
blk-stat.h -rw-r--r-- 4.6 KB
blk-sysfs.c -rw-r--r-- 24.5 KB
blk-throttle.c -rw-r--r-- 68.5 KB
blk-timeout.c -rw-r--r-- 4.1 KB
blk-wbt.c -rw-r--r-- 19.9 KB
blk-wbt.h -rw-r--r-- 2.8 KB
blk-zoned.c -rw-r--r-- 17.0 KB
blk.h -rw-r--r-- 11.9 KB
bounce.c -rw-r--r-- 6.7 KB
bsg-lib.c -rw-r--r-- 10.0 KB
bsg.c -rw-r--r-- 6.1 KB
disk-events.c -rw-r--r-- 12.9 KB
elevator.c -rw-r--r-- 19.0 KB
fops.c -rw-r--r-- 15.2 KB
genhd.c -rw-r--r-- 35.1 KB
holder.c -rw-r--r-- 4.2 KB
ioctl.c -rw-r--r-- 15.8 KB
ioprio.c -rw-r--r-- 5.1 KB
keyslot-manager.c -rw-r--r-- 16.3 KB
kyber-iosched.c -rw-r--r-- 27.9 KB
mq-deadline.c -rw-r--r-- 30.1 KB
opal_proto.h -rw-r--r-- 9.4 KB
sed-opal.c -rw-r--r-- 62.5 KB
t10-pi.c -rw-r--r-- 7.7 KB

back to top