diff mbox series

[f2fs-dev] f2fs: fix using wrong 'submitted' value in f2fs_write_cache_pages

Message ID 20241224114621.1220350-1-zangyangyang1@xiaomi.com (mailing list archive)
State Superseded
Headers show
Series [f2fs-dev] f2fs: fix using wrong 'submitted' value in f2fs_write_cache_pages | expand

Commit Message

zangyangyang1 Dec. 24, 2024, 11:46 a.m. UTC
When f2fs_write_single_data_page fails, f2fs_write_cache_pages
will use the last 'submitted' value incorrectly, which will cause
'nwritten' and 'wbc->nr_to_write' calculation errors

Signed-off-by: zangyangyang1 <zangyangyang1@xiaomi.com>
---
 fs/f2fs/data.c | 1 +
 1 file changed, 1 insertion(+)

--
2.43.2

#/******±¾Óʼþ¼°Æ丽¼þº¬ÓÐСÃ×¹«Ë¾µÄ±£ÃÜÐÅÏ¢£¬½öÏÞÓÚ·¢Ë͸øÉÏÃæµØÖ·ÖÐÁгöµÄ¸öÈË»òȺ×é¡£½ûÖ¹ÈκÎÆäËûÈËÒÔÈκÎÐÎʽʹÓ㨰üÀ¨µ«²»ÏÞÓÚÈ«²¿»ò²¿·ÖµØй¶¡¢¸´ÖÆ¡¢»òÉ¢·¢£©±¾ÓʼþÖеÄÐÅÏ¢¡£Èç¹ûÄú´íÊÕÁ˱¾Óʼþ£¬ÇëÄúÁ¢¼´µç»°»òÓʼþ֪ͨ·¢¼þÈ˲¢É¾³ý±¾Óʼþ£¡ This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!******/#

Comments

Chao Yu Dec. 26, 2024, 1:27 p.m. UTC | #1
On 2024/12/24 19:46, zangyangyang1 via Linux-f2fs-devel wrote:
> When f2fs_write_single_data_page fails, f2fs_write_cache_pages
> will use the last 'submitted' value incorrectly, which will cause
> 'nwritten' and 'wbc->nr_to_write' calculation errors
 > > Signed-off-by: zangyangyang1 <zangyangyang1@xiaomi.com>
> ---
>   fs/f2fs/data.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 94f7b084f601..083acd7f5420 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -3179,6 +3179,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
>                                  continue;
>                          }
>   #endif
> +                       submitted = 0;

How about initializing "submitted" in f2fs_write_single_data_page()
to cover all cases in where we call f2fs_write_single_data_page()?

Thanks,

>                          ret = f2fs_write_single_data_page(folio,
>                                          &submitted, &bio, &last_block,
>                                          wbc, io_type, 0, true);
> --
> 2.43.2
YangYang Zang Dec. 27, 2024, 2:56 a.m. UTC | #2
Chao Yu via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
于2024年12月26日周四 21:32写道:
>
> On 2024/12/24 19:46, zangyangyang1 via Linux-f2fs-devel wrote:
> > When f2fs_write_single_data_page fails, f2fs_write_cache_pages
> > will use the last 'submitted' value incorrectly, which will cause
> > 'nwritten' and 'wbc->nr_to_write' calculation errors
>  > > Signed-off-by: zangyangyang1 <zangyangyang1@xiaomi.com>
> > ---
> >   fs/f2fs/data.c | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > index 94f7b084f601..083acd7f5420 100644
> > --- a/fs/f2fs/data.c
> > +++ b/fs/f2fs/data.c
> > @@ -3179,6 +3179,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
> >                                  continue;
> >                          }
> >   #endif
> > +                       submitted = 0;
>
> How about initializing "submitted" in f2fs_write_single_data_page()
> to cover all cases in where we call f2fs_write_single_data_page()?
Hi, My first change was in f2fs_write_single_data_page(), but that
added two lines of code,
so I put the change in f2fs_write_cache_pages(), but I forgot that
compression also
calls f2fs_write_single_data_page(), I will fix it.
Thanks,
> Thanks,
>
> >                          ret = f2fs_write_single_data_page(folio,
> >                                          &submitted, &bio, &last_block,
> >                                          wbc, io_type, 0, true);
> > --
> > 2.43.2
>
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
diff mbox series

Patch

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 94f7b084f601..083acd7f5420 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -3179,6 +3179,7 @@  static int f2fs_write_cache_pages(struct address_space *mapping,
                                continue;
                        }
 #endif
+                       submitted = 0;
                        ret = f2fs_write_single_data_page(folio,
                                        &submitted, &bio, &last_block,
                                        wbc, io_type, 0, true);