From: Matthew Wilcox <willy@infradead.org>
To: Purva Yeshi <purvayeshi550@gmail.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
syzbot+219127d0a3bce650e1b6@syzkaller.appspotmail.com
Subject: Re: [PATCH] fs: Fix jfs_fsync() Sleeping in Invalid Context
Date: Tue, 25 Mar 2025 18:16:01 +0000 [thread overview]
Message-ID: <Z-Ly4WmAaN7aev3R@casper.infradead.org> (raw)
In-Reply-To: <20250325173336.8225-1-purvayeshi550@gmail.com>
On Tue, Mar 25, 2025 at 11:03:36PM +0530, Purva Yeshi wrote:
> +++ b/fs/direct-io.c
> @@ -356,13 +356,9 @@ static void dio_bio_end_aio(struct bio *bio)
> defer_completion = dio->defer_completion ||
> (dio_op == REQ_OP_WRITE &&
> dio->inode->i_mapping->nrpages);
> - if (defer_completion) {
> - INIT_WORK(&dio->complete_work, dio_aio_complete_work);
> - queue_work(dio->inode->i_sb->s_dio_done_wq,
> - &dio->complete_work);
> - } else {
> - dio_complete(dio, 0, DIO_COMPLETE_ASYNC);
> - }
> +
> + INIT_WORK(&dio->complete_work, dio_aio_complete_work);
> + queue_work(dio->inode->i_sb->s_dio_done_wq, &dio->complete_work);
This patch is definitely wrong. If it were the right thing to do, then
since defer_completion is now un-read, we should stop calculating it.
I'm not sure what the right solution is; should we simply do:
defer_completion = dio->defer_completion ||
+ in_atomic() ||
(dio_op == REQ_OP_WRITE &&
dio->inode->i_mapping->nrpages);
I'm kind of surprised this problem hasn't cropped up before now ...
prev parent reply other threads:[~2025-03-25 18:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-25 17:33 [PATCH] fs: Fix jfs_fsync() Sleeping in Invalid Context Purva Yeshi
2025-03-25 18:16 ` Matthew Wilcox [this message]
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=Z-Ly4WmAaN7aev3R@casper.infradead.org \
--to=willy@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=purvayeshi550@gmail.com \
--cc=syzbot+219127d0a3bce650e1b6@syzkaller.appspotmail.com \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).