public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] f2fs: fix panic issue in small capacity device
@ 2024-01-29 10:21 Zhiguo Niu
  2024-02-06  3:15 ` Jaegeuk Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Zhiguo Niu @ 2024-01-29 10:21 UTC (permalink / raw)
  To: jaegeuk, chao
  Cc: linux-f2fs-devel, linux-kernel, niuzhiguo84, zhiguo.niu, ke.wang,
	hongyu.jin

A panic issue happened in a reboot test in small capacity device
as following:
1.The device size is 64MB, and main area has 24 segments, and
CONFIG_F2FS_CHECK_FS is not enabled.
2.There is no any free segments left shown in free_segmap_info,
then another write request cause get_new_segment get a out-of-bound
segment with segno 24.
3.panic happen in update_sit_entry because access invalid bitmap
pointer.

More detail shown in following three patches.
The three patches are splited here because the modifications are
relatively independent and more readable.

Zhiguo Niu (3):
  f2fs: correct counting methods of free_segments in __set_inuse
  f2fs: fix panic issue in update_sit_entry
  f2fs: enhance judgment conditions of GET_SEGNO

 fs/f2fs/file.c    | 7 ++++++-
 fs/f2fs/segment.c | 9 ++++++---
 fs/f2fs/segment.h | 7 ++++---
 3 files changed, 16 insertions(+), 7 deletions(-)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/3] f2fs: fix panic issue in small capacity device
  2024-01-29 10:21 [PATCH 0/3] f2fs: fix panic issue in small capacity device Zhiguo Niu
@ 2024-02-06  3:15 ` Jaegeuk Kim
  2024-02-06  5:58   ` Zhiguo Niu
  0 siblings, 1 reply; 3+ messages in thread
From: Jaegeuk Kim @ 2024-02-06  3:15 UTC (permalink / raw)
  To: Zhiguo Niu
  Cc: chao, linux-f2fs-devel, linux-kernel, niuzhiguo84, ke.wang,
	hongyu.jin

On 01/29, Zhiguo Niu wrote:
> A panic issue happened in a reboot test in small capacity device
> as following:
> 1.The device size is 64MB, and main area has 24 segments, and
> CONFIG_F2FS_CHECK_FS is not enabled.
> 2.There is no any free segments left shown in free_segmap_info,
> then another write request cause get_new_segment get a out-of-bound
> segment with segno 24.
> 3.panic happen in update_sit_entry because access invalid bitmap
> pointer.

The goal here is to stop f2fs when it hits no space to write anymore?
And, we need f2fs_stop_checkpoint() at the end?

> 
> More detail shown in following three patches.
> The three patches are splited here because the modifications are
> relatively independent and more readable.
> 
> Zhiguo Niu (3):
>   f2fs: correct counting methods of free_segments in __set_inuse
>   f2fs: fix panic issue in update_sit_entry
>   f2fs: enhance judgment conditions of GET_SEGNO
> 
>  fs/f2fs/file.c    | 7 ++++++-
>  fs/f2fs/segment.c | 9 ++++++---
>  fs/f2fs/segment.h | 7 ++++---
>  3 files changed, 16 insertions(+), 7 deletions(-)
> 
> -- 
> 1.9.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/3] f2fs: fix panic issue in small capacity device
  2024-02-06  3:15 ` Jaegeuk Kim
@ 2024-02-06  5:58   ` Zhiguo Niu
  0 siblings, 0 replies; 3+ messages in thread
From: Zhiguo Niu @ 2024-02-06  5:58 UTC (permalink / raw)
  To: Jaegeuk Kim
  Cc: Zhiguo Niu, chao, linux-f2fs-devel, linux-kernel, ke.wang,
	hongyu.jin

On Tue, Feb 6, 2024 at 11:15 AM Jaegeuk Kim <jaegeuk@kernel.org> wrote:
>
> On 01/29, Zhiguo Niu wrote:
> > A panic issue happened in a reboot test in small capacity device
> > as following:
> > 1.The device size is 64MB, and main area has 24 segments, and
> > CONFIG_F2FS_CHECK_FS is not enabled.
> > 2.There is no any free segments left shown in free_segmap_info,
> > then another write request cause get_new_segment get a out-of-bound
> > segment with segno 24.
> > 3.panic happen in update_sit_entry because access invalid bitmap
> > pointer.
>
> The goal here is to stop f2fs when it hits no space to write anymore?
Do not let the system crash now , and add some sanity check to avoid
accessing  illegal memory
> And, we need f2fs_stop_checkpoint() at the end?
I think it need indeed.
thanks!
>
> >
> > More detail shown in following three patches.
> > The three patches are splited here because the modifications are
> > relatively independent and more readable.
> >
> > Zhiguo Niu (3):
> >   f2fs: correct counting methods of free_segments in __set_inuse
> >   f2fs: fix panic issue in update_sit_entry
> >   f2fs: enhance judgment conditions of GET_SEGNO
> >
> >  fs/f2fs/file.c    | 7 ++++++-
> >  fs/f2fs/segment.c | 9 ++++++---
> >  fs/f2fs/segment.h | 7 ++++---
> >  3 files changed, 16 insertions(+), 7 deletions(-)
> >
> > --
> > 1.9.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-06  5:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-29 10:21 [PATCH 0/3] f2fs: fix panic issue in small capacity device Zhiguo Niu
2024-02-06  3:15 ` Jaegeuk Kim
2024-02-06  5:58   ` Zhiguo Niu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox