From: Christoph Hellwig <hch@lst.de>
To: Ilya Dryomov <idryomov@gmail.com>
Cc: Christoph Hellwig <hch@lst.de>, Jan Kara <jack@suse.cz>,
Johannes Thumshirn <johannes.thumshirn@wdc.com>,
Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: always respect QUEUE_FLAG_STABLE_WRITES on the block device
Date: Thu, 4 May 2023 15:55:15 +0200 [thread overview]
Message-ID: <20230504135515.GA17048@lst.de> (raw)
In-Reply-To: <20230504105624.9789-1-idryomov@gmail.com>
On Thu, May 04, 2023 at 12:56:24PM +0200, Ilya Dryomov wrote:
> Commit 1cb039f3dc16 ("bdi: replace BDI_CAP_STABLE_WRITES with a queue
> and a sb flag") introduced a regression for the raw block device use
> case. Capturing QUEUE_FLAG_STABLE_WRITES flag in set_bdev_super() has
> the effect of respecting it only when there is a filesystem mounted on
> top of the block device. If a filesystem is not mounted, block devices
> that do integrity checking return sporadic checksum errors.
With "If a file system is not mounted" you want to say "when accessing
a block device directly" here, right? The two are not exclusive..
> Additionally, this commit made the corresponding sysfs knob writeable
> for debugging purposes. However, because QUEUE_FLAG_STABLE_WRITES flag
> is captured when the filesystem is mounted and isn't consulted after
> that anywhere outside of swap code, changing it doesn't take immediate
> effect even though dumping the knob shows the new value. With no way
> to dump SB_I_STABLE_WRITES flag, this is needlessly confusing.
But very much intentional. s_bdev often is not the only device
in a file system, and we should never reference if from core
helpers.
So I think we should go with something like this:
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index db794399900734..aa36cc2a4530c1 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -3129,7 +3129,11 @@ EXPORT_SYMBOL_GPL(folio_wait_writeback_killable);
*/
void folio_wait_stable(struct folio *folio)
{
- if (folio_inode(folio)->i_sb->s_iflags & SB_I_STABLE_WRITES)
+ struct inode *inode = folio_inode(folio);
+ struct super_block *sb = inode->i_sb;
+
+ if ((sb->s_iflags & SB_I_STABLE_WRITES) ||
+ (sb_is_blkdev_sb(sb) && bdev_stable_writes(I_BDEV(inode))))
folio_wait_writeback(folio);
}
EXPORT_SYMBOL_GPL(folio_wait_stable);
next prev parent reply other threads:[~2023-05-04 13:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-04 10:56 Ilya Dryomov
2023-05-04 13:55 ` Christoph Hellwig [this message]
2023-05-04 14:16 ` Matthew Wilcox
2023-05-04 15:07 ` Ilya Dryomov
2023-05-04 15:37 ` Matthew Wilcox
2023-05-04 15:55 ` Jan Kara
2023-05-04 16:16 ` Matthew Wilcox
2023-05-04 23:07 ` Dave Chinner
2023-05-05 10:49 ` Jan Kara
2023-05-04 15:03 ` Ilya Dryomov
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=20230504135515.GA17048@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=idryomov@gmail.com \
--cc=jack@suse.cz \
--cc=johannes.thumshirn@wdc.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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