From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796183461; b=CZb7QfB3idZ7ydswF6iof+3kIrTh/alLdUgQU8JaVRKMRAPab8zBnIdEwJpX5b1eUDcW tUMthckQ3L1+YHVEsez0GNbSte1APsP/KWWE/56PdYhp32R7hB6nfpA1BVSmiUyCL9kbo opo316k1gGsli/55zHRAcDRUAQ+HXO5HWxn84Ez+ISWu97u18cLfkR92BaePLBVQmZdvi B5EGcspEzO7skJLGvUrFtuB2oOdEqjWU4jSD7yXUg+SZU7SOYYf06IZIqTnCzpQXAxItE 97MNrNMy9L8vlnnjRmGkhmgyE9GagDlyPZDA0wPZQzPiJhFvBCtYbUz+qzKYwYPeTrw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796183461; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=WPzDfHfVRE/W7nsiGEcjfo6GjrX7FyWMPPmeHLClSq0=; b=ADmBey0qVDoBojd0UpIZm3OHnbK5UFhBz5JgSTulvpU8nxeC0FdrgHlokTQGgveKVcQG s6KHibH6Mbmwz2v5eNp+uWtcUU+tHdjgomNn3H8pSIJpinsnoAk45ganzJRahYWS52I/0 XM7c+lX7PMzMKwbV/vAhdsDPxWo/Li62jwaG9X9tupuefuosjkhU2IXeg4hDH2+zQ/Wkr i22UgTAKPAfg27x5aaUh3tFrmhiAjsW5a/y0Js5IkMLl2l1J2emQbAjSdU1JsqyJ9ZU26 QAjNRwkZDomjZuj+sh0oGBWT0xh/JS3tTiZ81ab3DyPWZIaH6UBJpsVA2o3e8bQYvxQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b="VOnoxRZ/"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44BFC606A31A; Wed, 2 Dec 2026 03:51:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=VOnoxRZ/ Received: by smtp.kernel.org (Postfix) with ESMTPSA id F371B1F00893; Wed, 2 Dec 2026 03:51:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796183461; bh=WPzDfHfVRE/W7nsiGEcjfo6GjrX7FyWMPPmeHLClSq0=; h=Date:To:From:In-Reply-To:References:Subject; b=VOnoxRZ/e8IaxOCwfRF4Ef7z3fLqZB5Q72IsqVtQF/P+eQQESbCLCYDUpbR+xuQe0 0Vvjvmd5rbA6nGr7siQx5degWAVHdFt43t+q3m6WK6cb5HtPk/3TaK9q3LOFQfvT3N 4Ow626yedjE4Bb2vT6eciZd3pOXZnZKhQQ/cC4rw= Date: Tue, 01 Dec 2026 19:51:00 -0800 To: mm-commits@vger.kernel.org,zzzccc427@gmail.com,tytso@mit.edu, syzbot+38fdbb551940270021f1@syzkaller.appspotmail.com,stable@vger.kernel.org, mark@fasheh.com,joseph.qi@linux.alibaba.com,jlbec@evilplan.org,jack@suse.cz, heming.zhao@suse.com,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <6b0257ca.6ccd1e40.868ea.001a.GAE@google.com> References: <6b0257ca.6ccd1e40.868ea.001a.GAE@google.com> Subject: [merged mm-nonmm-hotfixes-stable] ocfs2-unregister-the-jbd2-shrinker-before-journal-shutdown.patch removed from -mm tree Message-Id: <20261202035100.F371B1F00893@smtp.kernel.org> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The quilt patch titled Subject: ocfs2: unregister the JBD2 shrinker before journal shutdown has been removed from the -mm tree. Its filename was ocfs2-unregister-the-jbd2-shrinker-before-journal-shutdown.patch This patch was dropped because it was merged into the mm-nonmm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm ------------------------------------------------------ From: Andrew Morton Subject: ocfs2: unregister the JBD2 shrinker before journal shutdown Date: Sat, 21 Nov 2026 19:34:56 -0800 sysbot reports a lockdep cycle through shrinker_mutex, filesystem reclaim and osb->journal_shutdown_sem. Unmount holds the superblock's s_umount exclusively, while the OCFS2 reclaim path must first get its read side with super_trylock_shared(). That excludes the two paths for the same superblock; the report does not establish a runtime deadlock. Still, the lock ordering is visible to lockdep and produces the warning. The write side of journal_shutdown_sem must cover all of jbd2_journal_destroy(): ocfs2_clear_inode() can otherwise release a JBD2 inode through a journal that is being destroyed. Move only the JBD2 shrinker unregister operation before taking the semaphore. shrinker_free() waits for active shrinker users, so the journal and its checkpoint counter remain alive while they finish. A successfully initialized JBD2 journal always has a checkpoint counter. Destroy it after unregistering the shrinker, whether unregistering happened here or before taking the OCFS2 semaphore. The semaphore continues to protect JBD2 destruction, removal of osb->journal and freeing the OCFS2 journal. The userspace-visible result is removal of this lockdep warning during OCFS2 unmount; the report does not demonstrate a hung unmount. Link: https://lore.kernel.org/6b0257ca.6ccd1e40.868ea.001a.GAE@google.com Fixes: f277230d002d ("ocfs2: serialize inode journal access with shutdown") Signed-off-by: Andrew Morton Reported-by: Closes: https://syzkaller.appspot.com/bug?extid=38fdbb551940270021f1 Tested-by: Andrew Morton Link: https://lore.kernel.org/20261122093400.b726ecddf154f493dec1c892@linux-foundation.org Reviewed-by: Joseph Qi Cc: Cen Zhang Cc: Mark Fasheh Cc: Joel Becker Cc: Heming Zhao Cc: Theodore Ts'o Cc: Jan Kara Cc: --- Tested with CONFIG_PROVE_LOCKING=y in x86-64 QEMU guests. A omitted this patch; B added it alone. OCFS2 and JBD2 were built in. Syzbot's C reproducer mounted a local OCFS2 image, accessed 200 files, exercised reclaim and unmounted it. A reproduced the reported circular locking warning: shrinker_free() ran from jbd2_journal_destroy() while ocfs2_journal_shutdown() held journal_shutdown_sem. The unmount completed; this test did not show a runtime deadlock. B completed the same sequence without a warning. Three further mount/reclaim/unmount cycles on B also completed without warnings. An ext4 read/write/unmount control passed on both kernels. Both builds needed the same temporary correction for an unrelated mm/util.c compile error in another queued patch. The correction was removed after testing. The test did not force an active JBD2 shrinker callback to overlap unmount or exercise failed-mount cleanup. fs/jbd2/journal.c | 17 +++++++++++++---- fs/ocfs2/journal.c | 1 + include/linux/jbd2.h | 1 + 3 files changed, 15 insertions(+), 4 deletions(-) --- a/fs/jbd2/journal.c~ocfs2-unregister-the-jbd2-shrinker-before-journal-shutdown +++ a/fs/jbd2/journal.c @@ -75,6 +75,7 @@ EXPORT_SYMBOL(jbd2_journal_check_availab EXPORT_SYMBOL(jbd2_journal_set_features); EXPORT_SYMBOL(jbd2_journal_load); EXPORT_SYMBOL(jbd2_journal_destroy); +EXPORT_SYMBOL(jbd2_journal_unregister_shrinker); EXPORT_SYMBOL(jbd2_journal_abort); EXPORT_SYMBOL(jbd2_journal_errno); EXPORT_SYMBOL(jbd2_journal_ack_err); @@ -2126,6 +2127,16 @@ int jbd2_journal_load(journal_t *journal return 0; } +void jbd2_journal_unregister_shrinker(journal_t *journal) +{ + struct shrinker *shrinker = journal->j_shrinker; + + if (!shrinker) + return; + journal->j_shrinker = NULL; + shrinker_free(shrinker); +} + /** * jbd2_journal_destroy() - Release a journal_t structure. * @journal: Journal to act on. @@ -2199,10 +2210,8 @@ int jbd2_journal_destroy(journal_t *jour brelse(journal->j_sb_buffer); } - if (journal->j_shrinker) { - percpu_counter_destroy(&journal->j_checkpoint_jh_count); - shrinker_free(journal->j_shrinker); - } + jbd2_journal_unregister_shrinker(journal); + percpu_counter_destroy(&journal->j_checkpoint_jh_count); if (journal->j_proc_entry) jbd2_stats_proc_exit(journal); iput(journal->j_inode); --- a/fs/ocfs2/journal.c~ocfs2-unregister-the-jbd2-shrinker-before-journal-shutdown +++ a/fs/ocfs2/journal.c @@ -1115,6 +1115,7 @@ void ocfs2_journal_shutdown(struct ocfs2 mlog_errno(status); } + jbd2_journal_unregister_shrinker(journal->j_journal); /* * Exclude the final JBD2 inode cleanup in ocfs2_clear_inode() while * the journal is destroyed and freed. --- a/include/linux/jbd2.h~ocfs2-unregister-the-jbd2-shrinker-before-journal-shutdown +++ a/include/linux/jbd2.h @@ -1567,6 +1567,7 @@ extern void jbd2_journal_clear_featur (journal_t *, unsigned long, unsigned long, unsigned long); extern int jbd2_journal_load (journal_t *journal); extern int jbd2_journal_destroy (journal_t *); +extern void jbd2_journal_unregister_shrinker(journal_t *); extern int jbd2_journal_recover (journal_t *journal); extern int jbd2_journal_wipe (journal_t *, int); extern int jbd2_journal_skip_recovery (journal_t *); _ Patches currently in -mm which might be from akpm@linux-foundation.org are kselftest-mm-rename-read_pmd_pagesize-to-pmd_psize-fix.patch selftests-mm-check-madv_cold-and-madv_pageout-on-partly-advised-thps-fix.patch selftests-mm-add-uffdio_move-huge-zeropage-pmd-regression-test-fix.patch selftests-mm-allocate-nr_pages-based-on-pmd-size-for-uffd-pmd_move-tests-fix.patch selftests-mm-retain-move-pmd-coverage-and-verify-huge-pmds.patch lib-test_xarray-check-unused-spare-node-after-range-creation.patch mm-memory-failure-dont-unpoison-a-leaked-raw_hwp_unreliable-folio-fix.patch mm-hugetlb-delay-anon-folio-rmap-removal-until-after-the-tlb-flush-fix.patch mm-hugetlb-delay-anon-folio-rmap-removal-until-after-the-tlb-flush-fix-2.patch mm-vmstat_kunit-add-synthetic-benchmark-for-mm-stats-fix.patch mm-prevent-pre-content-bypass-through-mremap-and-remap_file_pages.patch afs-do-not-put-error-pointer-after-address-lookup-failure.patch selftests-mm-check-that-fsync-reports-hard-poisoned-dirty-page-cache.patch selftests-mm-memory-failure-truncate-poisoned-fuse-page-cache-before-teardown.patch selftests-mm-memory-failure-skip-poisoned-dirty-page-cache-on-nilfs2.patch selftest-mm-memory-failure-keep-page-cache-files-linked-until-cleanup.patch selftest-mm-memory-failure-keep-page-cache-files-linked-until-cleanup-fix.patch selftests-mm-memory-failure-skip-hard-dirty-page-cache-test-on-cephfs.patch selftests-mm-memory-failure-close-dirty-page-cache-files-before-unlinking-them.patch selftests-mm-memory-failure-extend-page-cache-test-files-with-pwrite.patch selftests-mm-memory-failure-write-the-whole-page-cache-test-file-for-omfs.patch selftests-mm-memory-failure-accept-eio-from-close-after-poisoning-dirty-data.patch alloc_tag-introduce-ioctls-to-toggle-allocation-tracepoints-fix-fix.patch alloc_tag-introduce-ioctls-to-toggle-allocation-tracepoints-fix.patch mm-vmscan-scope-freeze-writeback-skip-to-the-reclaim-target.patch mm-vmscan-scope-freeze-writeback-skip-to-the-reclaim-target-fix.patch mm-hmm-refuse-secretmem-vmas-in-hmm_range_fault-fix.patch mm-huge_memory-set-memcg_data-before-a-split-page-leaves-the-folio-fix.patch ipc-msg-clamp-negative-msg_info-usage-counts.patch squashfs-fix-leaked-page-locks-when-page-actor-allocation-fails-fix.patch ocfs2-skip-network-flush-when-no-domain-handlers-are-registered.patch selftests-ptrace-check-that-ptrace_set_syscall_info-rejects-invalid-error-values-fix.patch lib-atomic64-separate-hashed-locks-by-smp-cache-line.patch nvdimm-btt-separate-map-locks-by-smp-cache-line.patch percpu_ref-replace-the-global-switch-lock-with-hashed-locks-fix.patch drivers-media-v4l2-core-v4l2-vp9c-reduce-inlining.patch