Received: by 10.213.65.68 with SMTP id h4csp2153180imn; Sun, 8 Apr 2018 21:05:08 -0700 (PDT) X-Google-Smtp-Source: AIpwx48jT7GpkjqrgfPiy0iEAjFe0Dg70OzA8v495e/FYO/wwddgR4qwtSfvPteX+cy+ekRNYoh6 X-Received: by 10.101.102.197 with SMTP id c5mr13691968pgw.93.1523246707986; Sun, 08 Apr 2018 21:05:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523246707; cv=none; d=google.com; s=arc-20160816; b=Ct9YiplAZyF4VZiVBX+91EUcwEtfWwd8flDvc9lezjlZSSo5zJHCAT04mvCkAv1YVa ZHs6Bw7bolUUK0RgnVcaZ5NEuTV/pjaJGy62xjSoNNvyXQBUZS02rKGXGQjuXEumLBde Sq7uD3gSwmnPOjAC4IQIo229L3zF/vGidkcuc4GnWilPeyVD79qFBg0Gwg8z5sdUy5ES KqA8zHucmV0IhnrL7u1eVwiu9a2bOtTb5yuaCZgDguf1WOq6ZiUAgWBw9Xr0N0AEGjFl d3aN+iAb+M6xSZ9ARdlh7HIWONxR+RdFVOLHFgNqMiCM5YY7xKSyKX0MrCTuWnCBfC1M MTag== 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=zKi3kYNuLcY75fe1TEoZ8o7z6irNVq1oceHagqALo+o=; b=iNZcvWZ5SeUUQLXoIcZLVFz7G6J1HtQ2k0aPtm1tR27NhcWPkH1v/n9NkVXvCLKnOC 8mGZE8RW8w6KqLc38OYQTl7Ym3TxEZkdPTUQ0Kpkin+UqRu9cG0MuB/hCuwD62LznHBY 8k+LCmRyqdKHbfzM70iQIlUOxKuNziJTH5/yoGkaVv+8Zw4FWGJBnbNVz/Srp269UqMH Pk2yqmFpTz4JkIahwDlJSuA1d+LF4q4KsTplCNsvaX6dFZt+i++hR+j7+P/nblO9biq8 Bj2G4kXRiAm9CFqp8b+OVhmEVKq3f0yDRpURivd7YiUj8IRwDLbzwydzVbYDx1Lpu2ko G5pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Ofw+o0Yf; 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 j88si12001991pfe.334.2018.04.08.21.04.31; Sun, 08 Apr 2018 21:05:07 -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=Ofw+o0Yf; 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 S1754724AbeDID7N (ORCPT + 99 others); Sun, 8 Apr 2018 23:59:13 -0400 Received: from mail-co1nam03on0109.outbound.protection.outlook.com ([104.47.40.109]:37278 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753596AbeDIASf (ORCPT ); Sun, 8 Apr 2018 20:18:35 -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=zKi3kYNuLcY75fe1TEoZ8o7z6irNVq1oceHagqALo+o=; b=Ofw+o0YfzcrN+N82O9aQxJqdR0WH7YSjy3TkA94V5aw55KgmxeGXbHKFjdKrGjkH+Gopq9meaMqB5ejXkQFjfUJEyWByasIjE0fHXaNktw/i7WVT32qG50hGlR5kY5WedP5wyyWYADxAw+BDqBJEpEP+X9e599ZISaG511NFtY0= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1046.namprd21.prod.outlook.com (52.132.128.15) 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:18: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:18: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.15 068/189] f2fs: avoid hungtask when GC encrypted block if io_bits is set Thread-Topic: [PATCH AUTOSEL for 4.15 068/189] f2fs: avoid hungtask when GC encrypted block if io_bits is set Thread-Index: AQHTz5gqD1/FMi4Xd0qH16sj72GRkw== Date: Mon, 9 Apr 2018 00:17:38 +0000 Message-ID: <20180409001637.162453-68-alexander.levin@microsoft.com> References: <20180409001637.162453-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001637.162453-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;DM5PR2101MB1046;7:Z3Yf05hAyBIhfxYn/5ksGVsyJtwB4NpMH1Y7uPcu+5bSwbKrvOBJ7uj4VZWbQsSyFEIL3iwYlUTiAR1DEKa1VuDc70MINzJujJcnbmV53vBAUNrSOXlIalT0O9d2LspJFsPqsw3ZLAdwSrphIW6+QzO3QYmcXsYOzZJsqjF1mrkLg12Ar0LQNENCjFdi64lDkzxAjn+kKB8WmvWj4emPcPBMAZAnBx+u7mygB+Ge272BnDsFVG30rgiA5CwHZLK5;20:3K/CMLij6eggmZy1xM0eT+7Sab1bCGxFOGHkazfwQW0yQY7mFKyqk3nIxRZerrPFHdlUwKt8HYxfpvci8pSvjP316EM4FbXdGXpKmGhwvgHUebDGB1WFro2qbwAuML7rwaXJWVJDaxLCn8YFSnMfes9ib9gK69zuRkmgCGEG+bA= X-MS-Office365-Filtering-Correlation-Id: 05e33a66-4e6d-4843-03dc-08d59daf6d0b x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(48565401081)(2017052603328)(7193020);SRVR:DM5PR2101MB1046; x-ms-traffictypediagnostic: DM5PR2101MB1046: 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)(3231221)(944501327)(52105095)(10201501046)(3002001)(93006095)(93001095)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(6072148)(201708071742011);SRVR:DM5PR2101MB1046;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1046; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(346002)(376002)(396003)(366004)(39860400002)(51234002)(199004)(189003)(36756003)(186003)(11346002)(446003)(476003)(2616005)(7736002)(5660300001)(26005)(10290500003)(478600001)(106356001)(68736007)(10090500001)(54906003)(3846002)(59450400001)(22452003)(6116002)(86612001)(110136005)(99286004)(86362001)(72206003)(305945005)(76176011)(102836004)(6506007)(486006)(316002)(3280700002)(3660700001)(81166006)(81156014)(8676002)(2906002)(14454004)(2900100001)(97736004)(6486002)(8936002)(1076002)(6512007)(6436002)(105586002)(25786009)(4326008)(2501003)(5250100002)(53936002)(66066001)(107886003)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1046;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: EMIi06mp9OFHIrm50Bt4snmNyrBXmijrUTZ9Z7pqa1p29UwP0aNC/uMuvm7QsT8iCFznDe7P/2zNuVJEMi6gT6Bsq0w7lLFzAiLgaDXWtjJPqXdp6SxrM04a6EjTy0WCgFsLjr50qhH73ycosReugYkPi8l6dO32vThy9ZDA4BASWUEOWDc/jdwo0jIZ8wWo1JowKOs72U7ThG7SN4lndll4zHeogslJZeUQErq5jX5bidtcRTfke8hiBBxRQUjCaCnv8AJa+QQRyCqrDMmqB76iBCui9vA2Ahis4ZzZ9VzZGO1Y60hR6w115BFQqqkm1dRMdTNjRvIKInAto2tTPSA6MzOIg/tbNoMMPoovRLIo9CYpy13+LcHKLLVKd5DueMIYzjT6ZjctdLW5+zq/L13gXScINrYmXHrrBuKAOs8= 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: 05e33a66-4e6d-4843-03dc-08d59daf6d0b X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:17:38.6962 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1046 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 d844dcb80570..bab49a270401 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -686,7 +686,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