From patchwork Thu Dec 14 21:53:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Yeryomin X-Patchwork-Id: 848780 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="S2wLGYcg"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yyS675J5Wz9t3M for ; Fri, 15 Dec 2017 08:55:11 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:Message-Id:Date:To: From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=QldiufBGJZSlfwIdPH2BMMJ5+FtLAeotWZMbdZV1xKk=; b=S2wLGYcg4p/7Xz BfIu+QLYV9XsY/7f1dhAYOdfpRwtMqMEsknqiJtmq7LmE74ID9uWcaIqsZXXwgbO0pvliS39xt1yr HoxsERz1lbzHjICqPDUs8OKzhejPd9CxxzEQ2AgniZtNkKD5U0/F2oT1fG5AuFUvykziEMSV9VKOn 349lVKwgv0hkXqKBTw9HxjFpWGP1okAvLK8WC4avaGD5Pm7/qxC/KLLDEHq/3X5x4pRT64m/Of8d+ EAZvvY448RJUpPxtmHpTA9mxvGHuokZlZfPQL5JC9D5s9ncQdyKaTWWhLhoZWbLDRSJkwaMmCzKlT ezNys5v9Znw6I8CttJbQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ePbT6-0001nU-M8; Thu, 14 Dec 2017 21:55:04 +0000 Received: from [213.175.92.62] (helo=mail.pbx.lv) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ePbSh-0001c3-SX for lede-dev@lists.infradead.org; Thu, 14 Dec 2017 21:54:42 +0000 Received: from localhost.localdomain (unknown [213.175.92.61]) by mail.pbx.lv (MailSystem) with ESMTPSA id BFEE51A1AE6 for ; Thu, 14 Dec 2017 23:54:16 +0200 (EET) From: Roman Yeryomin To: LEDE Development List Date: Thu, 14 Dec 2017 23:53:50 +0200 Message-Id: <20171214215350.4776-1-roman@advem.lv> X-Mailer: git-send-email 2.14.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171214_135440_177598_FC4B726D X-CRM114-Status: UNSURE ( 4.43 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.1 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.8 RDNS_NONE Delivered to internal network by a host with no rDNS Subject: [LEDE-DEV] [PATCH 1/3] busybox: enable flock by default X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Roman Yeryomin --- package/utils/busybox/Config-defaults.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/utils/busybox/Config-defaults.in b/package/utils/busybox/Config-defaults.in index 2a8d9dd397..6fc5093055 100644 --- a/package/utils/busybox/Config-defaults.in +++ b/package/utils/busybox/Config-defaults.in @@ -1497,7 +1497,7 @@ config BUSYBOX_DEFAULT_FINDFS default n config BUSYBOX_DEFAULT_FLOCK bool - default n + default y config BUSYBOX_DEFAULT_FDFLUSH bool default n From patchwork Thu Dec 14 21:54:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Yeryomin X-Patchwork-Id: 848781 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Z0QrGoRJ"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yyS6R25z2z9t39 for ; Fri, 15 Dec 2017 08:55:27 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:Message-Id: Date: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=gpXM3I7O1mpwsG4RL0qj+c8Z9gxpNjeC0RHXeulJnLo=; b=Z0QrGoRJ6X82uA sW5WI5rO5f8DMOzUJRLmXHT/c06OzZuORnYtsuoh8BnBmk445P3FS9648oHRVe+U5cpwyi48mXy5Z JwGakmpRnjg6v88f0dpjhud8YLZfNd8TmHJMEfqnq433Ib28swcfMk8SPXKYt7kWzffaMfHoEmcVV w+pBMtMWhM1pdQybu4rpsvkAjUyWrrKnu82LBJwS7QjgSkeeoSGvPykrwf2QdBAi6fAdnLA5EHUZt aKWT/bvMfmUSlygKSNpyNHRBdhoQAzsBxfnPogZxc1IHLp5BSgh+uuvH0Xkx9SdP+K4kUnZ9xVtCY tQnWRj3ig5VbHxmcnh4g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ePbTM-0003HB-Jp; Thu, 14 Dec 2017 21:55:20 +0000 Received: from [213.175.92.62] (helo=mail.pbx.lv) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ePbTI-0001qS-Ht for lede-dev@lists.infradead.org; Thu, 14 Dec 2017 21:55:18 +0000 Received: from localhost.localdomain (unknown [213.175.92.61]) by mail.pbx.lv (MailSystem) with ESMTPSA id 659F91A1AE7; Thu, 14 Dec 2017 23:54:53 +0200 (EET) From: Roman Yeryomin To: LEDE Development List Date: Thu, 14 Dec 2017 23:54:26 +0200 Message-Id: <20171214215426.4828-1-roman@advem.lv> X-Mailer: git-send-email 2.14.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171214_135516_820710_EE63AC4E X-CRM114-Status: UNSURE ( 3.93 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.1 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.8 RDNS_NONE Delivered to internal network by a host with no rDNS Subject: [LEDE-DEV] [PATCH 2/3] procd: introduce procd_lock for init script protection X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrejs Hanins MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Use flock to protect init script from concurrent execution (of the same script). Important for services which generate native config files. Signed-off-by: Roman Yeryomin Signed-off-by: Andrejs Hanins --- package/system/procd/files/procd.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh index 91e2371d62..b8d3513b1e 100644 --- a/package/system/procd/files/procd.sh +++ b/package/system/procd/files/procd.sh @@ -38,6 +38,20 @@ PROCD_RELOAD_DELAY=1000 _PROCD_SERVICE= +procd_lock() { + local basescript=$(readlink "$initscript") + local service_name="$(basename ${basescript:-$initscript})" + + flock -n 1000 &> /dev/null + if [ "$?" != "0" ]; then + exec 1000>/var/lock/procd_${service_name}.lock + flock 1000 + if [ "$?" != "0" ]; then + logger "warning: procd flock for $service_name failed" + fi + fi +} + _procd_call() { local old_cb @@ -47,6 +61,7 @@ _procd_call() { } _procd_wrapper() { + procd_lock while [ -n "$1" ]; do eval "$1() { _procd_call _$1 \"\$@\"; }" shift From patchwork Thu Dec 14 21:55:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Yeryomin X-Patchwork-Id: 848782 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="aYFX/EQk"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yyS7J4vMmz9t39 for ; Fri, 15 Dec 2017 08:56:09 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:Message-Id: Date: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=pS4oPjIfXFwRz25lqy6+nkVthDtlqhs6uU/TtR/Vi68=; b=aYFX/EQkLVhK6h SYf90tOrOqD295MqShSXWAZel+ZOWrxDZYdwaPbJjoOAMku3fp9oAOj8fivltI4ERkT2VTFSeTlMD IthiWC3siZXCn0Wly43vv+eUeBlJialcS73+evhJBLeUyK7SEkNgRZ/Ca0kXvS8x+uFlWsWsM+u++ m6lIj0iU9pTJPo3ZP4CCJ0Amv38eaktjJ3l6dl9fikSDY4XtyC0z7oPzyJ0lcu565DlYUne95VDuD vuyv58a3mvHAzHdrGTNT0wiMAXRvBYfpyL8Mhn1KkyRwcET53CW+1JzUih22jsNs89E874YkMphPn F7FWQqgKspNX/mGZkpWg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ePbU0-0003ZN-G6; Thu, 14 Dec 2017 21:56:00 +0000 Received: from [213.175.92.62] (helo=mail.pbx.lv) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ePbTw-0003U2-Su for lede-dev@lists.infradead.org; Thu, 14 Dec 2017 21:55:58 +0000 Received: from localhost.localdomain (unknown [213.175.92.61]) by mail.pbx.lv (MailSystem) with ESMTPSA id D6F991A1AE6; Thu, 14 Dec 2017 23:55:33 +0200 (EET) From: Roman Yeryomin To: LEDE Development List Date: Thu, 14 Dec 2017 23:55:08 +0200 Message-Id: <20171214215508.4880-1-roman@advem.lv> X-Mailer: git-send-email 2.14.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171214_135557_240580_F4330842 X-CRM114-Status: UNSURE ( 3.36 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.1 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.8 RDNS_NONE Delivered to internal network by a host with no rDNS Subject: [LEDE-DEV] [PATCH 3/3] base-files: protect stop and reload actions with procd_lock X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrejs Hanins MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Roman Yeryomin Signed-off-by: Andrejs Hanins --- package/base-files/files/etc/rc.common | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/base-files/files/etc/rc.common b/package/base-files/files/etc/rc.common index a2ea6a5679..89ad187c3c 100755 --- a/package/base-files/files/etc/rc.common +++ b/package/base-files/files/etc/rc.common @@ -126,12 +126,14 @@ ${INIT_TRACE:+set -x} } stop() { + procd_lock stop_service "$@" procd_kill "$(basename ${basescript:-$initscript})" "$1" } reload() { if eval "type reload_service" 2>/dev/null >/dev/null; then + procd_lock reload_service "$@" else start