Re: [PATCH] jbd2: assign different lock_class_key for different filesystem

kernel test robot
2025-10-19T13:29:02Z

Hi Tetsuo,

kernel test robot noticed the following build errors:

[auto build test ERROR on tytso-ext4/dev]
[also build test ERROR on linus/master brauner-vfs/vfs.all v6.18-rc1 next-20251017]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Tetsuo-Handa/jbd2-assign-different-lock_class_key-for-different-filesystem/20251019-185450
base: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
patch link: https://lore.kernel.org/r/e42f1471-a88a-4938-8743-1d5b171c47ec%40I-love.SAKURA.ne.jp
patch subject: [PATCH] jbd2: assign different lock_class_key for different filesystem
config: x86_64-buildonly-randconfig-001-20251019 (https://download.01.org/0day-ci/archive/20251019/202510192128.u69Bbmpz-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251019/202510192128.u69Bbmpz-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202510192128.u69Bbmpz-lkp@intel.com/

All errors (new ones prefixed by >>):

>> fs/jbd2/journal.c:1553:17: error: use of undeclared identifier 'EXT4_SUPER_MAGIC'
1553 | fsmagic == EXT4_SUPER_MAGIC) {
| ^
>> fs/jbd2/journal.c:1562:17: error: use of undeclared identifier 'OCFS2_SUPER_MAGIC'
1562 | fsmagic == OCFS2_SUPER_MAGIC) {
| ^
fs/jbd2/journal.c:1585:17: error: use of undeclared identifier 'EXT4_SUPER_MAGIC'
1585 | fsmagic == EXT4_SUPER_MAGIC)
| ^
fs/jbd2/journal.c:1589:15: error: use of undeclared identifier 'OCFS2_SUPER_MAGIC'
1589 | fsmagic == OCFS2_SUPER_MAGIC)
| ^
4 errors generated.

vim +/EXT4_SUPER_MAGIC +1553 fs/jbd2/journal.c

1508
1509
1510 /*
1511 * Management for journal control blocks: functions to create and
1512 * destroy journal_t structures, and to initialise and read existing
1513 * journal blocks from disk. */
1514
1515 /* The journal_init_common() function creates and fills a journal_t object
1516 * in memory. It calls journal_load_superblock() to load the on-disk journal
1517 * superblock and initialize the journal_t object.
1518 */
1519
1520 static journal_t *journal_init_common(struct block_device *bdev, struct block_device *fs_dev,
1521 unsigned long long start, int len, int blocksize,
1522 unsigned long fsmagic)
1523 {
1524 static struct lock_class_key jbd2_trans_commit_key_ext4;
1525 static struct lock_class_key jbd2_trans_commit_key_ocfs2;
1526 static struct lock_class_key jbd2_trans_commit_key_unknown;
1527 journal_t *journal;
1528 int err;
1529 int n;
1530
1531 journal = kzalloc(sizeof(*journal), GFP_KERNEL);
1532 if (!journal)
1533 return ERR_PTR(-ENOMEM);
1534
1535 journal->j_blocksize = blocksize;
1536 journal->j_dev = bdev;
1537 journal->j_fs_dev = fs_dev;
1538 journal->j_blk_offset = start;
1539 journal->j_total_len = len;
1540 jbd2_init_fs_dev_write_error(journal);
1541
1542 err = journal_load_superblock(journal);
1543 if (err)
1544 goto err_cleanup;
1545
1546 init_waitqueue_head(&journal->j_wait_transaction_locked);
1547 init_waitqueue_head(&journal->j_wait_done_commit);
1548 init_waitqueue_head(&journal->j_wait_commit);
1549 init_waitqueue_head(&journal->j_wait_updates);
1550 init_waitqueue_head(&journal->j_wait_reserved);
1551 init_waitqueue_head(&journal->j_fc_wait);
1552 if (IS_ENABLED(CONFIG_LOCKDEP) && IS_ENABLED(CONFIG_EXT4_FS) &&
> 1553 fsmagic == EXT4_SUPER_MAGIC) {
1554 mutex_init(&journal->j_abort_mutex);
1555 mutex_init(&journal->j_barrier);
1556 mutex_init(&journal->j_checkpoint_mutex);
1557 spin_lock_init(&journal->j_revoke_lock);
1558 spin_lock_init(&journal->j_list_lock);
1559 spin_lock_init(&journal->j_history_lock);
1560 rwlock_init(&journal->j_state_lock);
1561 } else if (IS_ENABLED(CONFIG_LOCKDEP) && IS_ENABLED(CONFIG_OCFS2_FS) &&
> 1562 fsmagic == OCFS2_SUPER_MAGIC) {
1563 mutex_init(&journal->j_abort_mutex);
1564 mutex_init(&journal->j_barrier);
1565 mutex_init(&journal->j_checkpoint_mutex);
1566 spin_lock_init(&journal->j_revoke_lock);
1567 spin_lock_init(&journal->j_list_lock);
1568 spin_lock_init(&journal->j_history_lock);
1569 rwlock_init(&journal->j_state_lock);
1570 } else {
1571 mutex_init(&journal->j_abort_mutex);
1572 mutex_init(&journal->j_barrier);
1573 mutex_init(&journal->j_checkpoint_mutex);
1574 spin_lock_init(&journal->j_revoke_lock);
1575 spin_lock_init(&journal->j_list_lock);
1576 spin_lock_init(&journal->j_history_lock);
1577 rwlock_init(&journal->j_state_lock);
1578 }
1579
1580 journal->j_commit_interval = (HZ * JBD2_DEFAULT_MAX_COMMIT_AGE);
1581 journal->j_min_batch_time = 0;
1582 journal->j_max_batch_time = 15000; /* 15ms */
1583 atomic_set(&journal->j_reserved_credits, 0);
1584 if (IS_ENABLED(CONFIG_LOCKDEP) && IS_ENABLED(CONFIG_EXT4_FS) &&
1585 fsmagic == EXT4_SUPER_MAGIC)
1586 lockdep_init_map(&journal->j_trans_commit_map, "jbd2_handle_ext4",
1587 &jbd2_trans_commit_key_ext4, 0);
1588 else if (IS_ENABLED(CONFIG_LOCKDEP) && IS_ENABLED(CONFIG_OCFS2_FS) &&
1589 fsmagic == OCFS2_SUPER_MAGIC)
1590 lockdep_init_map(&journal->j_trans_commit_map, "jbd2_handle_ocfs2",
1591 &jbd2_trans_commit_key_ocfs2, 0);
1592 else
1593 lockdep_init_map(&journal->j_trans_commit_map, "jbd2_handle_unknown",
1594 &jbd2_trans_commit_key_unknown, 0);
1595
1596 /* The journal is marked for error until we succeed with recovery! */
1597 journal->j_flags = JBD2_ABORT;
1598
1599 /* Set up a default-sized revoke table for the new mount. */
1600 err = jbd2_journal_init_revoke(journal, JOURNAL_REVOKE_DEFAULT_HASH);
1601 if (err)
1602 goto err_cleanup;
1603
1604 /*
1605 * journal descriptor can store up to n blocks, we need enough
1606 * buffers to write out full descriptor block.
1607 */
1608 err = -ENOMEM;
1609 n = journal->j_blocksize / jbd2_min_tag_size();
1610 journal->j_wbufsize = n;
1611 journal->j_fc_wbuf = NULL;
1612 journal->j_wbuf = kmalloc_array(n, sizeof(struct buffer_head *),
1613 GFP_KERNEL);
1614 if (!journal->j_wbuf)
1615 goto err_cleanup;
1616
1617 err = percpu_counter_init(&journal->j_checkpoint_jh_count, 0,
1618 GFP_KERNEL);
1619 if (err)
1620 goto err_cleanup;
1621
1622 journal->j_shrink_transaction = NULL;
1623
1624 journal->j_shrinker = shrinker_alloc(0, "jbd2-journal:(%u:%u)",
1625 MAJOR(bdev->bd_dev),
1626 MINOR(bdev->bd_dev));
1627 if (!journal->j_shrinker) {
1628 err = -ENOMEM;
1629 goto err_cleanup;
1630 }
1631
1632 journal->j_shrinker->scan_objects = jbd2_journal_shrink_scan;
1633 journal->j_shrinker->count_objects = jbd2_journal_shrink_count;
1634 journal->j_shrinker->private_data = journal;
1635
1636 shrinker_register(journal->j_shrinker);
1637
1638 return journal;
1639
1640 err_cleanup:
1641 percpu_counter_destroy(&journal->j_checkpoint_jh_count);
1642 kfree(journal->j_wbuf);
1643 jbd2_journal_destroy_revoke(journal);
1644 journal_fail_superblock(journal);
1645 kfree(journal);
1646 return ERR_PTR(err);
1647 }
1648

--
0-DAY CI Kernel Test Service