mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [syzbot] [nilfs?] INFO: task hung in find_inode (2)
@ 2025-01-09  4:54 syzbot
  2026-08-15 17:56 ` Forwarded: " syzbot
  2026-09-22  7:41 ` syzbot
  0 siblings, 2 replies; 3+ messages in thread
From: syzbot @ 2025-01-09  4:54 UTC (permalink / raw)
  To: konishi.ryusuke, linux-kernel, linux-nilfs, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    ab75170520d4 Merge tag 'linux-watchdog-6.13-rc6' of git://..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=156a96f8580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=ba7cde9482d6bb6
dashboard link: https://syzkaller.appspot.com/bug?extid=6646318bbcf419411bc5
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1725f8b0580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10d909c4580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/205ade41622a/disk-ab751705.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/39aa1b893dfc/vmlinux-ab751705.xz
kernel image: https://storage.googleapis.com/syzbot-assets/c741f4e4b082/bzImage-ab751705.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/9907b5d18f5c/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+6646318bbcf419411bc5@syzkaller.appspotmail.com

INFO: task syz-executor173:6352 blocked for more than 143 seconds.
      Not tainted 6.13.0-rc5-syzkaller-00163-gab75170520d4 #0
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:syz-executor173 state:D stack:22848 pid:6352  tgid:6351  ppid:5841   flags:0x00004006
Call Trace:
 <TASK>
 context_switch kernel/sched/core.c:5369 [inline]
 __schedule+0x17fb/0x4be0 kernel/sched/core.c:6756
 __schedule_loop kernel/sched/core.c:6833 [inline]
 schedule+0x14b/0x320 kernel/sched/core.c:6848
 __wait_on_freeing_inode+0x1a4/0x2f0 fs/inode.c:2502
 find_inode+0x29e/0x480 fs/inode.c:1062
 inode_insert5+0xfd/0x4c0 fs/inode.c:1333
 insert_inode_locked4+0x5b/0xb0 fs/inode.c:1879
 nilfs_insert_inode_locked fs/nilfs2/inode.c:291 [inline]
 nilfs_new_inode+0x59d/0x830 fs/nilfs2/inode.c:345
 nilfs_mkdir+0x10d/0x340 fs/nilfs2/namei.c:234
 vfs_mkdir+0x2f9/0x4f0 fs/namei.c:4311
 do_mkdirat+0x264/0x3a0 fs/namei.c:4334
 __do_sys_mkdirat fs/namei.c:4349 [inline]
 __se_sys_mkdirat fs/namei.c:4347 [inline]
 __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:4347
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f1a0ea43cc9
RSP: 002b:00007f1a0e9fa218 EFLAGS: 00000246 ORIG_RAX: 0000000000000102
RAX: ffffffffffffffda RBX: 00007f1a0eacc6a8 RCX: 00007f1a0ea43cc9
RDX: 00000000000001c0 RSI: 0000000020000080 RDI: 00000000ffffff9c
RBP: 00007f1a0eacc6a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 74733d726564726f
R13: 0031656c69662f2e R14: 6569727261626f6e R15: 0030656c69662f2e
 </TASK>

Showing all locks held in the system:
1 lock held by khungtaskd/30:
 #0: ffffffff8e937ae0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:337 [inline]
 #0: ffffffff8e937ae0 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline]
 #0: ffffffff8e937ae0 (rcu_read_lock){....}-{1:3}, at: debug_show_all_locks+0x55/0x2a0 kernel/locking/lockdep.c:6744
3 locks held by kworker/1:1/46:
 #0: ffff88801ac80948 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3204 [inline]
 #0: ffff88801ac80948 ((wq_completion)events){+.+.}-{0:0}, at: process_scheduled_works+0x93b/0x1840 kernel/workqueue.c:3310
 #1: ffffc90000b67d00 ((work_completion)(&sci->sc_iput_work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3205 [inline]
 #1: ffffc90000b67d00 ((work_completion)(&sci->sc_iput_work)){+.+.}-{0:0}, at: process_scheduled_works+0x976/0x1840 kernel/workqueue.c:3310
 #2: ffff8880772d6610 (sb_internal#2){.+.+}-{0:0}, at: nilfs_evict_inode+0x167/0x500 fs/nilfs2/inode.c:861
3 locks held by kworker/0:3/1220:
 #0: ffff88801ac80948 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3204 [inline]
 #0: ffff88801ac80948 ((wq_completion)events){+.+.}-{0:0}, at: process_scheduled_works+0x93b/0x1840 kernel/workqueue.c:3310
 #1: ffffc900044cfd00 ((work_completion)(&sci->sc_iput_work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3205 [inline]
 #1: ffffc900044cfd00 ((work_completion)(&sci->sc_iput_work)){+.+.}-{0:0}, at: process_scheduled_works+0x976/0x1840 kernel/workqueue.c:3310
 #2: ffff888070e54610 (sb_internal#2){.+.+}-{0:0}, at: nilfs_evict_inode+0x167/0x500 fs/nilfs2/inode.c:861
3 locks held by kworker/1:2/3075:
 #0: ffff88801ac80948 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3204 [inline]
 #0: ffff88801ac80948 ((wq_completion)events){+.+.}-{0:0}, at: process_scheduled_works+0x93b/0x1840 kernel/workqueue.c:3310
 #1: ffffc9000c4a7d00 ((work_completion)(&sci->sc_iput_work)){+.+.}-{0:0}
, at: process_one_work kernel/workqueue.c:3205 [inline]
, at: process_scheduled_works+0x976/0x1840 kernel/workqueue.c:3310
 #2: ffff88807fa26610 (sb_internal#2){.+.+}-{0:0}, at: nilfs_evict_inode+0x167/0x500 fs/nilfs2/inode.c:861
1 lock held by udevd/5198:
 #0: ffff8880b863e758 (&rq->__lock){-.-.}-{2:2}, at: raw_spin_rq_lock_nested+0x2a/0x140 kernel/sched/core.c:598
2 locks held by getty/5587:
 #0: ffff88814da010a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref_wait+0x25/0x70 drivers/tty/tty_ldisc.c:243
 #1: ffffc900032fb2f0 (&ldata->atomic_read_lock){+.+.}-{4:4}, at: n_tty_read+0x6a6/0x1e00 drivers/tty/n_tty.c:2211
1 lock held by syz-executor173/5842:
 #0: ffffffff8e93cff8 (rcu_state.exp_mutex){+.+.}-{4:4}, at: exp_funnel_lock kernel/rcu/tree_exp.h:297 [inline]
 #0: ffffffff8e93cff8 (rcu_state.exp_mutex){+.+.}-{4:4}, at: synchronize_rcu_expedited+0x381/0x830 kernel/rcu/tree_exp.h:976
1 lock held by syz-executor173/5843:
 #0: ffffffff8e93cff8 (rcu_state.exp_mutex){+.+.}-{4:4}, at: exp_funnel_lock kernel/rcu/tree_exp.h:329 [inline]
 #0: ffffffff8e93cff8 (rcu_state.exp_mutex){+.+.}-{4:4}, at: synchronize_rcu_expedited+0x451/0x830 kernel/rcu/tree_exp.h:976
4 locks held by syz-executor173/6352:
 #0: ffff8880772d6420 (sb_writers#9){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:515
 #1: ffff888073484f20 (&type->i_mutex_dir_key#6/1){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:853 [inline]
 #1: ffff888073484f20 (&type->i_mutex_dir_key#6/1){+.+.}-{4:4}, at: filename_create+0x260/0x540 fs/namei.c:4080
 #2: ffff8880772d6610 (sb_internal#2){.+.+}-{0:0}, at: nilfs_mkdir+0xce/0x340 fs/nilfs2/namei.c:228
 #3: ffff888024bcc2a0 (&nilfs->ns_segctor_sem){++++}-{4:4}, at: nilfs_transaction_begin+0x320/0x6e0 fs/nilfs2/segment.c:223
1 lock held by segctord/6356:
 #0: ffff888024bcc2a0 (&nilfs->ns_segctor_sem){++++}-{4:4}, at: nilfs_transaction_lock+0x25d/0x4f0 fs/nilfs2/segment.c:357
4 locks held by syz-executor173/7364:
 #0: ffff888070e54420 (sb_writers#9){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:515
 #1: ffff88807355c8c0 (&type->i_mutex_dir_key#6/1){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:853 [inline]
 #1: ffff88807355c8c0 (&type->i_mutex_dir_key#6/1){+.+.}-{4:4}, at: filename_create+0x260/0x540 fs/namei.c:4080
 #2: ffff888070e54610 (sb_internal#2){.+.+}-{0:0}, at: nilfs_mkdir+0xce/0x340 fs/nilfs2/namei.c:228
 #3: ffff88802a1f22a0 (&nilfs->ns_segctor_sem){++++}-{4:4}, at: nilfs_transaction_begin+0x320/0x6e0 fs/nilfs2/segment.c:223
1 lock held by segctord/7370:
 #0: ffff88802a1f22a0 (&nilfs->ns_segctor_sem){++++}-{4:4}, at: nilfs_transaction_lock+0x25d/0x4f0 fs/nilfs2/segment.c:357
4 locks held by syz-executor173/9191:
 #0: ffff88807fa26420 (sb_writers#9){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:515
 #1: ffff8880734dd580 (&type->i_mutex_dir_key#6/1){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:853 [inline]
 #1: ffff8880734dd580 (&type->i_mutex_dir_key#6/1){+.+.}-{4:4}, at: filename_create+0x260/0x540 fs/namei.c:4080
 #2: ffff88807fa26610 (sb_internal#2){.+.+}-{0:0}, at: nilfs_mkdir+0xce/0x340 fs/nilfs2/namei.c:228
 #3: ffff88807ab9f2a0 (&nilfs->ns_segctor_sem){++++}-{4:4}, at: nilfs_transaction_begin+0x320/0x6e0 fs/nilfs2/segment.c:223
1 lock held by segctord/9198:
 #0: ffff88807ab9f2a0 (&nilfs->ns_segctor_sem){++++}-{4:4}, at: nilfs_transaction_lock+0x25d/0x4f0 fs/nilfs2/segment.c:357

=============================================

NMI backtrace for cpu 0
CPU: 0 UID: 0 PID: 30 Comm: khungtaskd Not tainted 6.13.0-rc5-syzkaller-00163-gab75170520d4 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 nmi_cpu_backtrace+0x49c/0x4d0 lib/nmi_backtrace.c:113
 nmi_trigger_cpumask_backtrace+0x198/0x320 lib/nmi_backtrace.c:62
 trigger_all_cpu_backtrace include/linux/nmi.h:162 [inline]
 check_hung_uninterruptible_tasks kernel/hung_task.c:234 [inline]
 watchdog+0xff6/0x1040 kernel/hung_task.c:397
 kthread+0x2f0/0x390 kernel/kthread.c:389
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>
Sending NMI from CPU 0 to CPUs 1:
NMI backtrace for cpu 1
CPU: 1 UID: 0 PID: 43 Comm: kworker/1:1H Not tainted 6.13.0-rc5-syzkaller-00163-gab75170520d4 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Workqueue:  0x0 (kblockd)
RIP: 0010:update_misfit_status+0x46/0x660 kernel/sched/fair.c:5230
Code: ff df 48 8d 9e d8 0b 00 00 48 89 d8 48 c1 e8 03 42 0f b6 04 20 84 c0 75 17 8b 1b 66 90 48 83 c4 20 5b 41 5c 41 5d 41 5e 41 5f <5d> c3 cc cc cc cc 89 d9 80 e1 07 80 c1 03 38 c1 7c dd 48 89 df e8
RSP: 0018:ffffc90000b37ac0 EFLAGS: 00000082
RAX: 0000000000000000 RBX: ffff88801d2d0000 RCX: dffffc0000000000
RDX: ffff888027301ec0 RSI: ffff8880b873e740 RDI: ffff88801d2d0000
RBP: ffff88801d2d00c8 R08: ffffffff814ec593 R09: 1ffffffff2030ad6
R10: dffffc0000000000 R11: fffffbfff2030ad7 R12: 1ffff110170e7e64
R13: ffff88801d2d00c0 R14: ffff8880b873e740 R15: ffff8880b873f320
FS:  0000000000000000(0000) GS:ffff8880b8700000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f1a065ff000 CR3: 000000000e736000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <NMI>
 </NMI>
 <TASK>
 __set_next_task_fair kernel/sched/fair.c:13272 [inline]
 pick_next_task_fair+0x9af/0xc90 kernel/sched/fair.c:8970
 __pick_next_task+0xdd/0x400 kernel/sched/core.c:6023
 __schedule+0x776/0x4be0 kernel/sched/core.c:6709
 __schedule_loop kernel/sched/core.c:6833 [inline]
 schedule+0x14b/0x320 kernel/sched/core.c:6848
 worker_thread+0xa30/0xd30 kernel/workqueue.c:3406
 kthread+0x2f0/0x390 kernel/kthread.c:389
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>
INFO: NMI handler (nmi_cpu_backtrace_handler) took too long to run: 1.117 msecs


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Forwarded: Re: [syzbot] [nilfs?] INFO: task hung in find_inode (2)
  2025-01-09  4:54 [syzbot] [nilfs?] INFO: task hung in find_inode (2) syzbot
@ 2026-08-15 17:56 ` syzbot
  2026-09-22  7:41 ` syzbot
  1 sibling, 0 replies; 3+ messages in thread
From: syzbot @ 2026-08-15 17:56 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [nilfs?] INFO: task hung in find_inode (2)
Author: konishi.ryusuke@gmail.com


#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git c21bb4193868

Fix deadlock between find_inode() and nilfs_evict_inode()

diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 9332f5ac6083..6b2b7060f004 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -830,8 +830,11 @@ static void nilfs_iput_work_func(struct work_struct *work)
 	struct nilfs_sc_info *sci = container_of(work, struct nilfs_sc_info,
 						 sc_iput_work);
 	struct the_nilfs *nilfs = sci->sc_super->s_fs_info;
+	struct nilfs_transaction_info ti;
 
+	nilfs_transaction_begin(sci->sc_super, &ti, 0);
 	nilfs_dispose_list(nilfs, &sci->sc_iput_queue, 0);
+	nilfs_transaction_commit(sci->sc_super);
 }
 
 static int nilfs_test_metadata_dirty(struct the_nilfs *nilfs,
-- 
2.43.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Forwarded: Re: [syzbot] [nilfs?] INFO: task hung in find_inode (2)
  2025-01-09  4:54 [syzbot] [nilfs?] INFO: task hung in find_inode (2) syzbot
  2026-08-15 17:56 ` Forwarded: " syzbot
@ 2026-09-22  7:41 ` syzbot
  1 sibling, 0 replies; 3+ messages in thread
From: syzbot @ 2026-09-22  7:41 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [nilfs?] INFO: task hung in find_inode (2)
Author: konishi.ryusuke@gmail.com

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 89a312991dc6

Avoid a three-way deadlock involving find_inode(),
nilfs_evict_inode(), and the log writer by checking the inode bitmap
during normal inode loading.

diff --git a/fs/nilfs2/alloc.c b/fs/nilfs2/alloc.c
index 7b1cd2baefcf..32f54382f95d 100644
--- a/fs/nilfs2/alloc.c
+++ b/fs/nilfs2/alloc.c
@@ -404,6 +404,13 @@ static size_t nilfs_palloc_bitmap_offset(const struct buffer_head *bh)
 	return offset_in_folio(bh->b_folio, bh->b_data);
 }
 
+static size_t nilfs_palloc_entry_offset_in_block(
+	const struct inode *inode, unsigned long entry_index_in_group)
+{
+	return (entry_index_in_group % NILFS_MDT(inode)->mi_entries_per_block)
+		* NILFS_MDT(inode)->mi_entry_size;
+}
+
 /**
  * nilfs_palloc_entry_offset - calculate the byte offset of an entry in the
  *                             folio containing it
@@ -416,14 +423,61 @@ static size_t nilfs_palloc_bitmap_offset(const struct buffer_head *bh)
 size_t nilfs_palloc_entry_offset(const struct inode *inode, __u64 nr,
 				 const struct buffer_head *bh)
 {
-	unsigned long entry_index_in_group, entry_index_in_block;
+	unsigned long entry_index_in_group;
 
 	nilfs_palloc_group(inode, nr, &entry_index_in_group);
-	entry_index_in_block = entry_index_in_group %
-		NILFS_MDT(inode)->mi_entries_per_block;
 
 	return offset_in_folio(bh->b_folio, bh->b_data) +
-		entry_index_in_block * NILFS_MDT(inode)->mi_entry_size;
+		nilfs_palloc_entry_offset_in_block(inode, entry_index_in_group);
+}
+
+/**
+ * nilfs_palloc_kmap_entry - map the page containing the entry and calculate
+ *                           the entry's memory address on it
+ * @inode:        inode of metadata file using this allocator
+ * @nr:           serial number of the entry (e.g. inode number)
+ * @entry_bh:     buffer head of the entry block
+ * @bitmap_check: whether to perform bitmap testing
+ *
+ * Return: Pointer to the mapped entry on success, or an ERR_PTR() encoded
+ * error code on failure.  Specifically, returns %-ENOENT if @bitmap_check
+ * is true and the bitmap block managing the entry does not exist, or if the
+ * corresponding bit for the entry is not set in the bitmap.  Note that this
+ * function never fails when @bitmap_check is false.
+ */
+void *nilfs_palloc_kmap_entry(struct inode *inode, __u64 nr,
+			const struct buffer_head *entry_bh, bool bitmap_check)
+{
+	unsigned long group, entry_index_in_group;
+	size_t entry_offset;
+
+	group = nilfs_palloc_group(inode, nr, &entry_index_in_group);
+	if (bitmap_check) {
+		struct buffer_head *bitmap_bh;
+		unsigned char *bitmap;
+		size_t bitmap_offset;
+		int ret;
+
+		ret = nilfs_palloc_get_bitmap_block(inode, group, 0,
+						&bitmap_bh);
+		if (unlikely(ret))
+			return ERR_PTR(ret);
+
+		bitmap_offset = nilfs_palloc_bitmap_offset(bitmap_bh);
+		bitmap = kmap_local_folio(bitmap_bh->b_folio, bitmap_offset);
+		if (!test_bit_le(entry_index_in_group, bitmap))
+			ret = -ENOENT;
+		kunmap_local(bitmap);
+		brelse(bitmap_bh);
+
+		if (ret)
+			return ERR_PTR(ret);
+	}
+
+	entry_offset = offset_in_folio(entry_bh->b_folio, entry_bh->b_data) +
+		nilfs_palloc_entry_offset_in_block(inode, entry_index_in_group);
+
+	return kmap_local_folio(entry_bh->b_folio, entry_offset);
 }
 
 /**
diff --git a/fs/nilfs2/alloc.h b/fs/nilfs2/alloc.h
index 046d876ea3e0..2c184d0ff097 100644
--- a/fs/nilfs2/alloc.h
+++ b/fs/nilfs2/alloc.h
@@ -35,6 +35,8 @@ int nilfs_palloc_get_entry_block(struct inode *, __u64, int,
 				 struct buffer_head **);
 size_t nilfs_palloc_entry_offset(const struct inode *inode, __u64 nr,
 				 const struct buffer_head *bh);
+void *nilfs_palloc_kmap_entry(struct inode *inode, __u64 nr,
+			const struct buffer_head *entry_bh, bool bitmap_check);
 
 int nilfs_palloc_count_max_entries(struct inode *, u64, u64 *);
 
diff --git a/fs/nilfs2/ifile.h b/fs/nilfs2/ifile.h
index d38a46f5ae41..bc47bb139e1c 100644
--- a/fs/nilfs2/ifile.h
+++ b/fs/nilfs2/ifile.h
@@ -19,11 +19,10 @@
 
 
 static inline struct nilfs_inode *
-nilfs_ifile_map_inode(struct inode *ifile, u64 ino, struct buffer_head *ibh)
+nilfs_ifile_map_inode(struct inode *ifile, u64 ino,
+		const struct buffer_head *ibh, bool bitmap_check)
 {
-	size_t __offset_in_folio = nilfs_palloc_entry_offset(ifile, ino, ibh);
-
-	return kmap_local_folio(ibh->b_folio, __offset_in_folio);
+	return nilfs_palloc_kmap_entry(ifile, ino, ibh, bitmap_check);
 }
 
 static inline void nilfs_ifile_unmap_inode(struct nilfs_inode *raw_inode)
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index 34e6096069ad..09de917b4b82 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -455,7 +455,14 @@ static int __nilfs_read_inode(struct super_block *sb,
 	if (unlikely(err))
 		goto bad_inode;
 
-	raw_inode = nilfs_ifile_map_inode(root->ifile, ino, bh);
+	raw_inode = nilfs_ifile_map_inode(root->ifile, ino, bh, true);
+	if (IS_ERR(raw_inode)) {
+		err = PTR_ERR(raw_inode);
+		if (err == -ENOENT)
+			err = -ESTALE;
+		brelse(bh);
+		goto bad_inode;
+	}
 
 	err = nilfs_read_inode_common(inode, raw_inode);
 	if (err)
@@ -743,7 +750,7 @@ void nilfs_update_inode(struct inode *inode, struct buffer_head *ibh, int flags)
 	struct inode *ifile = ii->i_root->ifile;
 	struct nilfs_inode *raw_inode;
 
-	raw_inode = nilfs_ifile_map_inode(ifile, ino, ibh);
+	raw_inode = nilfs_ifile_map_inode(ifile, ino, ibh, false);
 
 	if (test_and_clear_bit(NILFS_I_NEW, &ii->i_state))
 		memset(raw_inode, 0, NILFS_MDT(ifile)->mi_entry_size);
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 829573cb6131..23b24373befc 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -895,7 +895,7 @@ static void nilfs_fill_in_file_bmap(struct inode *ifile,
 		ibh = ii->i_bh;
 		BUG_ON(!ibh);
 		raw_inode = nilfs_ifile_map_inode(ifile, ii->vfs_inode.i_ino,
-						  ibh);
+						  ibh, false);
 		nilfs_bmap_write(ii->i_bmap, raw_inode);
 		nilfs_ifile_unmap_inode(raw_inode);
 	}
-- 
2.53.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-22  7:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-09  4:54 [syzbot] [nilfs?] INFO: task hung in find_inode (2) syzbot
2026-08-15 17:56 ` Forwarded: " syzbot
2026-09-22  7:41 ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®