From patchwork Sun Jun 13 11:30:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhihao Cheng X-Patchwork-Id: 1491423 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: 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=xNcegmeo; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G2sd71pPfz9sWk for ; Sun, 13 Jun 2021 21:22:51 +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:MIME-Version:Message-ID:Date:Subject:CC :To: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=SHFFJBtrHtLQaZ9JwaV71jbafahMIN5RJKfMaIvmzfQ=; b=xNcegmeoAxLRzL /GcIVYp+DJbAkhJsqHcJrkLRr9DvfxVfIfIyUMpXH1RnslLTykZp8LCqD/PGTuqnDa2fG1eG0yfSu 0Dw14iPDjOkRJ1+4M9kQ2ddsiMo7mPND7yP/alD4wMLetyMyuePIoaaqYddVdZGVsRQ3HLQjNXwWK Jp4W5N4legmStUxjd3lZmUB8gQTLD/n2ptU3KNP+pvA7nBqfdNC3wJ93220HDiVm6o8F48mZ75qKZ /KIyM9WhNBDseC1JE/nOpYEJee1pL74PfZ7Cy/sztOLsL5l14ZqT6AuQdycwke6YNyY8ipqQPE1wG 86oxaFVMgN3nR9Wjx86A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lsOC0-00AISP-Lv; Sun, 13 Jun 2021 11:22:16 +0000 Received: from szxga03-in.huawei.com ([45.249.212.189]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lsOBy-00AIRn-C4 for linux-mtd@lists.infradead.org; Sun, 13 Jun 2021 11:22:15 +0000 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4G2sWq6ZQqz6x0v; Sun, 13 Jun 2021 19:18:15 +0800 (CST) Received: from dggema761-chm.china.huawei.com (10.1.198.203) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Sun, 13 Jun 2021 19:22:11 +0800 Received: from huawei.com (10.175.127.227) by dggema761-chm.china.huawei.com (10.1.198.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Sun, 13 Jun 2021 19:22:11 +0800 From: Zhihao Cheng To: , , CC: , , , Subject: [PATCH 0/6] Fix deadlock in ftl formating on mtd Date: Sun, 13 Jun 2021 19:30:29 +0800 Message-ID: <20210613113035.2329421-1-chengzhihao1@huawei.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggema761-chm.china.huawei.com (10.1.198.203) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210613_042214_594987_E276E6F5 X-CRM114-Status: UNSURE ( 4.32 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) 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: There is an AA-deadlock problem while formating mtd device to generate a ftl device. Fix it by reverting "mtd: allow to unload the mtdtrans module if its block devices aren't open" recommended in [1]. Content analysis details: (-2.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [45.249.212.189 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 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 There is an AA-deadlock problem while formating mtd device to generate a ftl device. Fix it by reverting "mtd: allow to unload the mtdtrans module if its block devices aren't open" recommended in [1]. [<0>] blktrans_open+0x47/0x340 LOCK(mtd_table_mutex) [<0>] __blkdev_get+0x5b/0x3e0 [<0>] blkdev_get_by_dev+0x18f/0x370 [<0>] __device_add_disk+0x2db/0x700 [<0>] device_add_disk+0x17/0x20 [<0>] add_mtd_blktrans_dev+0x39e/0x6d0 [<0>] ftl_add_mtd+0x792/0x908 [ftl] [<0>] register_mtd_blktrans+0xfb/0x170 LOCK(mtd_table_mutex) [<0>] ftl_tr_init+0x18/0x1000 [ftl] [<0>] do_one_initcall+0x71/0x330 [<0>] do_init_module+0xa6/0x350 [1] http://lists.infradead.org/pipermail/linux-mtd/2017-March/072899.html Zhihao Cheng (6): Revert "mtd: blkdevs: fix potential deadlock + lockdep warnings" Revert "mtd: fix: avoid race condition when accessing mtd->usecount" Revert "mtd: mtd_blkdevs: don't increase 'open' count on error path" Revert "mtd: mtd_blkdevs: fix error path in blktrans_open" Revert "mtd: Remove redundant mutex from mtd_blkdevs.c" Revert "mtd: allow to unload the mtdtrans module if its block devices aren't open" drivers/mtd/mtd_blkdevs.c | 77 +++++++++++++++------------------------ 1 file changed, 30 insertions(+), 47 deletions(-)