From patchwork Wed Apr 13 00:22:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 1616491 X-Patchwork-Delegate: daniel@makrotopia.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=gkyeXukF; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4KdNfH0F9Bz9sBy for ; Wed, 13 Apr 2022 10:25:26 +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:Subject:Cc:To: From:Date: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=RA9MYoKKGXramxGrTOZB4kpu05QcOVOd+UfG5A5/Ads=; b=gkyeXukFwPsQzu 1YGhMI8j5BOxcwHDQDXSui9G+qkEmHLMB7LQoMZh6gCceqPI9KN4Y53sntZgE8VATsattpylM0Z9Z jRG2sRZiRcAQiN8NhNjQ8B7VnH4BfMox0SkUadQ/+DKFF2sf5Hzpnq5DBj1D67DmAbd9pHcxOSYxI QT9sYmw1vo2ifyMEr/+IPQc28EXsQ8lHgkUfDwMXAnpKRqjt33ECUkpn1RAclk4ktfF7HPPLJzX1o n6mbbbhSK71ua2l+RgmbVwurSJoigE2jF8r1dV/f1HE+xTL/xJbQubSsr2bdxoRb6z0LrGT2x59H0 CDRWcHwWg3nOi12CT5Ig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1neQmF-00GA8l-No; Wed, 13 Apr 2022 00:22:31 +0000 Received: from fudo.makrotopia.org ([2a07:2ec0:3002::71]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1neQmB-00GA7L-VE for openwrt-devel@lists.openwrt.org; Wed, 13 Apr 2022 00:22:29 +0000 Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.94.2) (envelope-from ) id 1neQm7-00037t-Fs; Wed, 13 Apr 2022 02:22:23 +0200 Date: Wed, 13 Apr 2022 01:22:14 +0100 From: Daniel Golle To: openwrt-devel@lists.openwrt.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Cc: John Crispin Subject: [PATCH] blockd: restore device_move semantics Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220412_172228_044125_3A754676 X-CRM114-Status: UNSURE ( 9.04 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) 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: Before commit 4963db4 block device were only removed and re-added in case of device_move() returning a non-zero value. Commit 4963db4 then (supposedly) accidentally inverted that logic and also (proba [...] Content analysis details: (0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 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 Before commit 4963db4 block device were only removed and re-added in case of device_move() returning a non-zero value. Commit 4963db4 then (supposedly) accidentally inverted that logic and also (probably to work-around the problems resulting from the now inverted logic) limited this behavior to autofs mounts, leaving the autofs codepath in a semi- broken state. Restore the original semantics as of before commit 4963db4 to fully restore functionality for autofs mounts. Fixes: 4963db4 ("blockd: use uloop_process for calling /sbin/hotplug-call mount") Signed-off-by: Daniel Golle --- blockd.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/blockd.c b/blockd.c index 8bb5005..9572fd0 100644 --- a/blockd.c +++ b/blockd.c @@ -349,13 +349,11 @@ block_hotplug(struct ubus_context *ctx, struct ubus_object *obj, vlist_add(&devices, &device->node, device->name); - if (old && !device_move(old, device)) { - if (device->autofs) { - device_mount_remove(ctx, old); - device_mount_add(ctx, device); - } else { + if (old && device_move(old, device)) { + device_mount_remove(ctx, old); + device_mount_add(ctx, device); + if (!device->autofs) block("mount", NULL, NULL, 0, NULL); - } } else if (device->autofs) { device_mount_add(ctx, device); }