Linux-f2fs-devel Archive mirror
 help / color / mirror / Atom feed
From: "牛志国 (Zhiguo Niu)" <Zhiguo.Niu@unisoc.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>,
	Dan Carpenter <dan.carpenter@linaro.org>
Cc: "金红宇 (Hongyu Jin)" <hongyu.jin@unisoc.com>,
	"linux-f2fs-devel@lists.sourceforge.net"
	<linux-f2fs-devel@lists.sourceforge.net>
Subject: [f2fs-dev] 答复:  [bug report] f2fs: stop checkpoint when get a out-of-bounds segment
Date: Wed, 28 Feb 2024 01:25:44 +0000	[thread overview]
Message-ID: <488d3814783a49c5a92eee6be2c2550d@BJMBX02.spreadtrum.com> (raw)
In-Reply-To: Zd4d_qPiG-8-l1J2@google.com

Hi Jaegeuk,
I understand what you mean^^, 
please ignore my last email, sorry again:).
Thanks!
-----邮件原件-----
发件人: 牛志国 (Zhiguo Niu) 
发送时间: 2024年2月28日 8:55
收件人: 'Jaegeuk Kim' <jaegeuk@kernel.org>; 'Dan Carpenter' <dan.carpenter@linaro.org>
抄送: 'linux-f2fs-devel@lists.sourceforge.net' <linux-f2fs-devel@lists.sourceforge.net>; 金红宇 (Hongyu Jin) <Hongyu.Jin@unisoc.com>; 'Chao Yu' <chao@kernel.org>
主题: 答复: [f2fs-dev] [bug report] f2fs: stop checkpoint when get a out-of-bounds segment


Hi Jaegeuk,
Chao's patch  fix should can fix this warning:
f2fs: fix to don't call f2fs_stop_checkpoint in spinlock coverage thanks!
-----邮件原件-----
发件人: Jaegeuk Kim <jaegeuk@kernel.org>
发送时间: 2024年2月28日 1:38
收件人: Dan Carpenter <dan.carpenter@linaro.org>
抄送: 牛志国 (Zhiguo Niu) <Zhiguo.Niu@unisoc.com>; linux-f2fs-devel@lists.sourceforge.net
主题: Re: [f2fs-dev] [bug report] f2fs: stop checkpoint when get a out-of-bounds segment


注意: 这封邮件来自于外部。除非你确定邮件内容安全,否则不要点击任何链接和附件。
CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.



Hi,

I merged two patches, which addresses this.

f2fs: stop checkpoint when get a out-of-bounds segment
f2fs: fix to don't call f2fs_stop_checkpoint in spinlock coverage

On 02/27, Dan Carpenter wrote:
> Hello Zhiguo Niu,
>
> The patch 7a0392932f97: "f2fs: stop checkpoint when get a 
> out-of-bounds segment" from Feb 20, 2024 (linux-next), leads to the 
> following Smatch static checker warning:
>
>       fs/f2fs/checkpoint.c:34 f2fs_stop_checkpoint()
>       warn: sleeping in atomic context
>
> fs/f2fs/segment.c
>   2650  static void get_new_segment(struct f2fs_sb_info *sbi,
>   2651                          unsigned int *newseg, bool new_sec, bool pinning)
>   2652  {
>   2653          struct free_segmap_info *free_i = FREE_I(sbi);
>   2654          unsigned int segno, secno, zoneno;
>   2655          unsigned int total_zones = MAIN_SECS(sbi) / sbi->secs_per_zone;
>   2656          unsigned int hint = GET_SEC_FROM_SEG(sbi, *newseg);
>   2657          unsigned int old_zoneno = GET_ZONE_FROM_SEG(sbi, *newseg);
>   2658          bool init = true;
>   2659          int i;
>   2660
>   2661          spin_lock(&free_i->segmap_lock);
>                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ preempt disabled here
>
>   2662
>   2663          if (!new_sec && ((*newseg + 1) % SEGS_PER_SEC(sbi))) {
>   2664                  segno = find_next_zero_bit(free_i->free_segmap,
>   2665                          GET_SEG_FROM_SEC(sbi, hint + 1), *newseg + 1);
>   2666                  if (segno < GET_SEG_FROM_SEC(sbi, hint + 1))
>   2667                          goto got_it;
>   2668          }
>   2669
>   2670          /*
>   2671           * If we format f2fs on zoned storage, let's try to get pinned sections
>   2672           * from beginning of the storage, which should be a conventional one.
>   2673           */
>   2674          if (f2fs_sb_has_blkzoned(sbi)) {
>   2675                  segno = pinning ? 0 : max(first_zoned_segno(sbi), *newseg);
>   2676                  hint = GET_SEC_FROM_SEG(sbi, segno);
>   2677          }
>   2678
>   2679  find_other_zone:
>   2680          secno = find_next_zero_bit(free_i->free_secmap, MAIN_SECS(sbi), hint);
>   2681          if (secno >= MAIN_SECS(sbi)) {
>   2682                  secno = find_first_zero_bit(free_i->free_secmap,
>   2683                                                          MAIN_SECS(sbi));
>   2684                  if (secno >= MAIN_SECS(sbi)) {
>   2685                          f2fs_stop_checkpoint(sbi, false,
>                                                           ^^^^^ This 
> false means we sleep while holding a spin lock.
>
>   2686                                  STOP_CP_REASON_NO_SEGMENT);
>   2687                          f2fs_bug_on(sbi, 1);
>   2688                  }
>   2689          }
>   2690          segno = GET_SEG_FROM_SEC(sbi, secno);
>   2691          zoneno = GET_ZONE_FROM_SEC(sbi, secno);
>
> fs/f2fs/checkpoint.c
>     29 void f2fs_stop_checkpoint(struct f2fs_sb_info *sbi, bool end_io,
>     30                                                 unsigned char reason)
>     31 {
>     32         f2fs_build_fault_attr(sbi, 0, 0);
>     33         if (!end_io)
> --> 34                 f2fs_flush_merged_writes(sbi);
>     35         f2fs_handle_critical_error(sbi, reason, end_io);
>     36 }
>
> regards,
> dan carpenter
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

      parent reply	other threads:[~2024-02-28  1:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 15:21 [f2fs-dev] [bug report] f2fs: stop checkpoint when get a out-of-bounds segment Dan Carpenter
2024-02-27 17:38 ` Jaegeuk Kim
2024-02-28  0:55   ` [f2fs-dev] 答复: " 牛志国 (Zhiguo Niu)
2024-02-28  1:25   ` 牛志国 (Zhiguo Niu) [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=488d3814783a49c5a92eee6be2c2550d@BJMBX02.spreadtrum.com \
    --to=zhiguo.niu@unisoc.com \
    --cc=dan.carpenter@linaro.org \
    --cc=hongyu.jin@unisoc.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).