Received: by 10.213.65.68 with SMTP id h4csp2125352imn; Sun, 8 Apr 2018 20:20:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/IgLra9iyZ4yhrBERfjYSriG65Q1nJOaK3Vo5iPFbSoy6623eji272caD2Er/4GZKkJgPb X-Received: by 2002:a17:902:4225:: with SMTP id g34-v6mr37678515pld.297.1523244023206; Sun, 08 Apr 2018 20:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523244023; cv=none; d=google.com; s=arc-20160816; b=q//wKs0sm0R7GeMj8tlTXZsaYB0NnqwG5srdT8WMP8c5ANKjfFhlcKoaQWBssJ9vOJ 9REviCilc48q0TGD5OPIxCOxoTYg30f7lPL9ldIifYjqup4e8zREh21vo7Tfj9CGwfYK 9kmJ6AP0uEDMhOffvQ10BlMn6qWxoOq3TI+sCz+uWmJumOR7YK6MwzCYt1yZQniCLdni YOd79toMVjCGT+NgntBZLzOwxR4i/tYcMYSIiRYU+49XyOMaek8sFnPPWXGqiv+dL2qA l9EY3nVPsxzuGTGjtyr63uBzdlsG4rn6+YN6ctOft3icYa+a2zCj9DymIDdz7iy2Clzb RM0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=+Zokax6wRDFz2Zp/depPC4uT2kZ6Cehm4eS1EScPHUU=; b=J/242wHPwiH6VPZUpUK+sEpAXFCUtR83tPIOjmya+3uNL3FX0YbUodXz/WLQtCewr9 lX76hw/oTY2SNILKU4fl4Y4/yyBGVAk96hAZmAZ5WwJ6RgDebR8ylXdcoNv7g+VnLUHT 0zYrIZZlIP87cJGr8xg8TSI1PrhycPVfRRhjVJ0nuozAeiqr9O/UdH5LzTUFIUBh+ECJ Xd4w4FsE5O4BxwVTDdB2oJ1R39Rebu9C5gfAfjpjPJ+NQBPgCHtS1jDKwV5q6/qXJuM7 99H4AKMhz+Z5qj2sI/iRteUBVTJoi+cF592DeJzvGSl351rh9BeXP1lJeiNQRO3sycxu tTFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Y+ofKHpw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z73si10552493pgz.559.2018.04.08.20.19.45; Sun, 08 Apr 2018 20:20:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Y+ofKHpw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752492AbeDIDRH (ORCPT + 99 others); Sun, 8 Apr 2018 23:17:07 -0400 Received: from mail-by2nam03on0112.outbound.protection.outlook.com ([104.47.42.112]:27929 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754875AbeDIAXe (ORCPT ); Sun, 8 Apr 2018 20:23:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=+Zokax6wRDFz2Zp/depPC4uT2kZ6Cehm4eS1EScPHUU=; b=Y+ofKHpwTAPry0JwGcI5erf1TtV3tC+jTnWyb9ZWQWWmirV/p2+Zvf0hCxJiq1w6AZ3FqkN2Zz2h3HhXG+ND0P6Mo/e49bF7dz2nIJOJ+dFf+FJpHJyYUg3WqcUyWniwFejHzPSMqgYcyC73bRUxlv6vrb+Z9SEWiiXTugI/744= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1080.namprd21.prod.outlook.com (52.132.130.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:23:31 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:23:31 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Sheng Yong , Jaegeuk Kim , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 058/161] f2fs: avoid hungtask when GC encrypted block if io_bits is set Thread-Topic: [PATCH AUTOSEL for 4.14 058/161] f2fs: avoid hungtask when GC encrypted block if io_bits is set Thread-Index: AQHTz5iTUvE8ADvBCEyJXEsASvbGBQ== Date: Mon, 9 Apr 2018 00:20:33 +0000 Message-ID: <20180409001936.162706-58-alexander.levin@microsoft.com> References: <20180409001936.162706-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001936.162706-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1080;7:Pvz3chK0/67DMa5l/cNEsRH2pttdl53crKufpz0R+Pv+1ggyVC2dS907FcVep3lWXmhGCuov+5N4ivF0eVSBSNnW40Cj6nf1isa4FELBxK4N9RR7tWUjhjPYsg//HodYrvSblS6o/AnJ31t6XijiFXPEbEhpglUB2psSXkctmeFK66PvSVWbxjMJXUWV+oXhtSQ6SSXYA5bN4oRswwCXCKG1iS3vtd8XgJgDPM+qUGBOeGscCyajuUWV95b0x2se;20:EIq+IAHJhaM8AkU8Y6mfETl5Y5yek6eUQm7v2QlWEYNoBVoE90u/QFS36iLa4I/V4cOFIZsP30yPuc8iVaEQIV05/okp62sRCHiJdfyZB/rFA5WC3p2gzF5K+D6ZoscH/ZOIdmcoOH8tU+akEKq8hGBuZ3gKm307RN9eyyDeMFs= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 99d19d54-9c1c-4e3c-b8fa-08d59db01ff0 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1080; x-ms-traffictypediagnostic: DM5PR2101MB1080: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(50582790962513); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(3231221)(944501327)(52105095)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB1080;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1080; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(346002)(396003)(39380400002)(366004)(39860400002)(199004)(189003)(51234002)(2501003)(5250100002)(8936002)(10090500001)(5660300001)(3660700001)(446003)(107886003)(14454004)(36756003)(6436002)(476003)(3280700002)(2616005)(11346002)(4326008)(53936002)(6512007)(22452003)(305945005)(10290500003)(316002)(102836004)(2906002)(6116002)(66066001)(6506007)(3846002)(7736002)(486006)(54906003)(110136005)(186003)(72206003)(26005)(1076002)(105586002)(2900100001)(6486002)(97736004)(478600001)(81156014)(81166006)(86612001)(8676002)(106356001)(99286004)(86362001)(76176011)(59450400001)(68736007)(25786009)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1080;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: f1HChaQ3W6BcNOfYS0u6Ly0OireBA2fHPRFIGbR5edSE89d2T3sW8ydEHS9eA+SBMBA0kq+HTutj4q05rJMxuXaQx5OzHRHryO7vHFRr0+nz3/I76QPq/BtU+OMjj4GPgdK/lwwz8vFvaj7iVwOjW2jRevH212KuTp4x+F1zlmjDrJztO/IuGFk3SIkV7lDoVeDALfR39wqxeZCUr1PgalkKDE0AoE34J3gvCVBVwo/6xovOGGO1CMzU/Ru8Zu1CV01gv2lgDBr2n4cvJNSxr4s8EphdbMqI/BNTPMWY3lc7vEyBwfZOrdDFdJSYKa5cu0uC4fS+0e/PQoyKSlS9mH/MdIlKn+MPHZcr4osLbgYvkd0vtXeWjXHl5Qu2ZUVfbP+rml/yG7jeHx97D+TZN6I9BbcFEGMl8bUfXdR/WoY= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 99d19d54-9c1c-4e3c-b8fa-08d59db01ff0 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:20:33.3943 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1080 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sheng Yong [ Upstream commit a9d572c7550044d5b217b5287d99a2e6d34b97b0 ] When io_bits is set, GCing encrypted block may hit the following hungtask. Since io_bits requires aligned block address, f2fs_submit_page_write may return -EAGAIN if new_blkaddr does not satisify io_bits alignment. As a result, the encrypted page will never be writtenback. This patch makes move_data_block aware the EAGAIN error and cancel the writeback. [ 246.751371] INFO: task kworker/u4:4:797 blocked for more than 90 seconds= . [ 246.752423] Not tainted 4.15.0-rc4+ #11 [ 246.754176] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables = this message. [ 246.755336] kworker/u4:4 D25448 797 2 0x80000000 [ 246.755597] Workqueue: writeback wb_workfn (flush-7:0) [ 246.755616] Call Trace: [ 246.755695] ? __schedule+0x322/0xa90 [ 246.755761] ? blk_init_request_from_bio+0x120/0x120 [ 246.755773] ? pci_mmcfg_check_reserved+0xb0/0xb0 [ 246.755801] ? __radix_tree_create+0x19e/0x200 [ 246.755813] ? delete_node+0x136/0x370 [ 246.755838] schedule+0x43/0xc0 [ 246.755904] io_schedule+0x17/0x40 [ 246.755939] wait_on_page_bit_common+0x17b/0x240 [ 246.755950] ? wake_page_function+0xa0/0xa0 [ 246.755961] ? add_to_page_cache_lru+0x160/0x160 [ 246.755972] ? page_cache_tree_insert+0x170/0x170 [ 246.755983] ? __lru_cache_add+0x96/0xb0 [ 246.756086] __filemap_fdatawait_range+0x14f/0x1c0 [ 246.756097] ? wait_on_page_bit_common+0x240/0x240 [ 246.756120] ? __wake_up_locked_key_bookmark+0x20/0x20 [ 246.756167] ? wait_on_all_pages_writeback+0xc9/0x100 [ 246.756179] ? __remove_ino_entry+0x120/0x120 [ 246.756192] ? wait_woken+0x100/0x100 [ 246.756204] filemap_fdatawait_range+0x9/0x20 [ 246.756216] write_checkpoint+0x18a1/0x1f00 [ 246.756254] ? blk_get_request+0x10/0x10 [ 246.756265] ? cpumask_next_and+0x43/0x60 [ 246.756279] ? f2fs_sync_inode_meta+0x160/0x160 [ 246.756289] ? remove_element.isra.4+0xa0/0xa0 [ 246.756300] ? __put_compound_page+0x40/0x40 [ 246.756310] ? f2fs_sync_fs+0xec/0x1c0 [ 246.756320] ? f2fs_sync_fs+0x120/0x1c0 [ 246.756329] f2fs_sync_fs+0x120/0x1c0 [ 246.756357] ? trace_event_raw_event_f2fs__page+0x260/0x260 [ 246.756393] ? ata_build_rw_tf+0x173/0x410 [ 246.756397] f2fs_balance_fs_bg+0x198/0x390 [ 246.756405] ? drop_inmem_page+0x230/0x230 [ 246.756415] ? ahci_qc_prep+0x1bb/0x2e0 [ 246.756418] ? ahci_qc_issue+0x1df/0x290 [ 246.756422] ? __accumulate_pelt_segments+0x42/0xd0 [ 246.756426] ? f2fs_write_node_pages+0xd1/0x380 [ 246.756429] f2fs_write_node_pages+0xd1/0x380 [ 246.756437] ? sync_node_pages+0x8f0/0x8f0 [ 246.756440] ? update_curr+0x53/0x220 [ 246.756444] ? __accumulate_pelt_segments+0xa2/0xd0 [ 246.756448] ? __update_load_avg_se.isra.39+0x349/0x360 [ 246.756452] ? do_writepages+0x2a/0xa0 [ 246.756456] do_writepages+0x2a/0xa0 [ 246.756460] __writeback_single_inode+0x70/0x490 [ 246.756463] ? check_preempt_wakeup+0x199/0x310 [ 246.756467] writeback_sb_inodes+0x2a2/0x660 [ 246.756471] ? is_empty_dir_inode+0x40/0x40 [ 246.756474] ? __writeback_single_inode+0x490/0x490 [ 246.756477] ? string+0xbf/0xf0 [ 246.756480] ? down_read_trylock+0x35/0x60 [ 246.756484] __writeback_inodes_wb+0x9f/0xf0 [ 246.756488] wb_writeback+0x41d/0x4b0 [ 246.756492] ? writeback_inodes_wb.constprop.55+0x150/0x150 [ 246.756498] ? set_worker_desc+0xf7/0x130 [ 246.756502] ? current_is_workqueue_rescuer+0x60/0x60 [ 246.756511] ? _find_next_bit+0x2c/0xa0 [ 246.756514] ? wb_workfn+0x400/0x5d0 [ 246.756518] wb_workfn+0x400/0x5d0 [ 246.756521] ? finish_task_switch+0xdf/0x2a0 [ 246.756525] ? inode_wait_for_writeback+0x30/0x30 [ 246.756529] process_one_work+0x3a7/0x6f0 [ 246.756533] worker_thread+0x82/0x750 [ 246.756537] kthread+0x16f/0x1c0 [ 246.756541] ? trace_event_raw_event_workqueue_work+0x110/0x110 [ 246.756544] ? kthread_create_worker_on_cpu+0xb0/0xb0 [ 246.756548] ret_from_fork+0x1f/0x30 Signed-off-by: Sheng Yong Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/gc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index bfe6a8ccc3a0..7fb2729d8ee0 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -695,7 +695,12 @@ static void move_data_block(struct inode *inode, block= _t bidx, fio.op =3D REQ_OP_WRITE; fio.op_flags =3D REQ_SYNC; fio.new_blkaddr =3D newaddr; - f2fs_submit_page_write(&fio); + err =3D f2fs_submit_page_write(&fio); + if (err) { + if (PageWriteback(fio.encrypted_page)) + end_page_writeback(fio.encrypted_page); + goto put_page_out; + } =20 f2fs_update_iostat(fio.sbi, FS_GC_DATA_IO, F2FS_BLKSIZE); =20 --=20 2.15.1