Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1820093/?format=api
{ "id": 1820093, "url": "http://patchwork.ozlabs.org/api/patches/1820093/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-mtd/patch/c9a4bb9e11c0ecd6de83250d27dc30e25923cb25.1691717480.git.daniel@makrotopia.org/", "project": { "id": 3, "url": "http://patchwork.ozlabs.org/api/projects/3/?format=api", "name": "Linux MTD development", "link_name": "linux-mtd", "list_id": "linux-mtd.lists.infradead.org", "list_email": "linux-mtd@lists.infradead.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<c9a4bb9e11c0ecd6de83250d27dc30e25923cb25.1691717480.git.daniel@makrotopia.org>", "list_archive_url": null, "date": "2023-08-11T01:38:05", "name": "[v4,6/8] mtd: ubi: introduce pre-removal notification for UBI volumes", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "4428aec1cdbfd727917c5d267aa453b13c2e66b7", "submitter": { "id": 64091, "url": "http://patchwork.ozlabs.org/api/people/64091/?format=api", "name": "Daniel Golle", "email": "daniel@makrotopia.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-mtd/patch/c9a4bb9e11c0ecd6de83250d27dc30e25923cb25.1691717480.git.daniel@makrotopia.org/mbox/", "series": [ { "id": 368347, "url": "http://patchwork.ozlabs.org/api/series/368347/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-mtd/list/?series=368347", "date": "2023-08-11T01:36:37", "name": "mtd: ubi: allow UBI volumes to provide NVMEM", "version": 4, "mbox": "http://patchwork.ozlabs.org/series/368347/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1820093/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1820093/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n spf=none (no SPF record) smtp.mailfrom=lists.infradead.org\n (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;\n envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n receiver=<UNKNOWN>)", "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=lists.infradead.org header.i=@lists.infradead.org\n header.a=rsa-sha256 header.s=bombadil.20210309 header.b=fTzHWVIk;\n\tdkim-atps=neutral" ], "Received": [ "from bombadil.infradead.org (bombadil.infradead.org\n [IPv6:2607:7c80:54:3::133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4RMRKD2QNmz1yf2\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 11 Aug 2023 11:38:56 +1000 (AEST)", "from localhost ([::1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux))\n\tid 1qUH6a-0095K8-0o;\n\tFri, 11 Aug 2023 01:38:20 +0000", "from pidgin.makrotopia.org ([185.142.180.65])\n\tby bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux))\n\tid 1qUH6X-0095Ix-2Z\n\tfor linux-mtd@lists.infradead.org;\n\tFri, 11 Aug 2023 01:38:19 +0000", "from local\n\tby pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256)\n\t (Exim 4.96)\n\t(envelope-from <daniel@makrotopia.org>)\n\tid 1qUH6S-00055e-0g;\n\tFri, 11 Aug 2023 01:38:12 +0000" ], "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20210309; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:\n\tMessage-ID:Subject:To:From:Date:Reply-To:Cc:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=+haGevLnXitPPCIQSQy2aWPrySFEsl1rJrnnVIurCoA=; b=fTzHWVIkhGhvQ+\n\taDf4tC235tkZbu+Ygjb/P9biXw2V1+853qzVQbgaRA6L6gRQ4WA1SwZZx/H2OlkML54HJyOrVdVul\n\t0/bQEzaqgcO8BGKnd4kVFr3zpgROCOTXViUriT42EZNJ1sMOyl++qNcwmRw23ktALj/ushVmYX9dy\n\t9Oq7C4E43L5ZY6/Pv3ksH4+/45cBJurafjcH1EcDFowJG+9ELoGxz3my0mv6jYcAQzUFJKqcjnnuH\n\tprnXPDyjkbiK4dsNAHgJq17MHOtsQ0fLAGyrC/TVlM7uS3XsoHXMDkYZ7vXBmK8fAHNMHV394tDeu\n\t/8IYfFxs92uClwGU9XXA==;", "Date": "Fri, 11 Aug 2023 02:38:05 +0100", "From": "Daniel Golle <daniel@makrotopia.org>", "To": "Randy Dunlap <rdunlap@infradead.org>,\n\tMiquel Raynal <miquel.raynal@bootlin.com>,\n\tRichard Weinberger <richard@nod.at>,\n\tVignesh Raghavendra <vigneshr@ti.com>,\n\tRob Herring <robh+dt@kernel.org>,\n\tKrzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,\n\tConor Dooley <conor+dt@kernel.org>,\n\tDaniel Golle <daniel@makrotopia.org>, linux-mtd@lists.infradead.org,\n\tdevicetree@vger.kernel.org, linux-kernel@vger.kernel.org", "Subject": "[PATCH v4 6/8] mtd: ubi: introduce pre-removal notification for UBI\n volumes", "Message-ID": "\n <c9a4bb9e11c0ecd6de83250d27dc30e25923cb25.1691717480.git.daniel@makrotopia.org>", "References": "<cover.1691717480.git.daniel@makrotopia.org>", "MIME-Version": "1.0", "Content-Disposition": "inline", "In-Reply-To": "<cover.1691717480.git.daniel@makrotopia.org>", "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ", "X-CRM114-CacheID": "sfid-20230810_183817_843470_E316C264 ", "X-CRM114-Status": "GOOD ( 18.00 )", "X-Spam-Score": "0.0 (/)", "X-Spam-Report": "Spam detection software,\n running on the system \"bombadil.infradead.org\",\n has NOT identified this incoming email as spam. The original\n message has been attached to this so you can view it or label\n similar future email. If you have any questions, see\n the administrator of that system for details.\n Content preview: Introduce a new notification type UBI_VOLUME_SHUTDOWN to\n inform\n users that a volume is just about to be removed. This is needed because\n users\n (such as the NVMEM subsystem) expect that at the time thei [...]\n Content analysis details: (0.0 points, 5.0 required)\n pts rule name description\n ---- ----------------------\n --------------------------------------------------\n -0.0 SPF_PASS SPF: sender matches SPF record\n 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record", "X-BeenThere": "linux-mtd@lists.infradead.org", "X-Mailman-Version": "2.1.34", "Precedence": "list", "List-Id": "Linux MTD discussion mailing list <linux-mtd.lists.infradead.org>", "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/linux-mtd>,\n <mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe>", "List-Archive": "<http://lists.infradead.org/pipermail/linux-mtd/>", "List-Post": "<mailto:linux-mtd@lists.infradead.org>", "List-Help": "<mailto:linux-mtd-request@lists.infradead.org?subject=help>", "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n <mailto:linux-mtd-request@lists.infradead.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Sender": "\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>", "Errors-To": "linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org" }, "content": "Introduce a new notification type UBI_VOLUME_SHUTDOWN to inform users\nthat a volume is just about to be removed.\nThis is needed because users (such as the NVMEM subsystem) expect that\nat the time their removal function is called, the parenting device is\nstill available (for removal of sysfs nodes, for example, in case of\nNVMEM which otherwise WARNs on volume removal).\n\nSigned-off-by: Daniel Golle <daniel@makrotopia.org>\n---\n drivers/mtd/ubi/block.c | 26 ++++++++++++++++++++++++++\n drivers/mtd/ubi/build.c | 7 ++++++-\n drivers/mtd/ubi/vmt.c | 5 +++++\n include/linux/mtd/ubi.h | 2 ++\n 4 files changed, 39 insertions(+), 1 deletion(-)", "diff": "diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c\nindex 99b5f502c9dbc..1d5148371991b 100644\n--- a/drivers/mtd/ubi/block.c\n+++ b/drivers/mtd/ubi/block.c\n@@ -533,6 +533,29 @@ static int ubiblock_resize(struct ubi_volume_info *vi)\n \treturn 0;\n }\n \n+static int ubiblock_shutdown(struct ubi_volume_info *vi)\n+{\n+\tstruct ubiblock *dev;\n+\tstruct gendisk *disk;\n+\tint ret = 0;\n+\n+\tmutex_lock(&devices_mutex);\n+\tdev = find_dev_nolock(vi->ubi_num, vi->vol_id);\n+\tif (!dev) {\n+\t\tret = -ENODEV;\n+\t\tgoto out_unlock;\n+\t}\n+\tdisk = dev->gd;\n+\n+out_unlock:\n+\tmutex_unlock(&devices_mutex);\n+\n+\tif (!ret)\n+\t\tblk_mark_disk_dead(disk);\n+\n+\treturn ret;\n+};\n+\n static bool\n match_volume_desc(struct ubi_volume_info *vi, const char *name, int ubi_num, int vol_id)\n {\n@@ -624,6 +647,9 @@ static int ubiblock_notify(struct notifier_block *nb,\n \tcase UBI_VOLUME_REMOVED:\n \t\tubiblock_remove(&nt->vi, true);\n \t\tbreak;\n+\tcase UBI_VOLUME_SHUTDOWN:\n+\t\tubiblock_shutdown(&nt->vi);\n+\t\tbreak;\n \tcase UBI_VOLUME_RESIZED:\n \t\tubiblock_resize(&nt->vi);\n \t\tbreak;\ndiff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c\nindex c153373c13dab..ccee4a28ffe97 100644\n--- a/drivers/mtd/ubi/build.c\n+++ b/drivers/mtd/ubi/build.c\n@@ -1088,7 +1088,6 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway, bool have_lock)\n \t\treturn -EINVAL;\n \n \tspin_lock(&ubi_devices_lock);\n-\tput_device(&ubi->dev);\n \tubi->ref_count -= 1;\n \tif (ubi->ref_count) {\n \t\tif (!anyway) {\n@@ -1099,6 +1098,12 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway, bool have_lock)\n \t\tubi_err(ubi, \"%s reference count %d, destroy anyway\",\n \t\t\tubi->ubi_name, ubi->ref_count);\n \t}\n+\tspin_unlock(&ubi_devices_lock);\n+\n+\tubi_notify_all(ubi, UBI_VOLUME_SHUTDOWN, NULL);\n+\n+\tspin_lock(&ubi_devices_lock);\n+\tput_device(&ubi->dev);\n \tubi_devices[ubi_num] = NULL;\n \tspin_unlock(&ubi_devices_lock);\n \ndiff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c\nindex 2c867d16f89f7..eed4b57c61bda 100644\n--- a/drivers/mtd/ubi/vmt.c\n+++ b/drivers/mtd/ubi/vmt.c\n@@ -352,6 +352,11 @@ int ubi_remove_volume(struct ubi_volume_desc *desc, int no_vtbl)\n \t\terr = -EBUSY;\n \t\tgoto out_unlock;\n \t}\n+\tspin_unlock(&ubi->volumes_lock);\n+\n+\tubi_volume_notify(ubi, vol, UBI_VOLUME_SHUTDOWN);\n+\n+\tspin_lock(&ubi->volumes_lock);\n \tubi->volumes[vol_id] = NULL;\n \tspin_unlock(&ubi->volumes_lock);\n \ndiff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h\nindex a529347fd75b2..562f92504f2b7 100644\n--- a/include/linux/mtd/ubi.h\n+++ b/include/linux/mtd/ubi.h\n@@ -192,6 +192,7 @@ struct ubi_device_info {\n *\t\t\tor a volume was removed)\n * @UBI_VOLUME_RESIZED: a volume has been re-sized\n * @UBI_VOLUME_RENAMED: a volume has been re-named\n+ * @UBI_VOLUME_SHUTDOWN: a volume is going to removed, shutdown users\n * @UBI_VOLUME_UPDATED: data has been written to a volume\n *\n * These constants define which type of event has happened when a volume\n@@ -202,6 +203,7 @@ enum {\n \tUBI_VOLUME_REMOVED,\n \tUBI_VOLUME_RESIZED,\n \tUBI_VOLUME_RENAMED,\n+\tUBI_VOLUME_SHUTDOWN,\n \tUBI_VOLUME_UPDATED,\n };\n \n", "prefixes": [ "v4", "6/8" ] }