From patchwork Tue Jun 6 22:42:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathew McBride X-Patchwork-Id: 1791442 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) 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=AYpWPnLU; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=traverse.com.au header.i=@traverse.com.au header.a=rsa-sha256 header.s=fm3 header.b=sLHT11Ps; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=Ap9KxjIq; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QbQbR3FMPz20Q8 for ; Wed, 7 Jun 2023 08:47:31 +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=u3F4SWTxZmGHeYOJPmzHZYCwnYGUoY0MgzwD+x7Nv9Q=; b=AYpWPnLUqruPe3 iL3XO1XWkc+8rsF81NGPqmLHd8WGtQoAp/V9l7D70qU1pekXcCDaxREQ6TYhz1vKrJh0pG0pPFlcJ jfS/aR+4dDdtQVanwVC4j6O2EE5k2wtJ+0uIbvttyUH0VQHqWtikiMoOQWt/JoJpITQXbIKsuuBJN MbOaVuef92TadFB4g+oPGW3gb6XYVpLN7ycxz04nSQE/gFDoQPzsEo7q0r8a3hs7yA2odcE7VkO23 mAM+yxjMJU6CFgqMZ3ab0AgtDm435XWj8x2YS/H+y8N4VC64zBXQJH6Qg229reSPb2/nfHOb+p2z9 u7K/9/KnI5Gh1hWkwIZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q6fOX-003Tz5-1X; Tue, 06 Jun 2023 22:43:17 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q6fOR-003TyA-33 for openwrt-devel@lists.openwrt.org; Tue, 06 Jun 2023 22:43:13 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 20AD832002B6; Tue, 6 Jun 2023 18:43:06 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 06 Jun 2023 18:43:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=traverse.com.au; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to; s=fm3; t=1686091385; x=1686177785; bh=Gu VyeT0Ja44uXwE6t8lFEbsgc4uw/6Pd0KyUAhxPReQ=; b=sLHT11PsIjcspeiFpZ q9ZVU0Jz37C6GIV3Oz0YWC3IY3fm0cXQuU0sQ1/UjbS17L+YR+oSI0o3+AtU85tf nEGHqHBYi1OSX26ZUYn8b5lbugdd4HwQavCXvzAp6Wdol9IEANygUPHXOHIzMlZ1 N61GhKIuX8sr8WYrHgY+4kAe5jpTe0MEgM3edLnTA7TMteAO8Gxvks8XiHD203cq Lyo/ih7j5eVtn5PWqNIlQhLxikhvRzg7UFDlL+0hBycPUlBO4a6p2QvQeE4ra4kT SLQzUyny6lMaTaSb0g6fKC8FKoQYPaA9Dfl11Mbhliw1AjmUzjfuQu7ujSrp0LHa d+/Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1686091385; x=1686177785; bh=GuVyeT0Ja44uX wE6t8lFEbsgc4uw/6Pd0KyUAhxPReQ=; b=Ap9KxjIqw9dKfs0Fn8c5Vp6kE42a8 roz80W6hMFGWlTt6ZFzRnTfpEPQ68SujU/Nlq65vt0wtZAurIK6sJSOZm7eA2Mxs akrOFESfejWVtp8QhG7uDEtNTb4ZPvUo1dB7dlo55UwM0gFFzCnVR/mLaK12tVQV 1DqOpPp8aeMashH7nAzR67pm3681Dmkr2TdXRklwauQbXKwaFG402x1HV5Ds51Vy txpbTLOPDDuuHpwslDk0dGoXT2rbD+cr7UaA+3b3bO8LQ3bU8bgXigpG0pZi2wh0 TxqxmrMurv2RG6194C+8WqfaOTU0FyoN2pT28Wy43pFgy46dYDqLwpkHQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgedtvddguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgggfestdekredtredttdenucfhrhhomhepofgrthhhvgif ucfotgeurhhiuggvuceomhgrthhtsehtrhgrvhgvrhhsvgdrtghomhdrrghuqeenucggtf frrghtthgvrhhnpeevgfekgeejhedvleehkefhffeifeduledtkeduteffjeetieeggffh hfegteffvdenucffohhmrghinhepthhrrghvvghrshgvrdgtohhmrdgruhdpghhithhhuh gsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mhepmhgrthhtsehtrhgrvhgvrhhsvgdrtghomhdrrghu X-ME-Proxy: Feedback-ID: i426947f3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 6 Jun 2023 18:43:04 -0400 (EDT) From: Mathew McBride To: Openwrt Devel Cc: Mathew McBride Subject: [PATCH fstools] block: autofs: do not generate events for the root partition Date: Tue, 6 Jun 2023 22:42:54 +0000 Message-Id: <20230606224254.16380-1-matt@traverse.com.au> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230606_154312_328706_6867D2B9 X-CRM114-Status: GOOD ( 10.07 ) X-Spam-Score: -0.9 (/) 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: This resolves an issue that occurs (mostly) when OpenWrt is booted directly from a mass storage device (e.g x86 or ARM EFI, SATA, NVMe etc.) and results in the system becoming unusable (everything but [...] Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [64.147.123.21 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org This resolves an issue that occurs (mostly) when OpenWrt is booted directly from a mass storage device (e.g x86 or ARM EFI, SATA, NVMe etc.) and results in the system becoming unusable (everything but / is unmounted). When "block autofs start" is called (e.g by LuCI when editing system mounts), it was generating a "remove" hotplug event for the root device, causing the system to try to unmount the root partition. To resolve this issue, ensure no hotplug events are generated for the "/", just as we don't for the extroot usecases. Signed-off-by: Mathew McBride Link: https://forum.traverse.com.au/t/no-proc-mounts/209 Fixes: https://github.com/openwrt/openwrt/issues/12791 --- block.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index 9b7c49c..8aa31a4 100644 --- a/block.c +++ b/block.c @@ -1295,11 +1295,18 @@ static int main_autofs(int argc, char **argv) if (m && m->extroot) continue; + mp = find_mount_point(pr->dev); + if (mp && !strcmp(mp,"/")) { + free(mp); + continue; + } + blockd_notify("hotplug", pr->dev, m, pr); - if ((!m || !m->autofs) && (mp = find_mount_point(pr->dev))) { + if ((!m || !m->autofs) && mp) { blockd_notify("mount", pr->dev, NULL, NULL); - free(mp); } + if (mp) + free(mp); } } else { if (argc < 4)