Message ID | 1707271264-5551-1-git-send-email-zhiguo.niu@unisoc.com |
---|---|
Headers |
Return-Path: <linux-kernel+bounces-55827-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1958986dyb; Tue, 6 Feb 2024 18:38:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvTtvK9B4jN/4EtlBPbj9QFXOJTzX0iVBp1u5aCwNHsKf2iKegF2vUu7vGyh2bv+krfyt2 X-Received: by 2002:a05:6a00:2294:b0:6e0:465e:cdd5 with SMTP id f20-20020a056a00229400b006e0465ecdd5mr2119803pfe.23.1707273538775; Tue, 06 Feb 2024 18:38:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707273538; cv=pass; d=google.com; s=arc-20160816; b=EW226gi68V8CGcHUOJBdqm18lONideoAeS1UQBztINA+C7kWOhjxkYcRoz55KX6jOE FAFcJWvRyEWnckbRjk63A3HfjPT6/JhBQ4mXsSIzA/5+aV13pN8ur85Y6bsjDfpTwR5D 8WyBn2skb5i+qGd1K+W5cRqQAki32p+AGx8RUoqzO7OolgmyiAx43MKuRQ6qxZT28Ghl mwnG4JbXru8Z3YP7+hp+cXEAMugX9lgUyXpLIVONOz72YTYv3C2Iel3ar2dLKESA72YA Of9IJRS5o93fCABAIVa1haQZi+VKyiZ5f9PePDPabeKoLAQz1xLUjC8l0KP9VFstkoAu iCOw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:subject:cc:to:from; bh=BVsEEWLQGZX07FZQldrpv0fblveMaQMwFSNSeOK+Uvg=; fh=Iwa67v612qPP2R9iYn/BiB3s0UG+GkcELYmg3L8gSt4=; b=qzMfEP/R211geF806q/rUS+2fqVicIJuSmAttTfdTGmQmhP1veStunXd4OZuJa2D3o tzFWZp05Du5cqjC6kPrDhiAOI57UJ+aSg1gHFKt0756gDa2ptWe2uAf2HUrJZCPbFz+o tUAf1E8mleOvn0YDIBC9DF/QQcjLarc0p2LmSM+AMs6MDFLxS8JciScugSBskfvmFON9 B96pe1JygwqDnxYZAENE5LXLPIMWKoANrC//T83XU3lMqaazGF9JFyJVUc/tGa47YUOf IlbBm5Wv6Vgu22CZe7CruwrheOIDKOpMmktlrI6EPkhrfo+dVaowgK+/TDFne5H560pT gGIw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=unisoc.com); spf=pass (google.com: domain of linux-kernel+bounces-55827-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55827-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCVwIIOjZhS5iV3pDzW1OgOrvksWckqbudn6MmkKrep8JeHD4brCkHUOM5iFYIjoxwCbkGj5/LWCTrEAUaNBXgudN4zm2w== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id x19-20020aa784d3000000b006d9a95b62d8si387615pfn.277.2024.02.06.18.38.58 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 18:38:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55827-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=unisoc.com); spf=pass (google.com: domain of linux-kernel+bounces-55827-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55827-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id AC5ACB29F05 for <ouuuleilei@gmail.com>; Wed, 7 Feb 2024 02:02:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C0E87F9C3; Wed, 7 Feb 2024 02:02:08 +0000 (UTC) Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC3DDDDB3 for <linux-kernel@vger.kernel.org>; Wed, 7 Feb 2024 02:02:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=222.66.158.135 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707271327; cv=none; b=HJuCjuYuMDABPUc2GVzTpMZ0vqsaI4PDqqW7X+LBIFuIbV8s5iwOWCs3l/iOdOy9Wt2KjGMsKU+05DU9g7YlxpiGSA3EX0wnUDxpsgt9Q+J2Mj8JwdLpJJZHzEezfyyByomypwu+JNXPauZUAVYOGd2UxR58VvgD7Zrgfjy3pGI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707271327; c=relaxed/simple; bh=dqkBJAgvOf54M17NAgC2bdZdD8Q1alVaZw9A7jwQE4Y=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=bSpliixB2MA72MADrhBhktGSaFWbM8Z9VCeFNmQJ/MhZ0/KXtWUZpW1dYbcwyhkZJRdOtjk09ia06+3aISy4A7F6biam4fMdjza4esa93B23yGMAz6wu24dpD1uegEF+fLYx9wZeO4w806763bgnFhv+oTvkLJfxIBDmxyGfHp8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com; spf=pass smtp.mailfrom=unisoc.com; arc=none smtp.client-ip=222.66.158.135 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=unisoc.com Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 41721Nq0075264; Wed, 7 Feb 2024 10:01:23 +0800 (+08) (envelope-from Zhiguo.Niu@unisoc.com) Received: from SHDLP.spreadtrum.com (bjmbx02.spreadtrum.com [10.0.64.8]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4TV3Hv3prTz2K4cJ2; Wed, 7 Feb 2024 10:01:15 +0800 (CST) Received: from bj08434pcu.spreadtrum.com (10.0.73.87) by BJMBX02.spreadtrum.com (10.0.64.8) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Wed, 7 Feb 2024 10:01:20 +0800 From: Zhiguo Niu <zhiguo.niu@unisoc.com> To: <jaegeuk@kernel.org>, <chao@kernel.org> CC: <linux-f2fs-devel@lists.sourceforge.net>, <linux-kernel@vger.kernel.org>, <niuzhiguo84@gmail.com>, <zhiguo.niu@unisoc.com>, <ke.wang@unisoc.com>, <hongyu.jin@unisoc.com> Subject: [PATCH v2 0/4] f2fs: fix panic issue in small capacity device Date: Wed, 7 Feb 2024 10:01:00 +0800 Message-ID: <1707271264-5551-1-git-send-email-zhiguo.niu@unisoc.com> X-Mailer: git-send-email 1.9.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX02.spreadtrum.com (10.0.64.8) X-MAIL: SHSQR01.spreadtrum.com 41721Nq0075264 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790206058051863444 X-GMAIL-MSGID: 1790206058051863444 |
Series |
f2fs: fix panic issue in small capacity device
|
|
Message
Zhiguo Niu
Feb. 7, 2024, 2:01 a.m. UTC
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 patch sets. The three patches are splited here because the modifications are relatively independent and more readable. --- Changes of v2: stop checkpoint when get a out-of-bound segment --- Zhiguo Niu (4): 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 f2fs: stop checkpoint when get a out-of-bounds segment fs/f2fs/file.c | 7 ++++++- fs/f2fs/segment.c | 21 ++++++++++++++++----- fs/f2fs/segment.h | 7 ++++--- include/linux/f2fs_fs.h | 1 + 4 files changed, 27 insertions(+), 9 deletions(-)
Comments
On 02/07, Zhiguo Niu wrote: > There is low probability that an out-of-bounds segment will be got > on a small-capacity device. In order to prevent subsequent write requests > allocating block address from this invalid segment, which may cause > unexpected issue, stop checkpoint should be performed. > > Also introduce a new stop cp reason: STOP_CP_REASON_OUTOF_RAGNE. OUT_OF_RANGE? > > Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com> > --- > fs/f2fs/segment.c | 12 ++++++++++-- > include/linux/f2fs_fs.h | 1 + > 2 files changed, 11 insertions(+), 2 deletions(-) > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > index 6772ad4..6fe2baf 100644 > --- a/fs/f2fs/segment.c > +++ b/fs/f2fs/segment.c > @@ -2666,7 +2666,11 @@ static void get_new_segment(struct f2fs_sb_info *sbi, > if (dir == ALLOC_RIGHT) { > secno = find_first_zero_bit(free_i->free_secmap, > MAIN_SECS(sbi)); > - f2fs_bug_on(sbi, secno >= MAIN_SECS(sbi)); > + if (secno >= MAIN_SECS(sbi)) { > + f2fs_stop_checkpoint(sbi, false, > + STOP_CP_REASON_OUTOF_RAGNE); > + f2fs_bug_on(sbi, 1); > + } > } else { > go_left = 1; > left_start = hint - 1; > @@ -2682,7 +2686,11 @@ static void get_new_segment(struct f2fs_sb_info *sbi, > } > left_start = find_first_zero_bit(free_i->free_secmap, > MAIN_SECS(sbi)); > - f2fs_bug_on(sbi, left_start >= MAIN_SECS(sbi)); > + if (left_start >= MAIN_SECS(sbi)) { > + f2fs_stop_checkpoint(sbi, false, > + STOP_CP_REASON_OUTOF_RAGNE); > + f2fs_bug_on(sbi, 1); > + } > break; > } > secno = left_start; > diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h > index 053137a0..72c6782 100644 > --- a/include/linux/f2fs_fs.h > +++ b/include/linux/f2fs_fs.h > @@ -81,6 +81,7 @@ enum stop_cp_reason { > STOP_CP_REASON_CORRUPTED_SUMMARY, > STOP_CP_REASON_UPDATE_INODE, > STOP_CP_REASON_FLUSH_FAIL, > + STOP_CP_REASON_OUTOF_RAGNE, > STOP_CP_REASON_MAX, > }; > > -- > 1.9.1
On 2024/2/8 8:16, Jaegeuk Kim wrote: > On 02/07, Zhiguo Niu wrote: >> There is low probability that an out-of-bounds segment will be got >> on a small-capacity device. In order to prevent subsequent write requests >> allocating block address from this invalid segment, which may cause >> unexpected issue, stop checkpoint should be performed. >> >> Also introduce a new stop cp reason: STOP_CP_REASON_OUTOF_RAGNE. > > OUT_OF_RANGE? Maybe STOP_CP_REASON_NO_SEGMENT will be more explicit? Thanks, > >> >> Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com> >> --- >> fs/f2fs/segment.c | 12 ++++++++++-- >> include/linux/f2fs_fs.h | 1 + >> 2 files changed, 11 insertions(+), 2 deletions(-) >> >> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c >> index 6772ad4..6fe2baf 100644 >> --- a/fs/f2fs/segment.c >> +++ b/fs/f2fs/segment.c >> @@ -2666,7 +2666,11 @@ static void get_new_segment(struct f2fs_sb_info *sbi, >> if (dir == ALLOC_RIGHT) { >> secno = find_first_zero_bit(free_i->free_secmap, >> MAIN_SECS(sbi)); >> - f2fs_bug_on(sbi, secno >= MAIN_SECS(sbi)); >> + if (secno >= MAIN_SECS(sbi)) { >> + f2fs_stop_checkpoint(sbi, false, >> + STOP_CP_REASON_OUTOF_RAGNE); >> + f2fs_bug_on(sbi, 1); >> + } >> } else { >> go_left = 1; >> left_start = hint - 1; >> @@ -2682,7 +2686,11 @@ static void get_new_segment(struct f2fs_sb_info *sbi, >> } >> left_start = find_first_zero_bit(free_i->free_secmap, >> MAIN_SECS(sbi)); >> - f2fs_bug_on(sbi, left_start >= MAIN_SECS(sbi)); >> + if (left_start >= MAIN_SECS(sbi)) { >> + f2fs_stop_checkpoint(sbi, false, >> + STOP_CP_REASON_OUTOF_RAGNE); >> + f2fs_bug_on(sbi, 1); >> + } >> break; >> } >> secno = left_start; >> diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h >> index 053137a0..72c6782 100644 >> --- a/include/linux/f2fs_fs.h >> +++ b/include/linux/f2fs_fs.h >> @@ -81,6 +81,7 @@ enum stop_cp_reason { >> STOP_CP_REASON_CORRUPTED_SUMMARY, >> STOP_CP_REASON_UPDATE_INODE, >> STOP_CP_REASON_FLUSH_FAIL, >> + STOP_CP_REASON_OUTOF_RAGNE, >> STOP_CP_REASON_MAX, >> }; >> >> -- >> 1.9.1
Hello: This series was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <jaegeuk@kernel.org>: On Wed, 7 Feb 2024 10:01:00 +0800 you 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. > > [...] Here is the summary with links: - [f2fs-dev,v2,1/4] f2fs: correct counting methods of free_segments in __set_inuse https://git.kernel.org/jaegeuk/f2fs/c/8bac4167fd14 - [f2fs-dev,v2,2/4] f2fs: fix panic issue in update_sit_entry https://git.kernel.org/jaegeuk/f2fs/c/4acac2bf18d6 - [f2fs-dev,v2,3/4] f2fs: enhance judgment conditions of GET_SEGNO (no matching commit) - [f2fs-dev,v2,4/4] f2fs: stop checkpoint when get a out-of-bounds segment (no matching commit) You are awesome, thank you!
On 2024/2/7 10:01, 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. Zhiguo, Can you please try below patch to see whether it can fix your problem? https://lore.kernel.org/linux-f2fs-devel/20240222121851.883141-3-chao@kernel.org Thanks, > > More detail shown in following patch sets. > The three patches are splited here because the modifications are > relatively independent and more readable. > > --- > Changes of v2: stop checkpoint when get a out-of-bound segment > --- > > Zhiguo Niu (4): > 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 > f2fs: stop checkpoint when get a out-of-bounds segment > > fs/f2fs/file.c | 7 ++++++- > fs/f2fs/segment.c | 21 ++++++++++++++++----- > fs/f2fs/segment.h | 7 ++++--- > include/linux/f2fs_fs.h | 1 + > 4 files changed, 27 insertions(+), 9 deletions(-) >
On 2024/2/23 10:01, Zhiguo Niu wrote: > > > On Thu, Feb 22, 2024 at 8:30 PM Chao Yu <chao@kernel.org <mailto:chao@kernel.org>> wrote: > > On 2024/2/7 10:01, 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. > > Zhiguo, > > Can you please try below patch to see whether it can fix your problem? > > https://lore.kernel.org/linux-f2fs-devel/20240222121851.883141-3-chao@kernel.org <https://lore.kernel.org/linux-f2fs-devel/20240222121851.883141-3-chao@kernel.org> > > Thanks, > > > Dear Chao, > I need to coordinate the testing resources. The previous testing has been stopped because it was fixed with the current patch. In addition, this requires stability testing to reproduce, so it will take a certain amount of time. If there is any situation, I will tell you in time. Zhiguo, thank you! BTW, I've tested this patch for a while, and it looks there is no issue w/ FAULT_NO_SEGMENT fault injection is on. > btw, Why can’t I see this patch on your branch^^? > https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/log/?h=dev-test <https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/log/?h=dev-test> Too lazy to push patches in time, will do it in this weekend. :P > thanks! > > > > > > More detail shown in following patch sets. > > The three patches are splited here because the modifications are > > relatively independent and more readable. > > > > --- > > Changes of v2: stop checkpoint when get a out-of-bound segment > > --- > > > > Zhiguo Niu (4): > > 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 > > f2fs: stop checkpoint when get a out-of-bounds segment > > > > fs/f2fs/file.c | 7 ++++++- > > fs/f2fs/segment.c | 21 ++++++++++++++++----- > > fs/f2fs/segment.h | 7 ++++--- > > include/linux/f2fs_fs.h | 1 + > > 4 files changed, 27 insertions(+), 9 deletions(-) > > >
Dear Chao, On Fri, Feb 23, 2024 at 10:38 AM Chao Yu <chao@kernel.org> wrote: > > On 2024/2/23 10:01, Zhiguo Niu wrote: > > > > > > On Thu, Feb 22, 2024 at 8:30 PM Chao Yu <chao@kernel.org <mailto:chao@kernel.org>> wrote: > > > > On 2024/2/7 10:01, 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. > > > > Zhiguo, > > > > Can you please try below patch to see whether it can fix your problem? > > > > https://lore.kernel.org/linux-f2fs-devel/20240222121851.883141-3-chao@kernel.org <https://lore.kernel.org/linux-f2fs-devel/20240222121851.883141-3-chao@kernel.org> > > > > Thanks, > > > > > > Dear Chao, > > I need to coordinate the testing resources. The previous testing has been stopped because it was fixed with the current patch. In addition, this requires stability testing to reproduce, so it will take a certain amount of time. If there is any situation, I will tell you in time. > > Zhiguo, thank you! We tested this patch this weekend on the previous version with problem, and it can not reproduce panic issues, so this patch should fix the original issue. thanks! > > BTW, I've tested this patch for a while, and it looks there is no issue w/ > FAULT_NO_SEGMENT fault injection is on. > > > btw, Why can’t I see this patch on your branch^^? > > https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/log/?h=dev-test <https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/log/?h=dev-test> > > Too lazy to push patches in time, will do it in this weekend. :P > > > thanks! > > > > > > > > > > More detail shown in following patch sets. > > > The three patches are splited here because the modifications are > > > relatively independent and more readable. > > > > > > --- > > > Changes of v2: stop checkpoint when get a out-of-bound segment > > > --- > > > > > > Zhiguo Niu (4): > > > 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 > > > f2fs: stop checkpoint when get a out-of-bounds segment > > > > > > fs/f2fs/file.c | 7 ++++++- > > > fs/f2fs/segment.c | 21 ++++++++++++++++----- > > > fs/f2fs/segment.h | 7 ++++--- > > > include/linux/f2fs_fs.h | 1 + > > > 4 files changed, 27 insertions(+), 9 deletions(-) > > > > >
On 2024/2/26 11:25, Zhiguo Niu wrote: > Dear Chao, > > On Fri, Feb 23, 2024 at 10:38 AM Chao Yu <chao@kernel.org> wrote: >> >> On 2024/2/23 10:01, Zhiguo Niu wrote: >>> >>> >>> On Thu, Feb 22, 2024 at 8:30 PM Chao Yu <chao@kernel.org <mailto:chao@kernel.org>> wrote: >>> >>> On 2024/2/7 10:01, 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. >>> >>> Zhiguo, >>> >>> Can you please try below patch to see whether it can fix your problem? >>> >>> https://lore.kernel.org/linux-f2fs-devel/20240222121851.883141-3-chao@kernel.org <https://lore.kernel.org/linux-f2fs-devel/20240222121851.883141-3-chao@kernel.org> >>> >>> Thanks, >>> >>> >>> Dear Chao, >>> I need to coordinate the testing resources. The previous testing has been stopped because it was fixed with the current patch. In addition, this requires stability testing to reproduce, so it will take a certain amount of time. If there is any situation, I will tell you in time. >> >> Zhiguo, thank you! > > We tested this patch this weekend on the previous version with > problem, and it can not reproduce panic issues, > so this patch should fix the original issue. Zhiguo, Thanks a lot for the test! Do you mind replying to original patch below tag? Tested-by: Zhiguo Niu <zhiguo.niu@unisoc.com> Thanks, > thanks! > >> >> BTW, I've tested this patch for a while, and it looks there is no issue w/ >> FAULT_NO_SEGMENT fault injection is on. >> >>> btw, Why can’t I see this patch on your branch^^? >>> https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/log/?h=dev-test <https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/log/?h=dev-test> >> >> Too lazy to push patches in time, will do it in this weekend. :P >> >>> thanks! >>> >>> >>> > >>> > More detail shown in following patch sets. >>> > The three patches are splited here because the modifications are >>> > relatively independent and more readable. >>> > >>> > --- >>> > Changes of v2: stop checkpoint when get a out-of-bound segment >>> > --- >>> > >>> > Zhiguo Niu (4): >>> > 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 >>> > f2fs: stop checkpoint when get a out-of-bounds segment >>> > >>> > fs/f2fs/file.c | 7 ++++++- >>> > fs/f2fs/segment.c | 21 ++++++++++++++++----- >>> > fs/f2fs/segment.h | 7 ++++--- >>> > include/linux/f2fs_fs.h | 1 + >>> > 4 files changed, 27 insertions(+), 9 deletions(-) >>> > >>>
On 02/26, Zhiguo Niu wrote: > Dear Chao, > > On Fri, Feb 23, 2024 at 10:38 AM Chao Yu <chao@kernel.org> wrote: > > > > On 2024/2/23 10:01, Zhiguo Niu wrote: > > > > > > > > > On Thu, Feb 22, 2024 at 8:30 PM Chao Yu <chao@kernel.org <mailto:chao@kernel.org>> wrote: > > > > > > On 2024/2/7 10:01, 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. > > > > > > Zhiguo, > > > > > > Can you please try below patch to see whether it can fix your problem? > > > > > > https://lore.kernel.org/linux-f2fs-devel/20240222121851.883141-3-chao@kernel.org <https://lore.kernel.org/linux-f2fs-devel/20240222121851.883141-3-chao@kernel.org> > > > > > > Thanks, > > > > > > > > > Dear Chao, > > > I need to coordinate the testing resources. The previous testing has been stopped because it was fixed with the current patch. In addition, this requires stability testing to reproduce, so it will take a certain amount of time. If there is any situation, I will tell you in time. > > > > Zhiguo, thank you! > > We tested this patch this weekend on the previous version with > problem, and it can not reproduce panic issues, > so this patch should fix the original issue. > thanks! Hey, do you guys please point out which patches were tested without what? IOWs, which patches should I remove and keep Chao's patch? > > > > > BTW, I've tested this patch for a while, and it looks there is no issue w/ > > FAULT_NO_SEGMENT fault injection is on. > > > > > btw, Why can’t I see this patch on your branch^^? > > > https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/log/?h=dev-test <https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/log/?h=dev-test> > > > > Too lazy to push patches in time, will do it in this weekend. :P > > > > > thanks! > > > > > > > > > > > > > > More detail shown in following patch sets. > > > > The three patches are splited here because the modifications are > > > > relatively independent and more readable. > > > > > > > > --- > > > > Changes of v2: stop checkpoint when get a out-of-bound segment > > > > --- > > > > > > > > Zhiguo Niu (4): > > > > 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 > > > > f2fs: stop checkpoint when get a out-of-bounds segment > > > > > > > > fs/f2fs/file.c | 7 ++++++- > > > > fs/f2fs/segment.c | 21 ++++++++++++++++----- > > > > fs/f2fs/segment.h | 7 ++++--- > > > > include/linux/f2fs_fs.h | 1 + > > > > 4 files changed, 27 insertions(+), 9 deletions(-) > > > > > > >
On Tue, Feb 27, 2024 at 9:13 AM Jaegeuk Kim <jaegeuk@kernel.org> wrote: > > On 02/26, Zhiguo Niu wrote: > > Dear Chao, > > > > On Fri, Feb 23, 2024 at 10:38 AM Chao Yu <chao@kernel.org> wrote: > > > > > > On 2024/2/23 10:01, Zhiguo Niu wrote: > > > > > > > > > > > > On Thu, Feb 22, 2024 at 8:30 PM Chao Yu <chao@kernel.org <mailto:chao@kernel.org>> wrote: > > > > > > > > On 2024/2/7 10:01, 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. > > > > > > > > Zhiguo, > > > > > > > > Can you please try below patch to see whether it can fix your problem? > > > > > > > > https://lore.kernel.org/linux-f2fs-devel/20240222121851.883141-3-chao@kernel.org <https://lore.kernel.org/linux-f2fs-devel/20240222121851.883141-3-chao@kernel.org> > > > > > > > > Thanks, > > > > > > > > > > > > Dear Chao, > > > > I need to coordinate the testing resources. The previous testing has been stopped because it was fixed with the current patch. In addition, this requires stability testing to reproduce, so it will take a certain amount of time. If there is any situation, I will tell you in time. > > > > > > Zhiguo, thank you! > > > > We tested this patch this weekend on the previous version with > > problem, and it can not reproduce panic issues, > > so this patch should fix the original issue. > > thanks! > Dear Jaegeuk, > Hey, do you guys please point out which patches were tested without what? This problem occurred during our platform stability testing. it can be fixed by my this patch set, mainly be fixed by: f2fs: fix panic issue in update_sit_entry & f2fs: enhance judgment conditions of GET_SEGNO and Chao's patch can also fix this problems testing without my patch > IOWs, which patches should I remove and keep Chao's patch? I think chao's patch is more reasonable, it does error handling more complete. but my patch just do some sanity check for return value of GET_SEGNO Same as other codes(update_segment_mtime) and i think it also needed except this part: diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 3bf2ce46fa0907..bb22feeae1cfcb 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -96,7 +96,8 @@ static inline void sanity_check_seg_type(struct f2fs_sb_info *sbi, (GET_SEGOFF_FROM_SEG0(sbi, blk_addr) & (BLKS_PER_SEG(sbi) - 1)) #define GET_SEGNO(sbi, blk_addr) \ - ((!__is_valid_data_blkaddr(blk_addr)) ? \ + ((!__is_valid_data_blkaddr(blk_addr) || \ + !f2fs_is_valid_blkaddr(sbi, blk_addr, DATA_GENERIC)) ? \ NULL_SEGNO : GET_L2R_SEGNO(FREE_I(sbi), \ GET_SEGNO_FROM_SEG0(sbi, blk_addr))) #define CAP_BLKS_PER_SEC(sbi) because Chao's patch let new_addr=null_addr when get_new_segment returns NOSPACE, so I think this can be reverted and it also saves code running time. How about Chao's opinions? thanks! > > > > > > > > > BTW, I've tested this patch for a while, and it looks there is no issue w/ > > > FAULT_NO_SEGMENT fault injection is on. > > > > > > > btw, Why can’t I see this patch on your branch^^? > > > > https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/log/?h=dev-test <https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/log/?h=dev-test> > > > > > > Too lazy to push patches in time, will do it in this weekend. :P > > > > > > > thanks! > > > > > > > > > > > > > > > > > > More detail shown in following patch sets. > > > > > The three patches are splited here because the modifications are > > > > > relatively independent and more readable. > > > > > > > > > > --- > > > > > Changes of v2: stop checkpoint when get a out-of-bound segment > > > > > --- > > > > > > > > > > Zhiguo Niu (4): > > > > > 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 > > > > > f2fs: stop checkpoint when get a out-of-bounds segment > > > > > > > > > > fs/f2fs/file.c | 7 ++++++- > > > > > fs/f2fs/segment.c | 21 ++++++++++++++++----- > > > > > fs/f2fs/segment.h | 7 ++++--- > > > > > include/linux/f2fs_fs.h | 1 + > > > > > 4 files changed, 27 insertions(+), 9 deletions(-) > > > > > > > > >
On 02/27, Zhiguo Niu wrote: > On Tue, Feb 27, 2024 at 9:13 AM Jaegeuk Kim <jaegeuk@kernel.org> wrote: > > > > On 02/26, Zhiguo Niu wrote: > > > Dear Chao, > > > > > > On Fri, Feb 23, 2024 at 10:38 AM Chao Yu <chao@kernel.org> wrote: > > > > > > > > On 2024/2/23 10:01, Zhiguo Niu wrote: > > > > > > > > > > > > > > > On Thu, Feb 22, 2024 at 8:30 PM Chao Yu <chao@kernel.org <mailto:chao@kernel.org>> wrote: > > > > > > > > > > On 2024/2/7 10:01, 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. > > > > > > > > > > Zhiguo, > > > > > > > > > > Can you please try below patch to see whether it can fix your problem? > > > > > > > > > > https://lore.kernel.org/linux-f2fs-devel/20240222121851.883141-3-chao@kernel.org <https://lore.kernel.org/linux-f2fs-devel/20240222121851.883141-3-chao@kernel.org> > > > > > > > > > > Thanks, > > > > > > > > > > > > > > > Dear Chao, > > > > > I need to coordinate the testing resources. The previous testing has been stopped because it was fixed with the current patch. In addition, this requires stability testing to reproduce, so it will take a certain amount of time. If there is any situation, I will tell you in time. > > > > > > > > Zhiguo, thank you! > > > > > > We tested this patch this weekend on the previous version with > > > problem, and it can not reproduce panic issues, > > > so this patch should fix the original issue. > > > thanks! > > > Dear Jaegeuk, > > Hey, do you guys please point out which patches were tested without what? > This problem occurred during our platform stability testing. > it can be fixed by my this patch set, mainly be fixed by: > f2fs: fix panic issue in update_sit_entry & f2fs: enhance judgment > conditions of GET_SEGNO > and Chao's patch can also fix this problems testing without my patch > > IOWs, which patches should I remove and keep Chao's patch? > I think chao's patch is more reasonable, it does error handling more complete. > but my patch just do some sanity check for return value of GET_SEGNO > Same as other codes(update_segment_mtime) > and i think it also needed except this part: Thanks for confirmation. It seems it'd be better to revert yours and apply Chao's patch first. If you think there's something to improve on top of it, could you please send another patch afterwards? > > diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h > index 3bf2ce46fa0907..bb22feeae1cfcb 100644 > --- a/fs/f2fs/segment.h > +++ b/fs/f2fs/segment.h > @@ -96,7 +96,8 @@ static inline void sanity_check_seg_type(struct > f2fs_sb_info *sbi, > (GET_SEGOFF_FROM_SEG0(sbi, blk_addr) & (BLKS_PER_SEG(sbi) - 1)) > #define GET_SEGNO(sbi, blk_addr) \ > - ((!__is_valid_data_blkaddr(blk_addr)) ? \ > + ((!__is_valid_data_blkaddr(blk_addr) || \ > + !f2fs_is_valid_blkaddr(sbi, blk_addr, DATA_GENERIC)) ? \ > NULL_SEGNO : GET_L2R_SEGNO(FREE_I(sbi), \ > GET_SEGNO_FROM_SEG0(sbi, blk_addr))) > #define CAP_BLKS_PER_SEC(sbi) > because Chao's patch let new_addr=null_addr when get_new_segment > returns NOSPACE, > so I think this can be reverted and it also saves code running time. > How about Chao's opinions? > thanks! > > > > > > > > > > > > > BTW, I've tested this patch for a while, and it looks there is no issue w/ > > > > FAULT_NO_SEGMENT fault injection is on. > > > > > > > > > btw, Why can’t I see this patch on your branch^^? > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/log/?h=dev-test <https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/log/?h=dev-test> > > > > > > > > Too lazy to push patches in time, will do it in this weekend. :P > > > > > > > > > thanks! > > > > > > > > > > > > > > > > > > > > > > More detail shown in following patch sets. > > > > > > The three patches are splited here because the modifications are > > > > > > relatively independent and more readable. > > > > > > > > > > > > --- > > > > > > Changes of v2: stop checkpoint when get a out-of-bound segment > > > > > > --- > > > > > > > > > > > > Zhiguo Niu (4): > > > > > > 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 > > > > > > f2fs: stop checkpoint when get a out-of-bounds segment > > > > > > > > > > > > fs/f2fs/file.c | 7 ++++++- > > > > > > fs/f2fs/segment.c | 21 ++++++++++++++++----- > > > > > > fs/f2fs/segment.h | 7 ++++--- > > > > > > include/linux/f2fs_fs.h | 1 + > > > > > > 4 files changed, 27 insertions(+), 9 deletions(-) > > > > > > > > > > >
On Wed, Feb 28, 2024 at 1:18 AM Jaegeuk Kim <jaegeuk@kernel.org> wrote: > > On 02/27, Zhiguo Niu wrote: > > On Tue, Feb 27, 2024 at 9:13 AM Jaegeuk Kim <jaegeuk@kernel.org> wrote: > > > > > > On 02/26, Zhiguo Niu wrote: > > > > Dear Chao, > > > > > > > > On Fri, Feb 23, 2024 at 10:38 AM Chao Yu <chao@kernel.org> wrote: > > > > > > > > > > On 2024/2/23 10:01, Zhiguo Niu wrote: > > > > > > > > > > > > > > > > > > On Thu, Feb 22, 2024 at 8:30 PM Chao Yu <chao@kernel.org <mailto:chao@kernel.org>> wrote: > > > > > > > > > > > > On 2024/2/7 10:01, 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. > > > > > > > > > > > > Zhiguo, > > > > > > > > > > > > Can you please try below patch to see whether it can fix your problem? > > > > > > > > > > > > https://lore.kernel.org/linux-f2fs-devel/20240222121851.883141-3-chao@kernel.org <https://lore.kernel.org/linux-f2fs-devel/20240222121851.883141-3-chao@kernel.org> > > > > > > > > > > > > Thanks, > > > > > > > > > > > > > > > > > > Dear Chao, > > > > > > I need to coordinate the testing resources. The previous testing has been stopped because it was fixed with the current patch. In addition, this requires stability testing to reproduce, so it will take a certain amount of time. If there is any situation, I will tell you in time. > > > > > > > > > > Zhiguo, thank you! > > > > > > > > We tested this patch this weekend on the previous version with > > > > problem, and it can not reproduce panic issues, > > > > so this patch should fix the original issue. > > > > thanks! > > > > > Dear Jaegeuk, > > > Hey, do you guys please point out which patches were tested without what? > > This problem occurred during our platform stability testing. > > it can be fixed by my this patch set, mainly be fixed by: > > f2fs: fix panic issue in update_sit_entry & f2fs: enhance judgment > > conditions of GET_SEGNO > > and Chao's patch can also fix this problems testing without my patch > > > IOWs, which patches should I remove and keep Chao's patch? > > I think chao's patch is more reasonable, it does error handling more complete. > > but my patch just do some sanity check for return value of GET_SEGNO > > Same as other codes(update_segment_mtime) > > and i think it also needed except this part: > > Thanks for confirmation. It seems it'd be better to revert yours and apply > Chao's patch first. If you think there's something to improve on top of it, > could you please send another patch afterwards? OK, I think this two patches still needed f2fs: correct counting methods of free_segments in __set_inuse f2fs: fix panic issue in update_sit_entry and I'll reorganize it thanks > > > > > diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h > > index 3bf2ce46fa0907..bb22feeae1cfcb 100644 > > --- a/fs/f2fs/segment.h > > +++ b/fs/f2fs/segment.h > > @@ -96,7 +96,8 @@ static inline void sanity_check_seg_type(struct > > f2fs_sb_info *sbi, > > (GET_SEGOFF_FROM_SEG0(sbi, blk_addr) & (BLKS_PER_SEG(sbi) - 1)) > > #define GET_SEGNO(sbi, blk_addr) \ > > - ((!__is_valid_data_blkaddr(blk_addr)) ? \ > > + ((!__is_valid_data_blkaddr(blk_addr) || \ > > + !f2fs_is_valid_blkaddr(sbi, blk_addr, DATA_GENERIC)) ? \ > > NULL_SEGNO : GET_L2R_SEGNO(FREE_I(sbi), \ > > GET_SEGNO_FROM_SEG0(sbi, blk_addr))) > > #define CAP_BLKS_PER_SEC(sbi) > > because Chao's patch let new_addr=null_addr when get_new_segment > > returns NOSPACE, > > so I think this can be reverted and it also saves code running time. > > How about Chao's opinions? > > thanks! > > > > > > > > > > > > > > > > > BTW, I've tested this patch for a while, and it looks there is no issue w/ > > > > > FAULT_NO_SEGMENT fault injection is on. > > > > > > > > > > > btw, Why can’t I see this patch on your branch^^? > > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/log/?h=dev-test <https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/log/?h=dev-test> > > > > > > > > > > Too lazy to push patches in time, will do it in this weekend. :P > > > > > > > > > > > thanks! > > > > > > > > > > > > > > > > > > > > > > > > > > More detail shown in following patch sets. > > > > > > > The three patches are splited here because the modifications are > > > > > > > relatively independent and more readable. > > > > > > > > > > > > > > --- > > > > > > > Changes of v2: stop checkpoint when get a out-of-bound segment > > > > > > > --- > > > > > > > > > > > > > > Zhiguo Niu (4): > > > > > > > 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 > > > > > > > f2fs: stop checkpoint when get a out-of-bounds segment > > > > > > > > > > > > > > fs/f2fs/file.c | 7 ++++++- > > > > > > > fs/f2fs/segment.c | 21 ++++++++++++++++----- > > > > > > > fs/f2fs/segment.h | 7 ++++--- > > > > > > > include/linux/f2fs_fs.h | 1 + > > > > > > > 4 files changed, 27 insertions(+), 9 deletions(-) > > > > > > > > > > > > >
On 2024/2/28 1:18, Jaegeuk Kim wrote: > On 02/27, Zhiguo Niu wrote: >> On Tue, Feb 27, 2024 at 9:13 AM Jaegeuk Kim <jaegeuk@kernel.org> wrote: >>> >>> On 02/26, Zhiguo Niu wrote: >>>> Dear Chao, >>>> >>>> On Fri, Feb 23, 2024 at 10:38 AM Chao Yu <chao@kernel.org> wrote: >>>>> >>>>> On 2024/2/23 10:01, Zhiguo Niu wrote: >>>>>> >>>>>> >>>>>> On Thu, Feb 22, 2024 at 8:30 PM Chao Yu <chao@kernel.org <mailto:chao@kernel.org>> wrote: >>>>>> >>>>>> On 2024/2/7 10:01, 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. >>>>>> >>>>>> Zhiguo, >>>>>> >>>>>> Can you please try below patch to see whether it can fix your problem? >>>>>> >>>>>> https://lore.kernel.org/linux-f2fs-devel/20240222121851.883141-3-chao@kernel.org <https://lore.kernel.org/linux-f2fs-devel/20240222121851.883141-3-chao@kernel.org> >>>>>> >>>>>> Thanks, >>>>>> >>>>>> >>>>>> Dear Chao, >>>>>> I need to coordinate the testing resources. The previous testing has been stopped because it was fixed with the current patch. In addition, this requires stability testing to reproduce, so it will take a certain amount of time. If there is any situation, I will tell you in time. >>>>> >>>>> Zhiguo, thank you! >>>> >>>> We tested this patch this weekend on the previous version with >>>> problem, and it can not reproduce panic issues, >>>> so this patch should fix the original issue. >>>> thanks! >>> >> Dear Jaegeuk, >>> Hey, do you guys please point out which patches were tested without what? >> This problem occurred during our platform stability testing. >> it can be fixed by my this patch set, mainly be fixed by: >> f2fs: fix panic issue in update_sit_entry & f2fs: enhance judgment >> conditions of GET_SEGNO >> and Chao's patch can also fix this problems testing without my patch >>> IOWs, which patches should I remove and keep Chao's patch? >> I think chao's patch is more reasonable, it does error handling more complete. >> but my patch just do some sanity check for return value of GET_SEGNO >> Same as other codes(update_segment_mtime) >> and i think it also needed except this part: > > Thanks for confirmation. It seems it'd be better to revert yours and apply > Chao's patch first. If you think there's something to improve on top of it, > could you please send another patch afterwards? Agreed. Thanks, > >> >> diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h >> index 3bf2ce46fa0907..bb22feeae1cfcb 100644 >> --- a/fs/f2fs/segment.h >> +++ b/fs/f2fs/segment.h >> @@ -96,7 +96,8 @@ static inline void sanity_check_seg_type(struct >> f2fs_sb_info *sbi, >> (GET_SEGOFF_FROM_SEG0(sbi, blk_addr) & (BLKS_PER_SEG(sbi) - 1)) >> #define GET_SEGNO(sbi, blk_addr) \ >> - ((!__is_valid_data_blkaddr(blk_addr)) ? \ >> + ((!__is_valid_data_blkaddr(blk_addr) || \ >> + !f2fs_is_valid_blkaddr(sbi, blk_addr, DATA_GENERIC)) ? \ >> NULL_SEGNO : GET_L2R_SEGNO(FREE_I(sbi), \ >> GET_SEGNO_FROM_SEG0(sbi, blk_addr))) >> #define CAP_BLKS_PER_SEC(sbi) >> because Chao's patch let new_addr=null_addr when get_new_segment >> returns NOSPACE, >> so I think this can be reverted and it also saves code running time. >> How about Chao's opinions? >> thanks! >>> >>>> >>>>> >>>>> BTW, I've tested this patch for a while, and it looks there is no issue w/ >>>>> FAULT_NO_SEGMENT fault injection is on. >>>>> >>>>>> btw, Why can’t I see this patch on your branch^^? >>>>>> https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/log/?h=dev-test <https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/log/?h=dev-test> >>>>> >>>>> Too lazy to push patches in time, will do it in this weekend. :P >>>>> >>>>>> thanks! >>>>>> >>>>>> >>>>>> > >>>>>> > More detail shown in following patch sets. >>>>>> > The three patches are splited here because the modifications are >>>>>> > relatively independent and more readable. >>>>>> > >>>>>> > --- >>>>>> > Changes of v2: stop checkpoint when get a out-of-bound segment >>>>>> > --- >>>>>> > >>>>>> > Zhiguo Niu (4): >>>>>> > 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 >>>>>> > f2fs: stop checkpoint when get a out-of-bounds segment >>>>>> > >>>>>> > fs/f2fs/file.c | 7 ++++++- >>>>>> > fs/f2fs/segment.c | 21 ++++++++++++++++----- >>>>>> > fs/f2fs/segment.h | 7 ++++--- >>>>>> > include/linux/f2fs_fs.h | 1 + >>>>>> > 4 files changed, 27 insertions(+), 9 deletions(-) >>>>>> > >>>>>>