Re: [PATCH] mm: always respect QUEUE_FLAG_STABLE_WRITES on the block device

From: Matthew Wilcox
Date: Thu May 04 2023 - 11:37:16 EST


On Thu, May 04, 2023 at 05:07:10PM +0200, Ilya Dryomov wrote:
> On Thu, May 4, 2023 at 4:16 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
> > I hate both of these patches ;-) What we should do is add
> > AS_STABLE_WRITES, have the appropriate places call
> > mapping_set_stable_writes() and then folio_wait_stable() becomes
> >
> > if (mapping_test_stable_writes(folio->mapping))
> > folio_wait_writeback(folio);
> >
> > and we remove all the dereferences (mapping->host->i_sb->s_iflags, plus
> > whatever else is going on there)
>
> Hi Matthew,
>
> We would still need something resembling Christoph's suggestion for
> 5.10 and 5.15 (at least). Since this fixes a regression, would you
> support merging the "ugly" version to facilitate backports or would
> you rather see the AS/mapping-based refactor first?

That's a terrible way of developing for Linux. First, do it the right
way for mainline. Then, see how easy the patch is to backport to relevant
kernel versions; if it's too ugly to cherry-pick, do something equivalent.
But never start out with the premise "This must be backported, so do it
as simply as possible first".