LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [syzbot] INFO: task hung in fuse_launder_page
@ 2021-08-13 13:16 syzbot
  2021-08-17 14:41 ` Miklos Szeredi
  0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2021-08-13 13:16 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel, miklos, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    36a21d51725a Linux 5.14-rc5
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=104b8eaa300000
kernel config:  https://syzkaller.appspot.com/x/.config?x=e3a20bae04b96ccd
dashboard link: https://syzkaller.appspot.com/bug?extid=bea44a5189836d956894
compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.1
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=143c0ee9300000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=158fc9aa300000

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

INFO: task syz-executor276:8433 blocked for more than 143 seconds.
      Not tainted 5.14.0-rc5-syzkaller #0
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:syz-executor276 state:D stack:27736 pid: 8433 ppid:  8430 flags:0x00004004
Call Trace:
 context_switch kernel/sched/core.c:4681 [inline]
 __schedule+0x93a/0x26f0 kernel/sched/core.c:5938
 schedule+0xd3/0x270 kernel/sched/core.c:6017
 fuse_wait_on_page_writeback fs/fuse/file.c:452 [inline]
 fuse_wait_on_page_writeback+0x120/0x170 fs/fuse/file.c:448
 fuse_launder_page fs/fuse/file.c:2316 [inline]
 fuse_launder_page+0xe9/0x130 fs/fuse/file.c:2306
 do_launder_page mm/truncate.c:595 [inline]
 invalidate_inode_pages2_range+0x994/0xf80 mm/truncate.c:661
 fuse_finish_open+0x2d9/0x560 fs/fuse/file.c:202
 fuse_open_common+0x2f9/0x4c0 fs/fuse/file.c:254
 do_dentry_open+0x4c8/0x11d0 fs/open.c:826
 do_open fs/namei.c:3374 [inline]
 path_openat+0x1c23/0x27f0 fs/namei.c:3507
 do_filp_open+0x1aa/0x400 fs/namei.c:3534
 do_sys_openat2+0x16d/0x420 fs/open.c:1204
 do_sys_open fs/open.c:1220 [inline]
 __do_sys_creat fs/open.c:1294 [inline]
 __se_sys_creat fs/open.c:1288 [inline]
 __x64_sys_creat+0xc9/0x120 fs/open.c:1288
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x446409
RSP: 002b:00007f0e6a9f92f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000055
RAX: ffffffffffffffda RBX: 00000000004d34f0 RCX: 0000000000446409
RDX: 0000000000446409 RSI: 0000000000000000 RDI: 0000000020000280
RBP: 00000000004a3164 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0030656c69662f2e
R13: 000000000049f158 R14: 00000000004a1160 R15: 00000000004d34f8

Showing all locks held in the system:
1 lock held by khungtaskd/1584:
 #0: ffffffff8b97c1c0 (rcu_read_lock){....}-{1:2}, at: debug_show_all_locks+0x53/0x260 kernel/locking/lockdep.c:6446
2 locks held by syz-executor276/8433:
 #0: ffff888015e38460 (sb_writers#11){.+.+}-{0:0}, at: do_open fs/namei.c:3367 [inline]
 #0: ffff888015e38460 (sb_writers#11){.+.+}-{0:0}, at: path_openat+0x1aee/0x27f0 fs/namei.c:3507
 #1: ffff8880397d0150 (&sb->s_type->i_mutex_key#17){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:774 [inline]
 #1: ffff8880397d0150 (&sb->s_type->i_mutex_key#17){+.+.}-{3:3}, at: fuse_open_common+0x366/0x4c0 fs/fuse/file.c:241

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

NMI backtrace for cpu 1
CPU: 1 PID: 1584 Comm: khungtaskd Not tainted 5.14.0-rc5-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:105
 nmi_cpu_backtrace.cold+0x44/0xd7 lib/nmi_backtrace.c:105
 nmi_trigger_cpumask_backtrace+0x1b3/0x230 lib/nmi_backtrace.c:62
 trigger_all_cpu_backtrace include/linux/nmi.h:146 [inline]
 check_hung_uninterruptible_tasks kernel/hung_task.c:210 [inline]
 watchdog+0xd0a/0xfc0 kernel/hung_task.c:295
 kthread+0x3e5/0x4d0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
Sending NMI from CPU 1 to CPUs 0:
NMI backtrace for cpu 0 skipped: idling at native_safe_halt arch/x86/include/asm/irqflags.h:51 [inline]
NMI backtrace for cpu 0 skipped: idling at arch_safe_halt arch/x86/include/asm/irqflags.h:89 [inline]
NMI backtrace for cpu 0 skipped: idling at acpi_safe_halt drivers/acpi/processor_idle.c:109 [inline]
NMI backtrace for cpu 0 skipped: idling at acpi_idle_do_entry+0x1c6/0x250 drivers/acpi/processor_idle.c:553


---
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.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

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

* Re: [syzbot] INFO: task hung in fuse_launder_page
  2021-08-13 13:16 [syzbot] INFO: task hung in fuse_launder_page syzbot
@ 2021-08-17 14:41 ` Miklos Szeredi
  2021-08-17 16:21   ` syzbot
  0 siblings, 1 reply; 3+ messages in thread
From: Miklos Szeredi @ 2021-08-17 14:41 UTC (permalink / raw)
  To: syzbot; +Cc: linux-fsdevel, linux-kernel, syzkaller-bugs

[-- Attachment #1: Type: text/plain, Size: 2816 bytes --]

On Fri, 13 Aug 2021 at 15:16, syzbot
<syzbot+bea44a5189836d956894@syzkaller.appspotmail.com> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit:    36a21d51725a Linux 5.14-rc5
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=104b8eaa300000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=e3a20bae04b96ccd
> dashboard link: https://syzkaller.appspot.com/bug?extid=bea44a5189836d956894
> compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.1
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=143c0ee9300000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=158fc9aa300000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+bea44a5189836d956894@syzkaller.appspotmail.com
>
> INFO: task syz-executor276:8433 blocked for more than 143 seconds.
>       Not tainted 5.14.0-rc5-syzkaller #0
> "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> task:syz-executor276 state:D stack:27736 pid: 8433 ppid:  8430 flags:0x00004004
> Call Trace:
>  context_switch kernel/sched/core.c:4681 [inline]
>  __schedule+0x93a/0x26f0 kernel/sched/core.c:5938
>  schedule+0xd3/0x270 kernel/sched/core.c:6017
>  fuse_wait_on_page_writeback fs/fuse/file.c:452 [inline]
>  fuse_wait_on_page_writeback+0x120/0x170 fs/fuse/file.c:448
>  fuse_launder_page fs/fuse/file.c:2316 [inline]
>  fuse_launder_page+0xe9/0x130 fs/fuse/file.c:2306
>  do_launder_page mm/truncate.c:595 [inline]
>  invalidate_inode_pages2_range+0x994/0xf80 mm/truncate.c:661
>  fuse_finish_open+0x2d9/0x560 fs/fuse/file.c:202
>  fuse_open_common+0x2f9/0x4c0 fs/fuse/file.c:254
>  do_dentry_open+0x4c8/0x11d0 fs/open.c:826
>  do_open fs/namei.c:3374 [inline]
>  path_openat+0x1c23/0x27f0 fs/namei.c:3507
>  do_filp_open+0x1aa/0x400 fs/namei.c:3534
>  do_sys_openat2+0x16d/0x420 fs/open.c:1204
>  do_sys_open fs/open.c:1220 [inline]
>  __do_sys_creat fs/open.c:1294 [inline]
>  __se_sys_creat fs/open.c:1288 [inline]
>  __x64_sys_creat+0xc9/0x120 fs/open.c:1288
>  do_syscall_x64 arch/x86/entry/common.c:50 [inline]
>  do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
>  entry_SYSCALL_64_after_hwframe+0x44/0xae
> RIP: 0033:0x446409
> RSP: 002b:00007f0e6a9f92f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000055
> RAX: ffffffffffffffda RBX: 00000000004d34f0 RCX: 0000000000446409
> RDX: 0000000000446409 RSI: 0000000000000000 RDI: 0000000020000280
> RBP: 00000000004a3164 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000246 R12: 0030656c69662f2e
> R13: 000000000049f158 R14: 00000000004a1160 R15: 00000000004d34f8

Attached patch should fix this.

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

[-- Attachment #2: fuse-truncate-pagecache-on-atomic_o_trunc.patch --]
[-- Type: text/x-patch, Size: 1130 bytes --]

---
 fs/fuse/file.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -198,12 +198,11 @@ void fuse_finish_open(struct inode *inod
 	struct fuse_file *ff = file->private_data;
 	struct fuse_conn *fc = get_fuse_conn(inode);
 
-	if (!(ff->open_flags & FOPEN_KEEP_CACHE))
-		invalidate_inode_pages2(inode->i_mapping);
 	if (ff->open_flags & FOPEN_STREAM)
 		stream_open(inode, file);
 	else if (ff->open_flags & FOPEN_NONSEEKABLE)
 		nonseekable_open(inode, file);
+
 	if (fc->atomic_o_trunc && (file->f_flags & O_TRUNC)) {
 		struct fuse_inode *fi = get_fuse_inode(inode);
 
@@ -211,10 +210,14 @@ void fuse_finish_open(struct inode *inod
 		fi->attr_version = atomic64_inc_return(&fc->attr_version);
 		i_size_write(inode, 0);
 		spin_unlock(&fi->lock);
+		truncate_pagecache(inode, 0);
 		fuse_invalidate_attr(inode);
 		if (fc->writeback_cache)
 			file_update_time(file);
+	} else if (!(ff->open_flags & FOPEN_KEEP_CACHE)) {
+		invalidate_inode_pages2(inode->i_mapping);
 	}
+
 	if ((file->f_mode & FMODE_WRITE) && fc->writeback_cache)
 		fuse_link_write_file(file);
 }

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

* Re: [syzbot] INFO: task hung in fuse_launder_page
  2021-08-17 14:41 ` Miklos Szeredi
@ 2021-08-17 16:21   ` syzbot
  0 siblings, 0 replies; 3+ messages in thread
From: syzbot @ 2021-08-17 16:21 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel, miklos, syzkaller-bugs

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+bea44a5189836d956894@syzkaller.appspotmail.com

Tested on:

commit:         794c7931 Merge branch 'linus' of git://git.kernel.org/..
git tree:       upstream
kernel config:  https://syzkaller.appspot.com/x/.config?x=96f0602203250753
dashboard link: https://syzkaller.appspot.com/bug?extid=bea44a5189836d956894
compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.1
patch:          https://syzkaller.appspot.com/x/patch.diff?x=169e4131300000

Note: testing is done by a robot and is best-effort only.

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

end of thread, other threads:[~2021-08-17 16:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-13 13:16 [syzbot] INFO: task hung in fuse_launder_page syzbot
2021-08-17 14:41 ` Miklos Szeredi
2021-08-17 16:21   ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).