From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+a43d4f48b8397d0e41a9@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [ext4?] INFO: task hung in ext4_quota_write
Date: Sat, 6 Jan 2024 10:48:07 +0800 [thread overview]
Message-ID: <20240106024807.3011-1-hdanton@sina.com> (raw)
In-Reply-To: <000000000000c8a56a060de13553@google.com>
On Mon, 01 Jan 2024 04:06:21 -0800
> HEAD commit: f5837722ffec Merge tag 'mm-hotfixes-stable-2023-12-27-15-0..
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13177855e80000
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
--- x/include/linux/sched.h
+++ y/include/linux/sched.h
@@ -1544,6 +1544,7 @@ struct task_struct {
struct user_event_mm *user_event_mm;
#endif
+ unsigned long bfl;
/*
* New fields for task_struct should be added above here, so that
* they are included in the randomized portion of task_struct.
--- x/include/linux/buffer_head.h
+++ y/include/linux/buffer_head.h
@@ -78,6 +78,7 @@ struct buffer_head {
spinlock_t b_uptodate_lock; /* Used by the first bh in a page, to
* serialise IO completion of other
* buffers in the page */
+ struct task_struct *lko;
};
/*
@@ -402,6 +403,9 @@ static inline void lock_buffer(struct bu
might_sleep();
if (!trylock_buffer(bh))
__lock_buffer(bh);
+ bh->lko = current;
+ get_task_struct(bh->lko);
+ bh->lko->bfl = (unsigned long) bh;
}
static inline void bh_readahead(struct buffer_head *bh, blk_opf_t op_flags)
--- x/fs/ext4/super.c
+++ y/fs/ext4/super.c
@@ -7248,6 +7248,7 @@ static ssize_t ext4_quota_write(struct s
brelse(bh);
return err;
}
+ BUG_ON(current->bfl == (unsigned long) bh);
lock_buffer(bh);
memcpy(bh->b_data+offset, data, len);
flush_dcache_page(bh->b_page);
--- x/fs/buffer.c
+++ y/fs/buffer.c
@@ -77,6 +77,11 @@ void unlock_buffer(struct buffer_head *b
clear_bit_unlock(BH_Lock, &bh->b_state);
smp_mb__after_atomic();
wake_up_bit(&bh->b_state, BH_Lock);
+ if (!bh->lko)
+ return;
+ bh->lko->bfl = 0;
+ put_task_struct(bh->lko);
+ bh->lko = NULL;
}
EXPORT_SYMBOL(unlock_buffer);
--
next prev parent reply other threads:[~2024-01-06 2:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-01 12:06 [syzbot] [ext4?] INFO: task hung in ext4_quota_write syzbot
2024-01-05 14:23 ` Edward Adam Davis
2024-01-05 14:57 ` syzbot
2024-01-06 2:48 ` Hillf Danton [this message]
2024-01-09 18:17 ` syzbot
2024-01-10 11:12 ` Hillf Danton
2024-01-10 11:40 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240106024807.3011-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+a43d4f48b8397d0e41a9@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox