Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp236718rdf; Tue, 21 Nov 2023 00:47:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IFwUL9rMwYs8pvSvSPNWOQYSphlx30MXaJyxPnOnLuXRiJW0Luc04vWWv8L5EiIhMOIF90a X-Received: by 2002:a81:9f03:0:b0:5c9:3452:43ce with SMTP id s3-20020a819f03000000b005c9345243cemr8463729ywn.15.1700556467713; Tue, 21 Nov 2023 00:47:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700556467; cv=pass; d=google.com; s=arc-20160816; b=ASmnagjNCwchv8yBaIRNf0+JTwU3Ga+9pI0+eFf7ckt5evqJUHKjCbsrTv9xdNJomF NhYQh4KTtdSD5bBYOulPJPAO7tGeYfhIl7fR3bEImM+KyilaUs75L5Sq7EpzW0tLvpEP 6h4g1zVd1aJbjpWBghNWV77Wnk5Fuz/7YxXE1hR4Dh25wmzaQABWRqzfihXOMOiwKlFD Tu1Qduu/AurdpK2q/AZdnwkLQBxsRN3+NRva2WJFtXHt5AtZbLIZy7rJOrJfW//JaSdw kSn59Bt5B/zYRDmTcvVt/cKhhrTXFtcKjv7bEUy4Q1D1r6eHlVk4yrMfK8ocY/3jJi6V nMnA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=O1jKzEvgvT1xkpQeOmtQYxQ49es/Ht9A/RtNWtHmNZ4=; fh=J30sqVfw9OjtpxbNumwD0tVG0bXXvvrP5TOHSwVy/Ns=; b=Wf0Byih2ydPOwOj0+Hpxo03DmSTKqpbPEkuEmmeMLgPgEq39OgIw7QDIoCrPo0uyht WTFVJOuyD6hH5I5ezKrqlQ54X9TnrBcQsBPHSGuxH84+73+qeXly1gYwrAv+4YQ1GILN 6ZgFaTVkVGsxn9/IRuIw0mLaIeF7VfHneZjeHrGJk0f/+T3ypOf100Ks2DCwW6TBg04T hjQ381A1mEOBoXan2Guesrwj3sl5NPuTfZqhBfnUiQ3VIY+kXxsZQUQi5IsL+HFI7Lv9 lMlMH4XDa36ox/s43Dyj9YIPECldAL8cgg+sNAKxBuBz8fesc94DvhkDKpn+R5wUn0jQ 7qzw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=mE8aMExB; 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 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id q19-20020a632a13000000b005b11e5a69f8si9253361pgq.531.2023.11.21.00.47.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 00:47:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=mE8aMExB; 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 23.128.96.33 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 12D83802EEC8; Tue, 21 Nov 2023 00:47:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231580AbjKUIrR (ORCPT + 99 others); Tue, 21 Nov 2023 03:47:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231573AbjKUIrM (ORCPT ); Tue, 21 Nov 2023 03:47:12 -0500 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2135.outbound.protection.outlook.com [40.107.215.135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03BBC199 for ; Tue, 21 Nov 2023 00:47:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ci2fjush3uHy2eHrR4KMEL7OPv45k7sEvXP4HEDwRlymTV6sx29lC460E4PmOEfyJDjFLxhop7hIGqlyyooFT64i3A8rWXSYQ3x+PrXjHm2j8NvzS1Nw9kSZou2MDU+sEVrMS+tVRBbPb1MxOMJ+OFq0orTxhqQKteVng3ebt+gMZMWx5ybnEACpBwXg8CYVddOnKMc4p9xvUMMWOgQFa2DHGhz5pOTsMz1wY9eZUQYoT+eHjWQZxX4yQVXcI0yhnNC1zDjmo2gusMEhlVfmMZuElNex+n6QHHmI26iomKWXpyWJcjl8bhNVkTtJBW8sVSyJZtRFLcxlOlVtEi2Tyw== 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=O1jKzEvgvT1xkpQeOmtQYxQ49es/Ht9A/RtNWtHmNZ4=; b=VLCmUgL/avC7vfn6DmFa3Nn6RoShaKYfvsdQqcl3v0XYLbhhI6ACfjQYdbTXSj02oO/n8JrU13yIvRqBIiB/YXgVhkJBUYnQIlKbt+jClDphZdmD2h4p+2m9753GK/BevyMyvE4f2BogMvfzWqx3ThGwBB4+BOCc85N59XqmBqKdLISRl8Z6rtLMUNYdd2yV4TOnFYJdeXql4AjMk5mvBg4P+viEeH7QNypRHVgPUv1nZdW79Cfwdcu9GNLCo/0N0i83t44KE5H6OGi5e+qf/2B+8lvL25JdLhwNRvyzS4i7ITGaWQacgpeqYNgVAzpm8pY7AQV3vzft/g0eQ6Dbsw== 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=O1jKzEvgvT1xkpQeOmtQYxQ49es/Ht9A/RtNWtHmNZ4=; b=mE8aMExBBVw0CZ3ESwN/tK4mB0gNugE75EOWAktq79bGZwqI277C6FZavJ3OsLBtNQBv31VmwtMt9TZf4qPw5pvmWFl/pMxdgb9nWRSywYMUL2LJ7Go9oYrlwxcP8chr0hWRqiX0BUZiuxy/uIL3WDN2EFK1EYD1NASrCKSyL178n+/VoUZziEVx4/WfoMBko3Vs0SWmykrE2KLc4syl/IkdB/sSFhvhRW3HimiLOY7CC7/RFGvfCUCbtDqenVT4un8Z5x1eY021GsEzPzqMSYks3MnAhpYOHuLzbp36IsTgu5XXV3TiDYpFI8NC4lzimV8LW+tGTIRDnfkXdIA3zw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PS2PR06MB3509.apcprd06.prod.outlook.com (2603:1096:300:67::17) by TYZPR06MB4127.apcprd06.prod.outlook.com (2603:1096:400:6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.28; Tue, 21 Nov 2023 08:47:01 +0000 Received: from PS2PR06MB3509.apcprd06.prod.outlook.com ([fe80::863b:f0a1:3066:24d]) by PS2PR06MB3509.apcprd06.prod.outlook.com ([fe80::863b:f0a1:3066:24d%6]) with mapi id 15.20.7002.027; Tue, 21 Nov 2023 08:47:01 +0000 From: Wu Bo To: Alasdair Kergon , Mike Snitzer , Mikulas Patocka Cc: dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org, Wu Bo , Wu Bo Subject: [PATCH 2/2] dm verity: don't verity if readahead failed Date: Tue, 21 Nov 2023 01:55:29 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI1PR02CA0047.apcprd02.prod.outlook.com (2603:1096:4:1f5::15) To PS2PR06MB3509.apcprd06.prod.outlook.com (2603:1096:300:67::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PS2PR06MB3509:EE_|TYZPR06MB4127:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d432032-10af-4a18-d72e-08dbea6e6d88 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /HawtCY3vSSeuxSf5+LAIyoTq+P71LClA+OTpQH1f2qBLAqCx5mOI6naWBaza8eMt0tVTARjE5iI/87/MsVvxLLnD2eC/SXuAh3Z59WuWssj8zv0AUZrVbC73iJ0xoP8uo4n1VneSgsq3wp3SvBjYm99oZAX//D72zV62O7wd5npQodt/POoh/ZX8t8OAdF3ssaY+InVlnozvljby1uSNsMCbw+mKeoC0+Gb3Q9H4TyDU/QZv7Yl0CY1wMg/AFiHq9NL+75kh03o7vdp4Pww0jb0ivZguQbTE9VF+0m3Yn0JSs2GtiIQbaMzmt1WNtOjSo4LLUesSrcMMZRCrLtuRrLumHSPaCTF21vdeKtj4KlUPnjh2HHLMdItIO+fE6bh/8y3ReJvwSVpXxCfgo01P0ZCVOxmomjB0wAZqd2OCfWOjB7RlTUx8uevzuXu1Y4mP813c8s1EjDwDTW9qs+iqz2frlEmUQg6+5BOwRBf/0OLPJLZetSaARuJUm2yyFHY8UEhCO76nvDCiXWKB16pkfqI98Ha9Nw0nM0/lU2SUI/+aX/rESVTNo5unQk3L1McZfKihk6g9IZ1pRfqHbZ6FQGZBe2ljnYUb97ri0+4zHdagxJcgBmDeGdOEx/PY0RE X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PS2PR06MB3509.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(376002)(39850400004)(136003)(396003)(366004)(230922051799003)(451199024)(64100799003)(186009)(1800799012)(316002)(110136005)(54906003)(66946007)(66476007)(66556008)(36756003)(52116002)(6512007)(6666004)(6506007)(2616005)(26005)(107886003)(6486002)(478600001)(38350700005)(38100700002)(83380400001)(86362001)(2906002)(5660300002)(8936002)(4326008)(8676002)(41300700001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?kHQxOKA//8tBgx5jtF6Nh5l34U+UqkCdi3+Hl95+xS5aLZ7LWjUCsSPRAMRc?= =?us-ascii?Q?fkShwsMuz5H20H4KjP3Gcn93q4uLXdCH9DPbpdWmp7lHw4LWPk2b0fm2QJtv?= =?us-ascii?Q?zD9mjSkQ32c6Mcs0lnbmQgHULXlDXmIRVL4lHmrCOXO2mRnJy6lnLVM1sbwF?= =?us-ascii?Q?wPD0JWz+SAyD+j/mIrjao/tVeJtw9TcXsznG0kKokJFVdtzRTJXi+L5wZw/z?= =?us-ascii?Q?RhCtdbb+XhHD8GSE1roBWduVn76Mmz2VKLQp1jxf9wvwWwXqoF4+cA9ibTYv?= =?us-ascii?Q?FmqpSdRLJdYa4oF4d1RYb6aytVrjNiAmYnO28tqPQrgYneZJalxQ1mr6vWt3?= =?us-ascii?Q?AMmYePXma896htF9i1SjaxAhmchEJeoj5hH2OWz88BE17kRJtI73pFI1yiff?= =?us-ascii?Q?QVydgbYGiBuwHnZgcVfwY3/DcqUFljnGpU2M/VaEZ7B40s0puD5cXsyDA4gF?= =?us-ascii?Q?ApVgPsuHsoCFaDEBymn/oArDNv2G8+VkguhaqQg+QRTPZ5Kpw/kILYJs86UI?= =?us-ascii?Q?yq8JWAKGhK2A3JWcC073NKOGs5VoEu2BAgV8pnO+bWNkbfFo3mYO/DzO2r6M?= =?us-ascii?Q?CEQ9I0t3ytICNs6JaF00jC93qjUzFvSdS3HcyWUPYSqhtyBOPROPt0xTw8wN?= =?us-ascii?Q?nD2daCjxhw8oirRtzMb/ArCtEk2LtyfTYWVPp8UkmWYT0dfAk671rDQACpBw?= =?us-ascii?Q?vTr4+KVpcC2A3xwAWpACwrcZX631jDEMf3LFq6vdDA10cLtXt7V3VAHxZMda?= =?us-ascii?Q?bN1lNmz/mdBslq6OOVzkOp3KjZ0770bvZDIq6CQssY6hagLQXyTzkFCO20jb?= =?us-ascii?Q?HYgtyuX5a3rAr7zKHlyQBAm5T+sDq2/AVC3aZiLZeGJZQpi62UrowRZnygIp?= =?us-ascii?Q?XqUd6HanZqW351FZ/tS4gHViQJhZ6PK85N+cxWfONpuj9aL5wQ6JsMZnAM+p?= =?us-ascii?Q?OXlosaW+AhH3CxpAgRFrTzaayv53cxaRrIQrLECI073QxpZ5ViVQW9tksVuG?= =?us-ascii?Q?nDx2KWb4QVjkzTxROoZG/8con0WEYBLaYi4eQCyyZWQr40ikrZ5dxm2iQquS?= =?us-ascii?Q?66/1DD6KLpgshaOnM4n3pjQp6mwXfIRBkD34nKYFmejWtatdhXWNl5LjK1Lw?= =?us-ascii?Q?aAA85Dd0CokY4V50tOlOvB0vvNwPkJON48K5IEvyUHeAKc7SyqFeo6E8Bod1?= =?us-ascii?Q?36oxaFAiwvUVCOA+AJGrtyadRCkETxIYChMno+hwQ63/HXKD4eQOoKldt6Zq?= =?us-ascii?Q?YNjIUdnkFOqA9uXQy8iVixpZ1iAMVvWq3OsCHkNSj76WzL1ANNDD4ffA5M9i?= =?us-ascii?Q?pFcO4aQj3D+QBTAixR7VDL81j7vn3juUgDKslxKtLEpztzLV1efEPlhGLUpt?= =?us-ascii?Q?KvKTVQj2xBpOnlohJ84A020swExpsW9CgPruddv1Aoi9qwe8EhZo9i0ouJLj?= =?us-ascii?Q?81UZUYn7ZjBrkVu3HyvOjiE+cdCLcDd04ZatMZlBnSSuuxAmhZQFtLJk1kJC?= =?us-ascii?Q?Am78i+yjx4x0cR3IoFiiIVrYZGKN8pUWykP3lEU88nZQKEpUDHLgwnpblnSu?= =?us-ascii?Q?KWXzEpj2R9/E8YcTcB7PqjuG4Mb8quhoOWu1bivd?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d432032-10af-4a18-d72e-08dbea6e6d88 X-MS-Exchange-CrossTenant-AuthSource: PS2PR06MB3509.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2023 08:47:01.0043 (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: S0jWMWJjjtI5Yfp/n9IkXjl6gxZ4TG9i+WCBbtZG9tUxVI7owFufb3B1AOfrpOjs7PlE/7YO81PzSQZwzp0yNw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB4127 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 21 Nov 2023 00:47:45 -0800 (PST) We found an issue under Android OTA scenario that many BIOs have to do FEC where the data under dm-verity is 100% complete and no corruption. Android OTA has many dm-block layers, from upper to lower: dm-verity dm-snapshot dm-origin & dm-cow dm-linear ufs Dm tables have to change 2 times during Android OTA merging process. When doing table change, the dm-snapshot will be suspended for a while. During this interval, we found there are many readahead IOs are submitted to dm_verity from filesystem. Then the kverity works are busy doing FEC process which cost too much time to finish dm-verity IO. And cause system stuck. We add some debug log and find that each readahead IO need around 10s to finish when this situation occurred. Because here has a IO amplification: dm-snapshot suspend erofs_readahead // 300+ io is submitted dm_submit_bio (dm_verity) dm_submit_bio (dm_snapshot) bio return EIO bio got nothing, it's empty verity_end_io verity_verify_io forloop range(0, io->n_blocks) // each io->nblocks ~= 20 verity_fec_decode fec_decode_rsb fec_read_bufs forloop range(0, v->fec->rsn) // v->fec->rsn = 253 new_read submit_bio (dm_snapshot) end loop end loop dm-snapshot resume Readahead BIO got nothing during dm-snapshot suspended. So all of them will do FEC. Each readahead BIO need to do io->n_blocks ~= 20 times verify. Each block need to do fec, and every block need to do v->fec->rsn = 253 times read. So during the suspend interval(~200ms), 300 readahead BIO make 300*20*253 IOs on dm-snapshot. As readahead IO is not required by user space, and to fix this issue, I think it would be better to pass it to upper layer to handle it. Signed-off-by: Wu Bo --- drivers/md/dm-verity-target.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c index 42b2483eb08c..d242e50ec869 100644 --- a/drivers/md/dm-verity-target.c +++ b/drivers/md/dm-verity-target.c @@ -668,7 +668,9 @@ static void verity_end_io(struct bio *bio) verity_fec_init_io(io); if (bio->bi_status && - (!verity_fec_is_enabled(io->v) || verity_is_system_shutting_down())) { + (!verity_fec_is_enabled(io->v) || + verity_is_system_shutting_down() || + (bio->bi_opf & REQ_RAHEAD))) { verity_finish_io(io, bio->bi_status); return; } -- 2.25.1