From patchwork Sat Sep 7 19:28:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?M=C3=A5rten_Lindahl?= X-Patchwork-Id: 1982167 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=vlgdyQyG; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=axis.com header.i=@axis.com header.a=rsa-sha256 header.s=selector1 header.b=jdy6c1kt; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X1NT35F5nz1y1H for ; Sun, 8 Sep 2024 05:29:25 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:Message-ID:MIME-Version:Subject: Date:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=nakwO7BHCdK/VFmUObe6+gHD75DFEaCKxi5VJN5+wgw=; b=vlgdyQyG4lGDRi VsSyszw7YJAPCZf5z9gBz4qJNmRmCkLEw1Uwv8Qt3IKU9OLOCO7jYw52SnJj3imt/uCgANkYr2bDJ osYDswlbjSnAgbGdq9ZRFJYFRP0LC4ekQ2+ib6e+g7Zn/xDgbpszRi9qjHI4+7mbLvERcVeEJDMN/ 49HCsgSeKjXNAl498Rp2syi/XIIx8EENaGUdxv8+u+R90IWnZmj4Be8lBRSSYDplAVAXJMi0oxNbJ QdMT/cE6L5GY8fjJyT0E86r6Zfpyn1DndI+H+1JER1eQvFa9mCzh/uSh3wKn/qre4eFUufUmckG3f qq/56/EwhBDwitZX9QOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sn17E-0000000FXzB-0Sv1; Sat, 07 Sep 2024 19:29:00 +0000 Received: from mail-northeuropeazlp170120003.outbound.protection.outlook.com ([2a01:111:f403:c200::3] helo=DU2PR03CU002.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sn179-0000000FXyM-0c33 for linux-mtd@lists.infradead.org; Sat, 07 Sep 2024 19:28:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VAbbJz4nbBnoEu53Dt400prUgJPxDxJDCuFoV1WFlHzcsQjMylu8XPi0jO0rl1x5/gI90+3UjwoAYyWExnwofSx4ge3+7VJd0t+fcyQz0Prt52FF8cpFz4wwQqQvKSaNp6sZ9U8UerIXO3p4jLaIA2VZ+hn/NKSVXV4CvOs8scxBrvKSMsdkGfrAbWVu68LvQbuO/H9i3L2IhOdNt9ybW1OGDCV0ZPaX0/89Q85T24EAFYawLhADNfvw6ru+sTBDMplj8UH6/NR83lA7HBElznZvxPDBWBJh8lDOFEKWg/gWSmaFLJs6wBHwEwOc4D6WKTI7yxp3Qxg+g9UQeFoJig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=WjE3uT3yTixY1vg83W/16AeCADhYhnmlLOR0uz8enmQ=; b=qxSIxuL5A9JNm321l/q0pvgKitxNujbp6ZP0+M4XRdvmtXj9ZPRpVnKzhTFB9fMi+0ZGY+z2rLZ/79fZpsKkIdRPaeq5aS0yG8HZJ0z8bHH5wBiyvLZaslIC1hat/pa0BrsKRgQSsg9Ok5XRTUoWcvy4d7ZYlmRy9t/Mj69dG7d1nn5yH33w8rktGwToDFrhW8K408NGEPpW5QKKotpniBpRvkRiYZDG5JZ72phqVif9QlAELWoBUC0T89QtCQrb03oCLtz/0IMML3pxhHDbRU8ZesHoB4gA/pzwrgZUOmY/wupUd9WR+0IZfyL4Zp8NpODlpV5AbgXVnapgSYq4xQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=bootlin.com smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WjE3uT3yTixY1vg83W/16AeCADhYhnmlLOR0uz8enmQ=; b=jdy6c1ktVwLdPoVj4813gV/zRTN4f8fbFwPyNsbUNfN7F6rEwCfOA4jvSahbLsAIX4E8/HICvg1tvurBYalEe91s31rP6Pl+qZnx3erd5NUYTqX5JmmGdLtIjnq4k0jMH9lyrfd6oe2qn2rMfaLokcs0YIs/4/GvQ/uxcHTBU0k= Received: from AS8PR04CA0200.eurprd04.prod.outlook.com (2603:10a6:20b:2f3::25) by AS8PR02MB6680.eurprd02.prod.outlook.com (2603:10a6:20b:259::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.17; Sat, 7 Sep 2024 19:28:45 +0000 Received: from AM2PEPF0001C717.eurprd05.prod.outlook.com (2603:10a6:20b:2f3:cafe::74) by AS8PR04CA0200.outlook.office365.com (2603:10a6:20b:2f3::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.22 via Frontend Transport; Sat, 7 Sep 2024 19:28:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by AM2PEPF0001C717.mail.protection.outlook.com (10.167.16.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Sat, 7 Sep 2024 19:28:45 +0000 Received: from se-mail01w.axis.com (10.20.40.7) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sat, 7 Sep 2024 21:28:43 +0200 Received: from se-intmail01x.se.axis.com (10.0.5.60) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Sat, 7 Sep 2024 21:28:43 +0200 Received: from pc42775-2107.se.axis.com (pc42775-2107.se.axis.com [10.94.129.29]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id A14C2137; Sat, 7 Sep 2024 21:28:43 +0200 (CEST) Received: by pc42775-2107.se.axis.com (Postfix, from userid 21033) id 9E1BE20C9556; Sat, 7 Sep 2024 21:28:43 +0200 (CEST) From: =?utf-8?q?M=C3=A5rten_Lindahl?= Date: Sat, 7 Sep 2024 21:28:26 +0200 Subject: [PATCH] ubi: wl: Close down wear-leveling before nand is suspended MIME-Version: 1.0 Message-ID: <20240907-ubi-wl-race-v1-1-6f7f5e0aea7b@axis.com> X-B4-Tracking: v=1; b=H4sIAFmp3GYC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIxMDSwNj3dKkTN3yHN2ixORU3VQDY8uUJAtLQyOjNCWgjoKi1LTMCrBp0bG 1tQD9kKcgXQAAAA== To: Richard Weinberger , Zhihao Cheng , Miquel Raynal , "Vignesh Raghavendra" CC: , , , =?utf-8?q?M=C3=A5rten_Lindahl?= X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1725737323; l=5829; i=marten.lindahl@axis.com; s=20230329; h=from:subject:message-id; bh=uwMnOkdHQPy6aqz4lVLbACX/PkFfeI6SxzFDEdfnO5s=; b=TBnXo201oKQKFwgrSCmEI2eXZj83wMCURwirVepxXrSOpVyWaK9oT5MYWSyKRGpdIo+uANfxF DG/NPTfjFk3CNHaYX40HwtNh1G2iN0F273nqU8O5U9eZsf7O9XZwS1S X-Developer-Key: i=marten.lindahl@axis.com; a=ed25519; pk=JfbjqFPJnIDIQOkJBeatC8+S3Ax3N0RIdmN+fL3wXgw= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C717:EE_|AS8PR02MB6680:EE_ X-MS-Office365-Filtering-Correlation-Id: 42cd151e-7243-46fc-8b66-08dccf734a7f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?NYF33E3fAlfBPzJ77TkmPZiE3eDyLyw?= =?utf-8?q?RKTnwU6+x2BAPX9rgRU2ZWcY38OXhgFWhWTHYxZgc/XVCWSkbK9v0APSTHbxc/aDn?= =?utf-8?q?j5zkRGLXlALsbxyoNFRMwyKatBrF6snhDVYPng1eHdMV9GwQTtDao+AiSdLRxSoOk?= =?utf-8?q?JuIHxBGq99VN7+0cJrioH9KW9Ddv58sAdgA4iz+35dP525FKx0LCYRGhPXZSGShBU?= =?utf-8?q?XnE3xyKiGY6acSqSw+1lB9CSJDr3o5ZnYZ+gSCHWrm72jq84tTd977ZyEbn6xndb2?= =?utf-8?q?l0pqFpqSyE8oh9CtNr8RBfC3RoEhUOveOnTGt4i4y0f/ds7L4eZCpj3pCH61Xir8U?= =?utf-8?q?NyAhXAg+zHqJbIPDPCjwa93yoKihRSVRxIpadeBV8TAzgn3jIVjhwOaxiSqsGN1LU?= =?utf-8?q?U22NFHH/I1Cdh67GFnxWLB6TAbceaUGf1AFTqjkbryUS1nCFyxmN9WVsLxgk5lXHK?= =?utf-8?q?7FRjZeVvjC4EylHDN809Nb040ApWBz6WVnr2oW6a88bOewz2wWdt5OqssnklbGjzZ?= =?utf-8?q?lidNwHoG3NVqQUPG8/AD22836CJQRND3Seg4LDfrn5I6Y+m1ehsXgWr3O7vAotGjs?= =?utf-8?q?BUKK7W+gvtWRrGImVAqVHifT6v7Ic2P7+so8eifc710X1wjIWcrqHoZ/9Wfnye8qR?= =?utf-8?q?kqtZkINTBs9jxYR/1Rj7Ztt5YzTDRIv60loZQ8+JdIAcDIwEaA/U2OqYWH1QA0xYv?= =?utf-8?q?yll+Yg+dEk6taifIlRhMkDHOF8bilVHB6jLCRjU5gqA7qUwq+doOQaHRLovopE/V5?= =?utf-8?q?w+3HXEqWE5ucWblA4l5tn4zAPm6ifkyqyXlmHaf8BfxHKEZcopQqcY2JhqDl80YO1?= =?utf-8?q?bRdZXzJv8I0BZPF/VH6WHTGPEVtzJNYyoa1U8Zw6hzcRwFks98DXEcqhVP3ZCD8BY?= =?utf-8?q?N8aUZm0m1NQLlY4O8slWuRH5at0edeilcH2jsIORhRoZUU5bmJ9DnjRbX0LpcRrO4?= =?utf-8?q?gIhIxtBDk4VdoshQe5GjYdVZuz3dLTeLMvZjf4dDMvFvzySA1ULA1iMLPIEgZTvsw?= =?utf-8?q?M1vjWpzVt3iLS/PBt1T5dG65cGs8j6HugwGeU444GGBCiSXNKZtqcwWaT0PZ/X4D9?= =?utf-8?q?xsiwQsPID/Qqgiucsrxw761YykoHiwsxQaIlUaWGTHIi9415dSl8yM+D9BlPF7WYP?= =?utf-8?q?vG3fNY1X+vRKUC1PghA0rpbbRPMgX7K4iJ4aXk1cf+kBV3uitEHW63vKCOycd2agc?= =?utf-8?q?JckJNL9XXnBdZDMms7r67AW4kmLZxTdYmCAL4mHwgG/brTj4H9VJFRDfK9PDNxYq3?= =?utf-8?q?qug1sTxgKsqmT04QKAa8fPc/4FePbiMjS4aH/EvACQd087y9zzQHW/D/Xw05FoXeH?= =?utf-8?q?56IA14vRDVFagPLSBbs/relFUqAGCSJ0B/8L+QtqkGZyKnY5EsVUWeZ9rNWS3UFHP?= =?utf-8?q?Jv24gE28kEw?= X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2024 19:28:45.7360 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 42cd151e-7243-46fc-8b66-08dccf734a7f X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: AM2PEPF0001C717.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR02MB6680 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240907_122855_633953_CA35A0BB X-CRM114-Status: GOOD ( 18.69 ) X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: If a reboot/shutdown signal with double force (-ff) is triggered when the erase worker or wear-leveling worker function runs we may end up in a race condition since the MTD device gets a reboot notifi [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 ARC_VALID Message has a valid ARC signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 ARC_SIGNED Message has a ARC signature -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org If a reboot/shutdown signal with double force (-ff) is triggered when the erase worker or wear-leveling worker function runs we may end up in a race condition since the MTD device gets a reboot notification and suspends the nand flash before the erase or wear-leveling is done. This will reject all accesses to the flash with -EBUSY. Sequence for the erase worker function: systemctl reboot -ff ubi_thread do_work __do_sys_reboot blocking_notifier_call_chain mtd_reboot_notifier nand_shutdown nand_suspend __erase_worker ubi_sync_erase mtd_erase nand_erase_nand # Blocked by suspended chip nand_get_device => EBUSY Similar sequence for the wear-leveling function: systemctl reboot -ff ubi_thread do_work __do_sys_reboot blocking_notifier_call_chain mtd_reboot_notifier nand_shutdown nand_suspend wear_leveling_worker ubi_eba_copy_leb ubi_io_write mtd_write nand_write_oob # Blocked by suspended chip nand_get_device => EBUSY systemd-shutdown[1]: Rebooting. ubi0 error: ubi_io_write: error -16 while writing 2048 bytes to PEB CPU: 1 PID: 82 Comm: ubi_bgt0d Kdump: loaded Tainted: G O (unwind_backtrace) from [<80107b9f>] (show_stack+0xb/0xc) (show_stack) from [<8033641f>] (dump_stack_lvl+0x2b/0x34) (dump_stack_lvl) from [<803b7f3f>] (ubi_io_write+0x3ab/0x4a8) (ubi_io_write) from [<803b817d>] (ubi_io_write_vid_hdr+0x71/0xb4) (ubi_io_write_vid_hdr) from [<803b6971>] (ubi_eba_copy_leb+0x195/0x2f0) (ubi_eba_copy_leb) from [<803b939b>] (wear_leveling_worker+0x2ff/0x738) (wear_leveling_worker) from [<803b86ef>] (do_work+0x5b/0xb0) (do_work) from [<803b9ee1>] (ubi_thread+0xb1/0x11c) (ubi_thread) from [<8012c113>] (kthread+0x11b/0x134) (kthread) from [<80100139>] (ret_from_fork+0x11/0x38) Exception stack(0x80c43fb0 to 0x80c43ff8) ... ubi0 error: ubi_dump_flash: err -16 while reading 2048 bytes from PEB ubi0 error: wear_leveling_worker: error -16 while moving PEB 246 to PEB ubi0 warning: ubi_ro_mode.part.0: switch to read-only mode ... ubi0 error: do_work: work failed with error code -16 ubi0 error: ubi_thread: ubi_bgt0d: work failed with error code -16 ... Kernel panic - not syncing: Software Watchdog Timer expired Add a reboot notification for the ubi/wear-leveling to shutdown any potential flash work actions before the nand is suspended. Signed-off-by: MÃ¥rten Lindahl --- drivers/mtd/ubi/ubi.h | 2 ++ drivers/mtd/ubi/wl.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) --- base-commit: 431c1646e1f86b949fa3685efc50b660a364c2b6 change-id: 20240903-ubi-wl-race-e039db89122f Best regards, diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index 1c9e874e8ede..4a48ed0ecdb6 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h @@ -549,6 +549,7 @@ struct ubi_debug_info { * @peb_buf: a buffer of PEB size used for different purposes * @buf_mutex: protects @peb_buf * @ckvol_mutex: serializes static volume checking when opening + * @wl_reboot_notifier: close all wear-leveling work before reboot * * @dbg: debugging information for this UBI device */ @@ -651,6 +652,7 @@ struct ubi_device { void *peb_buf; struct mutex buf_mutex; struct mutex ckvol_mutex; + struct notifier_block wl_reboot_notifier; struct ubi_debug_info dbg; }; diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index a357f3d27f2f..b3484e9e969c 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c @@ -89,6 +89,7 @@ #include #include #include +#include #include "ubi.h" #include "wl.h" @@ -127,6 +128,8 @@ static int self_check_in_wl_tree(const struct ubi_device *ubi, struct ubi_wl_entry *e, struct rb_root *root); static int self_check_in_pq(const struct ubi_device *ubi, struct ubi_wl_entry *e); +static int ubi_wl_reboot_notifier(struct notifier_block *n, + unsigned long state, void *cmd); /** * wl_tree_add - add a wear-leveling entry to a WL RB-tree. @@ -1943,6 +1946,13 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai) if (!ubi->ro_mode && !ubi->fm_disabled) ubi_ensure_anchor_pebs(ubi); #endif + + if (!ubi->wl_reboot_notifier.notifier_call) { + ubi->wl_reboot_notifier.notifier_call = ubi_wl_reboot_notifier; + ubi->wl_reboot_notifier.priority = 1; /* Higher than MTD */ + register_reboot_notifier(&ubi->wl_reboot_notifier); + } + return 0; out_free: @@ -1988,6 +1998,17 @@ void ubi_wl_close(struct ubi_device *ubi) kfree(ubi->lookuptbl); } +static int ubi_wl_reboot_notifier(struct notifier_block *n, + unsigned long state, void *cmd) +{ + struct ubi_device *ubi; + + ubi = container_of(n, struct ubi_device, wl_reboot_notifier); + ubi_wl_close(ubi); + + return NOTIFY_DONE; +} + /** * self_check_ec - make sure that the erase counter of a PEB is correct. * @ubi: UBI device description object