From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E14A2C3ABC3 for ; Mon, 12 May 2025 11:55:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:Cc: Reply-To:From:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Subject:MIME-Version:References:In-Reply-To: Message-ID:Date:To:Sender:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=py66vW85e61YoZ3HL8Y92xMwsXGmpYS+MtVEc5YCC20=; b=dwRpwF4XMyMmH6hEX8s1AkFxaS sFQ0BOfCkF+ZimrzQiu0tviy1thYK88c/ADX+ZJ9cxKqMy1SreNWdaeQ8mOCjQPrKpTE/2V1koAli jjXa5Jf4RktsXhKtReEem8hWFpb6CHzLwa3U73PyTFmyHxC1SGtYkdkGhHS9WV53MMH0=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1uERkK-0001yT-Op; Mon, 12 May 2025 11:55:00 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1uERkG-0001yG-LR for linux-f2fs-devel@lists.sourceforge.net; Mon, 12 May 2025 11:54:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=WbjRZ5T2Z39BbipS0U9zuXWLRsvmp9jeoAeFrh6H92A=; b=j3Nl7HHe/E/9UeuoxnE4YZdaRD pXWy+j/iD0rkwffx2Auya/C942GlUHMnSjvkjdJavx6iM5O/uqmqz6A3Je4AsvTuty2l+1zWwpGwf 8WQFDz3GGrPilYV1ojMyR/URpks5DNP5wbt3pRVl1JqHeQV7b0o55GdJPVFHLKbD8Y7Q=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=WbjRZ5T2Z39BbipS0U9zuXWLRsvmp9jeoAeFrh6H92A=; b=T1Qu3b4L17yyL0qbBwW1QnFEG7 7SanXT+LfBrbIsZsdQ56RAXo4qt7qThttwIPogBi7NWMqcDYqDpZQ7uvcL7wlnz1I9loDuBU3oTf3 5Uhvluc+6L0ofkKQJ0amOO3z0uttZVrjMtZ46dZLyqExCnTX1EpZNZNSB/YeMWKKPdT0=; Received: from dfw.source.kernel.org ([139.178.84.217]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1uERkG-0007o1-6A for linux-f2fs-devel@lists.sourceforge.net; Mon, 12 May 2025 11:54:56 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 760B55C6419 for ; Mon, 12 May 2025 11:52:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 808B6C4CEED; Mon, 12 May 2025 11:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747050890; bh=1FFzBQnFeOZIUJzz8/wDGrTvsea7fEZOK8Kl5euk03k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X2QSduM3JLHXmhCTO/td/ErbcOLhXOymr/zMqpkSEqJbRLux22A9O6+C2RC7EUhsU 5H8M91C0X2jxpYwpJXRbUzvVYtfsejxUkLPKTvlbWDB79Zr0OCmKKWNDDYmgRjTnSM wLeog9nb84NgusxQT1fkC/nsDiLKjfp6UIXS+AUL/ABODB9PxvHFc6woxrZa5hGI+Y ze505nECNvyQW2PvlgeqRWEnV5T5/kT+yfRdZnswSh7+MCOlF2JzBD+aMUjHIG/XI3 zYC/4MBoLdGJdujZEpKOfIPNn9riFiv8qV49dNhcCtIZxfVyGm/rUejB89R3TPEidf w/fTvdDpZRGTw== To: jaegeuk@kernel.org Date: Mon, 12 May 2025 19:54:42 +0800 Message-ID: <20250512115442.2640895-2-chao@kernel.org> X-Mailer: git-send-email 2.49.0.1015.ga840276032-goog In-Reply-To: <20250512115442.2640895-1-chao@kernel.org> References: <20250512115442.2640895-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1uERkG-0007o1-6A Subject: [f2fs-dev] [PATCH 2/2] f2fs: add f2fs_bug_on() in f2fs_quota_read() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Chao Yu via Linux-f2fs-devel Reply-To: Chao Yu Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net mapping_read_folio_gfp() will return a folio, it should always be uptodate, let's check folio uptodate status to detect any potenial bug. Signed-off-by: Chao Yu --- fs/f2fs/super.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 0ee783224953..ea207a9edc10 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2973,6 +2973,17 @@ static ssize_t f2fs_quota_read(struct super_block *sb, int type, char *data, goto repeat; } + /* + * should never happen, just leave f2fs_bug_on() here to catch + * any potential bug. + */ + if (unlikely(!folio_test_uptodate(folio))) { + f2fs_folio_put(folio, true); + set_sbi_flag(F2FS_SB(sb), SBI_QUOTA_NEED_REPAIR); + f2fs_bug_on(F2FS_SB(sb), 1); + return -EIO; + } + memcpy_from_folio(data, folio, offset, tocopy); f2fs_folio_put(folio, true); -- 2.49.0 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel From mboxrd@z Thu Jan 1 00:00:00 1970 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 058F228D837 for ; Mon, 12 May 2025 11:54:50 +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=1747050891; cv=none; b=iLJR9QYei7q3NT8TMVW94i1ruCiPS2I3xvzAeqwQhqCxRXXkNie37BD3hc1z2u7OpyRHD/S/dbpw+q8LsRT9Rik+Jgere0Du5ORcn+oyTHV7jUtldPSKVMEuVrap1TweUvhACBzD2qcW0MPMTKoAq/uM1uWQh3E33gcB9tvtf0Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747050891; c=relaxed/simple; bh=1FFzBQnFeOZIUJzz8/wDGrTvsea7fEZOK8Kl5euk03k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tZX0XiEpeow9bgommNeTj8GNQVmBfdemiLNOtwToAFCBh+PIH1cMr9hie0P4qOtlSDdqb6KE2yWC0wun6MfUcChWZR0cu/c/jqtwmVB/nRUS3D7z3XpvFVd85RgE+5elgzQ2ZlpgjVvYR0cS3DHTprE8d3ROTa3glltP7HpMY5U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=X2QSduM3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="X2QSduM3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 808B6C4CEED; Mon, 12 May 2025 11:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747050890; bh=1FFzBQnFeOZIUJzz8/wDGrTvsea7fEZOK8Kl5euk03k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X2QSduM3JLHXmhCTO/td/ErbcOLhXOymr/zMqpkSEqJbRLux22A9O6+C2RC7EUhsU 5H8M91C0X2jxpYwpJXRbUzvVYtfsejxUkLPKTvlbWDB79Zr0OCmKKWNDDYmgRjTnSM wLeog9nb84NgusxQT1fkC/nsDiLKjfp6UIXS+AUL/ABODB9PxvHFc6woxrZa5hGI+Y ze505nECNvyQW2PvlgeqRWEnV5T5/kT+yfRdZnswSh7+MCOlF2JzBD+aMUjHIG/XI3 zYC/4MBoLdGJdujZEpKOfIPNn9riFiv8qV49dNhcCtIZxfVyGm/rUejB89R3TPEidf w/fTvdDpZRGTw== From: Chao Yu To: jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Yu Subject: [PATCH 2/2] f2fs: add f2fs_bug_on() in f2fs_quota_read() Date: Mon, 12 May 2025 19:54:42 +0800 Message-ID: <20250512115442.2640895-2-chao@kernel.org> X-Mailer: git-send-email 2.49.0.1015.ga840276032-goog In-Reply-To: <20250512115442.2640895-1-chao@kernel.org> References: <20250512115442.2640895-1-chao@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit mapping_read_folio_gfp() will return a folio, it should always be uptodate, let's check folio uptodate status to detect any potenial bug. Signed-off-by: Chao Yu --- fs/f2fs/super.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 0ee783224953..ea207a9edc10 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2973,6 +2973,17 @@ static ssize_t f2fs_quota_read(struct super_block *sb, int type, char *data, goto repeat; } + /* + * should never happen, just leave f2fs_bug_on() here to catch + * any potential bug. + */ + if (unlikely(!folio_test_uptodate(folio))) { + f2fs_folio_put(folio, true); + set_sbi_flag(F2FS_SB(sb), SBI_QUOTA_NEED_REPAIR); + f2fs_bug_on(F2FS_SB(sb), 1); + return -EIO; + } + memcpy_from_folio(data, folio, offset, tocopy); f2fs_folio_put(folio, true); -- 2.49.0