lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJnrk1Z3xD-rOoB8T9=AFjVXx30FRoPv_qECEEBPisz1XSRt8Q@mail.gmail.com>
Date: Wed, 27 Aug 2025 12:01:45 -0700
From: Joanne Koong <joannelkoong@...il.com>
To: Marek Szyprowski <m.szyprowski@...sung.com>
Cc: linux-fsdevel@...r.kernel.org, linux-mm@...ck.org, 
	linux-kernel@...r.kernel.org, "Matthew Wilcox (Oracle)" <willy@...radead.org>, 
	Andrew Morton <akpm@...ux-foundation.org>, David Hildenbrand <david@...hat.com>, 
	Miklos Szeredi <mszeredi@...hat.com>
Subject: Re: [PATCH] mm: fix lockdep issues in writeback handling

On Tue, Aug 26, 2025 at 6:12 AM Marek Szyprowski
<m.szyprowski@...sung.com> wrote:
>
> Commit 167f21a81a9c ("mm: remove BDI_CAP_WRITEBACK_ACCT") removed
> BDI_CAP_WRITEBACK_ACCT flag and refactored code that depend on it.
> Unfortunately it also moved some variable intialization out of guarded
> scope in writeback handling, what triggers a true lockdep warning. Fix
> this by moving initialization to the proper place.
>
> Fixes: 167f21a81a9c ("mm: remove BDI_CAP_WRITEBACK_ACCT")
> Signed-off-by: Marek Szyprowski <m.szyprowski@...sung.com>

This LGTM. It reverts the initialization back to the lines where it
was originally initialized.

Sorry for missing this, I had assumed inode_to_wb() was just a
straightforward inode->i_wb pointer following and hadn't bothered to
look. I'll be more careful next time.

Reviewed-by: Joanne Koong <joannelkoong@...il.com>
> ---
>  mm/page-writeback.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> index 99e80bdb3084..3887ac2e6475 100644
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -2984,7 +2984,7 @@ bool __folio_end_writeback(struct folio *folio)
>
>         if (mapping && mapping_use_writeback_tags(mapping)) {
>                 struct inode *inode = mapping->host;
> -               struct bdi_writeback *wb = inode_to_wb(inode);
> +               struct bdi_writeback *wb;
>                 unsigned long flags;
>
>                 xa_lock_irqsave(&mapping->i_pages, flags);
> @@ -2992,6 +2992,7 @@ bool __folio_end_writeback(struct folio *folio)
>                 __xa_clear_mark(&mapping->i_pages, folio_index(folio),
>                                         PAGECACHE_TAG_WRITEBACK);
>
> +               wb = inode_to_wb(inode);
>                 wb_stat_mod(wb, WB_WRITEBACK, -nr);
>                 __wb_writeout_add(wb, nr);
>                 if (!mapping_tagged(mapping, PAGECACHE_TAG_WRITEBACK)) {
> @@ -3024,7 +3025,7 @@ void __folio_start_writeback(struct folio *folio, bool keep_write)
>         if (mapping && mapping_use_writeback_tags(mapping)) {
>                 XA_STATE(xas, &mapping->i_pages, folio_index(folio));
>                 struct inode *inode = mapping->host;
> -               struct bdi_writeback *wb = inode_to_wb(inode);
> +               struct bdi_writeback *wb;
>                 unsigned long flags;
>                 bool on_wblist;
>
> @@ -3035,6 +3036,7 @@ void __folio_start_writeback(struct folio *folio, bool keep_write)
>                 on_wblist = mapping_tagged(mapping, PAGECACHE_TAG_WRITEBACK);
>
>                 xas_set_mark(&xas, PAGECACHE_TAG_WRITEBACK);
> +               wb = inode_to_wb(inode);
>                 wb_stat_mod(wb, WB_WRITEBACK, nr);
>                 if (!on_wblist) {
>                         wb_inode_writeback_start(wb);
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ