f2fs: fix to handle filemap_fdatawrite() error in f2fs_ioc_decompress_file/f2fs_ioc_compress_file
Message ID | 20230302095509.53720-1-frank.li@vivo.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4145311wrd; Thu, 2 Mar 2023 01:58:51 -0800 (PST) X-Google-Smtp-Source: AK7set/ptYUrOi7vAK9DTB90T6sekI15/2GlCii7IEHEmfsQiIOQMICfGldPDraeAgFxVHTZdJdr X-Received: by 2002:a17:906:4fd1:b0:8b1:2867:380 with SMTP id i17-20020a1709064fd100b008b128670380mr12429480ejw.22.1677751130809; Thu, 02 Mar 2023 01:58:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677751130; cv=pass; d=google.com; s=arc-20160816; b=eG+V5wPbn1suTHQ7hQb52Vpf3p4QvaWnhNSsC6kI8LBFS01PdvQD7QrFU9gz61egoH bBW2FzNyO+gI72QMclPjqSiEa23+Go+bGsdJZUCwWLhx2p5dGbyIVKhkkQ1aQw/t+0KC gZAXDsZPfNg+hQF9DM2trucLT53svIKlviVLUTYDyoLgGNQKtu99Aqcz6xaBEtIX0Xj4 0tqH9zPm55wHeeMwu0sLKtwG8Zi3EuobcykuNWiOOJa7jLCAEM84hlcJ9QGVDsn8gscC bkHdZ92SbM9HiyrpZ9MG1oSvBdYgHpMeWb0VWrkvBqOaRhLN4fmOdQ5C85Y46+QbQDZj UR1w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=BzFvqQ0HO2a1IcyqY0OGt/5shS2c8LKXTIlpPqilV7Q=; b=n+uTgnONvJ12TMIBa7wXcggDGNQKIeALxPmstkykEhvZo8GK9jO22WIZKEfEA6eE/c 1onHE2WBGbwlm/T4x8WkpqiUYbtzhfP+yqHUkf2UT53DgeWY2vQ5Vvio2cZnoSV8yhHT Gb04L4NBQP1Kpxp+kNgjZ9W6RhhIL/l07i/IH3B6lk8ZrkgXA/MDbiBGzviCU+/EceWf U/fay0p5MI7Ds8IrVNRoyEITBPr4uNGJLaYqJ9OWIcjlAKxZFJ0fzxN52QEfkKaDDTmK qCfzl9JW8vN9UpcHtuIVeUmsQOeoGjZIvHVwHqCKvGRXFM5dq5V98+1O4DMSHca3/Fa6 Ce7A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b="Ik/vKmeW"; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020a170906850d00b008b17e1a1916si14735466ejx.764.2023.03.02.01.58.28; Thu, 02 Mar 2023 01:58:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b="Ik/vKmeW"; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230345AbjCBJzj (ORCPT <rfc822;davidbtadokoro@gmail.com> + 99 others); Thu, 2 Mar 2023 04:55:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230309AbjCBJz2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 2 Mar 2023 04:55:28 -0500 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2136.outbound.protection.outlook.com [40.107.255.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EA2E1516A for <linux-kernel@vger.kernel.org>; Thu, 2 Mar 2023 01:55:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ATuH6nG91DBxYCmRuHAuO5E6CqjdqPv7GlBiLM4cPVQn69heD8r8k7sBuvVKJh2VLedxCQWlqePlbi4VfkTH+iaV5l2Jnbit6ZOqbzhcnxjVp80UFH5KzQ++DIrGfMaAcrx4BVyYBKlaEnXx0+2bBOW+rX+bdSoke4qKmto6Fa0hrMX0z9yBRAvPWhDGNCWk9VY/v4b6qfutwQvB05GXsbW4MnryEXyyaDaVeuW2ubtwixg4aXmA5vPvpv93zbNG1uEdPaNetOHZb8F9BaceRngymON9DN10kIXwdFmsJOwRdcW4HViDqJVRv+R714ln3NCNO5SSIbOgDORwjJxAiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BzFvqQ0HO2a1IcyqY0OGt/5shS2c8LKXTIlpPqilV7Q=; b=DuLGDwNeypVkkJBzX28CKYw9ExsN5qZpUMZsBAA8u/TaoW4k6tMNKzbOsdivbtWYEyJAUj+KyBp5FgFj9PRlvYQ6pU+hl4aQdZ8zGN4DnmyksTplAduJWTw5bsdVt8VAs1LZkaR88zmD0utG2bwnizL5e+xBxUjppt7q736iSJh23uTZ6nqGbAag9GrfccC3c5fH+RTjg4rxHfFk80AvxsKKHXDVTJpDBOKklqNubKSXx9brd/Km/CfCP6eEbP1FiTxbRzOGt/uc0HjR0Lc+HS5nkgzTInaSFjPVxr1uAuWVId/+APj43D5ZSU9j9AEjAENz/Zt/9KSx1ynQD8mt3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BzFvqQ0HO2a1IcyqY0OGt/5shS2c8LKXTIlpPqilV7Q=; b=Ik/vKmeWC0UXTQyWwK0UxBdNRF5mr6s0Uy5wFcAjc9uN0lvKUZbGT7VCmwhQpscTBae4a5iVdKqwuo3u9+XuT2q08bKNw/j0Tnxvh1bZ+r34v60nKOSQXZG9dey1TWoEoxhdwL+adTfSHoB5COeQkrpvlkfvAxslAhisU4dBa2OsNqLzsJq1GyNdgDboHujwIvSuox64jzlFy8y+/qyv8Udpn6v/ULBxZzZxmR4MPWKo732/ESUhWV2xDThonSY1fyF9UrHuTXYH0u6AakrnjwBzZzbjCgbNQAXUy9+B4jmMsUzAj0QPctoh3OreWrl4Viw8seDynO8x5YYURLE0KQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by KL1PR0601MB4560.apcprd06.prod.outlook.com (2603:1096:820:81::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.18; Thu, 2 Mar 2023 09:55:20 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::daf6:5ebb:a93f:1869]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::daf6:5ebb:a93f:1869%9]) with mapi id 15.20.6156.016; Thu, 2 Mar 2023 09:55:20 +0000 From: Yangtao Li <frank.li@vivo.com> To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Yangtao Li <frank.li@vivo.com> Subject: [PATCH] f2fs: fix to handle filemap_fdatawrite() error in f2fs_ioc_decompress_file/f2fs_ioc_compress_file Date: Thu, 2 Mar 2023 17:55:09 +0800 Message-Id: <20230302095509.53720-1-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR02CA0034.apcprd02.prod.outlook.com (2603:1096:4:195::9) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR0601MB4560:EE_ X-MS-Office365-Filtering-Correlation-Id: 2fa765df-2543-40a7-2f1d-08db1b043bb2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f6HiTdryc5HJTsjn6y8VK1wzHCVQW7KMyg9YruShkVM4B89shDH7fX/bkJRUGgZSNaW6lqRwc3c5s9CWrlpRT0hNN3+QkOyvYJh2KeLY700yN1QC7R9pQv/2zryqFcQ/ZVx1WpE0sHp2xKWmtcLRb7njmPz/3FZ2FOt2ftTEOmUGz3P3X9cjSa4y2+IHBjn9Jk9HA6H4ptPPwlbqzQLDKB4si6EcI+NKPgGN7ucQwUMkJIum84tNpkHGf01nTbfOq9gIraK/yBqik3Vnzb8KR+tCPPKw6gtnZHcb8MpDyMrsqJXqpQWQb9ZArRg72cx0zne9dOC0fliS4LAMts3L5yTeS2MWCLj8bq7ojMtWxtneDwPyg75gu2l14dtjVD8VzY0gEi/C6l+v9WXgoZa1aV3JNS+AAr61R71hQ4fV+4TBMJ/ulemU9KcZOqPzlAqTF7mcfmFEwWUoNZK3UCzae0N1CYsXUkd4R+n4PLVUdlNb6TPY5Cl23baJgioAWDSGms9AGB4GAsa/rdfcPWNN8VuSiUwBexpO/1fngFA/n3msQUbz+DypOF5prKhUCL8DnZHeYwdSDRilRzFUpcx22mJ7aF5J5qNBC8SKVWvcq0uXvewEQHyI/F+nTIwf/OYZCW4at7o6dWdZp9LYi+1gBUQ4Zjp/6gbsqX/NJtMQ5XW+dy6XDX+u060ehnuWLev/e2OzyU7WT4NyvVBSt4kGcg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(366004)(136003)(376002)(346002)(396003)(39860400002)(451199018)(186003)(66946007)(66556008)(2906002)(36756003)(86362001)(6486002)(478600001)(6506007)(26005)(6512007)(1076003)(6666004)(107886003)(52116002)(316002)(66476007)(41300700001)(2616005)(8936002)(5660300002)(8676002)(4326008)(83380400001)(38350700002)(38100700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lW+ajp1RxE5zv3E/7o3OPO7+wjdbgDu8euSjd30W0TB1zkk+AxdnfaT8ThC6rUSJJOmCvEPPCxcnOB8WjlB8/+qmj+f5yOZawL55lZ9ssU1bDS8hxOEv+a65XfJQcwOtnGm0Xk+0IHhNtE+B4dkH9ggs1D6B4q67Udr/38EZjrc3l+1Z5urWkd730nl42g5t2ImWZM96BvC/91JE2VXTwGodlooMpALq84BYT2cR2vatbkseZHftE5UyxqiGf8tl7KqTRnaDkuc0Gz6mR5riSPyoEqSbNxa4rECf2UgWZCTR0SL1Ny8uB7VZiE7jbnZyS20+gjH3fSipHLn9kjkMu8N7Ik1mTdZWT/Bm+apoV7m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tLPZbt8o8n9V5c5+xalE7jS5CewqDKNmEO2sbasS1Cs30AkiQt5OxiPMGGkTjZ/DWSBj+NUtshS1cXi7vshfsUh8MH7FTj9AY2Q30QHSu0y72ozAeWar71G8X7c575anIqGcvIf1GQAM8sVdB6M1waOiid749DW4ESjiu52hG+ X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2fa765df-2543-40a7-2f1d-08db1b043bb2 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2023 09:55:20.1221 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: IMfYY4zOtgAlfStUAhIRS9Vi8w2y3u7vYw0fCuuG/xU2YvakzOfcmFidNurrXMgtnL+rUjSDXyfZfzBOTAvOsw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR0601MB4560 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759249569573134733?= X-GMAIL-MSGID: =?utf-8?q?1759249569573134733?= |
Series |
f2fs: fix to handle filemap_fdatawrite() error in f2fs_ioc_decompress_file/f2fs_ioc_compress_file
|
|
Commit Message
李扬韬
March 2, 2023, 9:55 a.m. UTC
It seems inappropriate that the current logic does not handle
filemap_fdatawrite() errors, so let's fix it.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
fs/f2fs/file.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
Comments
Hello: This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <jaegeuk@kernel.org>: On Thu, 2 Mar 2023 17:55:09 +0800 you wrote: > It seems inappropriate that the current logic does not handle > filemap_fdatawrite() errors, so let's fix it. > > Signed-off-by: Yangtao Li <frank.li@vivo.com> > --- > fs/f2fs/file.c | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) Here is the summary with links: - [f2fs-dev] f2fs: fix to handle filemap_fdatawrite() error in f2fs_ioc_decompress_file/f2fs_ioc_compress_file https://git.kernel.org/jaegeuk/f2fs/c/d15180a8d1d7 You are awesome, thank you!
On 2023/3/2 17:55, Yangtao Li wrote: > It seems inappropriate that the current logic does not handle > filemap_fdatawrite() errors, so let's fix it. > > Signed-off-by: Yangtao Li <frank.li@vivo.com> Reviewed-by: Chao Yu <chao@kernel.org> Thanks,
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 15dabeac4690..6de2f27c4eec 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -4062,8 +4062,11 @@ static int f2fs_ioc_decompress_file(struct file *filp) if (ret < 0) break; - if (get_dirty_pages(inode) >= blk_per_seg) - filemap_fdatawrite(inode->i_mapping); + if (get_dirty_pages(inode) >= blk_per_seg) { + ret = filemap_fdatawrite(inode->i_mapping); + if (ret < 0) + break; + } count -= len; page_idx += len; @@ -4133,8 +4136,11 @@ static int f2fs_ioc_compress_file(struct file *filp) if (ret < 0) break; - if (get_dirty_pages(inode) >= blk_per_seg) - filemap_fdatawrite(inode->i_mapping); + if (get_dirty_pages(inode) >= blk_per_seg) { + ret = filemap_fdatawrite(inode->i_mapping); + if (ret < 0) + break; + } count -= len; page_idx += len;