From patchwork Tue May 28 15:32:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Schiffer X-Patchwork-Id: 3091 Return-Path: Received: from chaos.universe-factory.net (chaos.universe-factory.net [5.9.180.86]) by open-mesh.org (Postfix) with ESMTP id A26DC602061 for ; Tue, 28 May 2013 17:33:01 +0200 (CEST) Received: from avalon.uzl-wlan.uni-luebeck.de (unknown [141.83.179.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by chaos.universe-factory.net (Postfix) with ESMTPSA id 2176D186596 for ; Tue, 28 May 2013 17:33:01 +0200 (CEST) From: Matthias Schiffer To: b.a.t.m.a.n@lists.open-mesh.org Date: Tue, 28 May 2013 17:32:32 +0200 Message-Id: <179dd3afbd3ecdcd2144bd3016e1b01eaf0d5263.1369754967.git.mschiffer@universe-factory.net> X-Mailer: git-send-email 1.8.3 Subject: [B.A.T.M.A.N.] [PATCH maint] batman-adv: wait for rtnl in batadv_store_mesh_iface instead of failing if it is taken X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 May 2013 15:33:01 -0000 The rtnl_lock in batadv_store_mesh_iface has been converted to a rtnl_trylock some time ago to avoid a possible deadlock between rtnl and s_active on removal of the sysfs nodes. The behaviour introduced by that was quite confusing as it could lead to the sysfs store to fail, making batman-adv setup scripts unreliable. As recently the sysfs removal was postponed to a worker not running with the rtnl taken, the deadlock can't occur any more and it is safe to change the trylock back to a lock to make the sysfs store reliable again. Signed-off-by: Matthias Schiffer Reviewed-by: Simon Wunderlich --- sysfs.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sysfs.c b/sysfs.c index 15a22ef..929e304 100644 --- a/sysfs.c +++ b/sysfs.c @@ -582,10 +582,7 @@ static ssize_t batadv_store_mesh_iface(struct kobject *kobj, (strncmp(hard_iface->soft_iface->name, buff, IFNAMSIZ) == 0)) goto out; - if (!rtnl_trylock()) { - ret = -ERESTARTSYS; - goto out; - } + rtnl_lock(); if (status_tmp == BATADV_IF_NOT_IN_USE) { batadv_hardif_disable_interface(hard_iface,