Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp305688rdb; Thu, 22 Feb 2024 04:33:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVmYin5O2XNPVcyxAaJ7CFrHMCDbG4spvRNODEJpxBIcSSM/M41vYY9XaMVznnCqAQkigITQ5Ktec7g2gFep5VsnoXUq4tgC05JTUSqpg== X-Google-Smtp-Source: AGHT+IH5rBIpNZSbX0LzN7Iu9d0Lx98O8Cikwa8H8dB3qwKjTYxxz/GP8ZrnlklSD37kLU6ilId4 X-Received: by 2002:a05:6a20:6f8c:b0:1a0:8a2b:542b with SMTP id gv12-20020a056a206f8c00b001a08a2b542bmr16893631pzb.16.1708605195710; Thu, 22 Feb 2024 04:33:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708605195; cv=pass; d=google.com; s=arc-20160816; b=NcnYZ6bgOkCMvtgKnJEKGZD1YoxD0eoW/+/eqhct7+9qDpzuOahU9nq6NZtuMuTY4a 14/Ngtuvy7ekbepovut8XkmG9x7kgV8V2tApj2jklOP+S3fK3rse5v8gUsJK5cIQ/DjO Td7YxOVUkpUn7ZxpuAePXeNyaPIPLik0DUPFSTI21NEVaefjttsOKmaXfkQt86ocF/aP RjPJo21qO+NlWEoBnuUX2wYX8g78fxL2PD2cHz2J+dtMl99ESUtkNgelb8DXsFbB6MX2 HYXa2pF02iOb7N2gb6YvZdU9shkIxrQAmaj0RD40FfWCUJAhVVx9IQPmA2v4nV0kBWuN O4Tg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=XxH9bwkxsCzDaGR4h/AIxlcobTOWPd8epHe1+JU69Gs=; fh=W6COFBd4BX4Q4YpnsinfP4Lifuq45kIfChsHXFM1YEQ=; b=eHF2ExMnqPB5XL4QgoYwENDrsKrA8po1l5VG8QsUw41Hp2LMAfw8yFRcO/EeBG3onZ Ssjzy+nsJY54xR/1KJ1G/IGbapdKIsOXN1E5yh+lb0pj+C4LifIrGw5AG7ywAGXUzOl7 2wcoVrgZ47udnUpIFEVcVEbjTsSzDpdTJC/4r6ngDVLUjuhjKVlVcRTOQ5DWyI2x2xeO WZIwLC5SNxhk75JOj1kwlkaUEuJBAoo9/HZuxg3+9EOGeT3NF0W9ABiyPFHR+leRcuPG h5nnU8WkTn6CFjPnGPpfF+aatuD7zCjsC8tDnpGjCud6AdCJCGjOSLzfv2uz6nLblTt+ ETwg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pQdmftJr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76515-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76515-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id om8-20020a17090b3a8800b00298d1d48328si10477813pjb.59.2024.02.22.04.33.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 04:33:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76515-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pQdmftJr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76515-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76515-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 35BE02877B0 for ; Thu, 22 Feb 2024 12:30:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D1A6363403; Thu, 22 Feb 2024 12:30:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pQdmftJr" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0460E6350F for ; Thu, 22 Feb 2024 12:30:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708605055; cv=none; b=qCxtq8afIT49LAT6rSYnCRk+FHDyLjYNn75/MJCYHPQ9vc/o7YQzXokaesFozIMVbLEYAlDEQsAj75O1b3hVK+e4PfN5B0NqxfCgeuzcb68gUfpsVSFcYCgsNXg/3iF9x0f7SznTn2Xe8Uxuy7ijyCCE/ZtNsk+a5+z1YucoiUM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708605055; c=relaxed/simple; bh=fjFY5/FC5nitX0I63+wFnRJqrTw9DhGxaj21oxxRA6k=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=rl79nvXX5c0JgwZcpAvSeKKXaRkkoIx067PY2dx0WtUC+DyR6u6FT+rQ6QLqHbWz8w+u985iAi39eA3L8v61loPRq+k00pSVTZuAS+t/hVXaMRFYUV4GnAMyjVZXmajBqw4kIXgcaS5YeBcq5rANAmz2mpIBi8+p1tkS7YwpRXU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pQdmftJr; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB2DFC433F1; Thu, 22 Feb 2024 12:30:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708605054; bh=fjFY5/FC5nitX0I63+wFnRJqrTw9DhGxaj21oxxRA6k=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=pQdmftJr/wI8M+MjCk6oa/xKtIn+Z2JnlE41xn26x+pmCWCtvEwc1hMOBXE/VQ6O3 szwW0onZEJIZBgKbuINcRFluorOpWBYi4h/lS/JXs6P/n7wWslO8BeHNSkwSuaOmH2 ogGGtmgmCB3ppdjk8olbzHmnLrOymmOKjuaIJz2yqD0XDgfnJKH4jxWReuwIj0yHVa xThxcAjU5rg5e+pFiprjGwq1L9tIrsZsTFGnKW5IEW3YlqKI4DlJZkV/5Kq+ThBIuK yCbo2H7hOiJy7Nh5EY8MZdLnemgIM+08l//WmQikn+0+vK5DeBszP+K6ouvufD6zuK T44q9E5D8/ubQ== Message-ID: <88459a22-a21c-4c3d-8371-31d7d713b536@kernel.org> Date: Thu, 22 Feb 2024 20:30:49 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 0/4] f2fs: fix panic issue in small capacity device Content-Language: en-US To: Zhiguo Niu , jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, niuzhiguo84@gmail.com, ke.wang@unisoc.com, hongyu.jin@unisoc.com References: <1707271264-5551-1-git-send-email-zhiguo.niu@unisoc.com> From: Chao Yu In-Reply-To: <1707271264-5551-1-git-send-email-zhiguo.niu@unisoc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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(-) >