From patchwork Tue Nov 26 11:41:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 3238881 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5A4B29F3A0 for ; Tue, 26 Nov 2013 11:47:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5AF4E203C4 for ; Tue, 26 Nov 2013 11:47:33 +0000 (UTC) Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mail.kernel.org (Postfix) with ESMTP id 4B312203B6 for ; Tue, 26 Nov 2013 11:47:32 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rAQBhdk6002471; Tue, 26 Nov 2013 06:44:16 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rAQBftOp013279 for ; Tue, 26 Nov 2013 06:41:55 -0500 Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.18]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rAQBftit005728; Tue, 26 Nov 2013 06:41:55 -0500 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rAQBfsB7002063; Tue, 26 Nov 2013 06:41:54 -0500 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CF76EA7B62; Tue, 26 Nov 2013 12:41:53 +0100 (CET) From: Hannes Reinecke To: Christophe Varoqui Date: Tue, 26 Nov 2013 12:41:29 +0100 Message-Id: <1385466090-24290-9-git-send-email-hare@suse.de> In-Reply-To: <1385466090-24290-1-git-send-email-hare@suse.de> References: <1385466090-24290-1-git-send-email-hare@suse.de> X-RedHat-Spam-Score: -6.9 (BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, URIBL_BLOCKED) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.18 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com Subject: [dm-devel] [PATCH 8/9] multipathd: Read environment variables from systemd X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When systemd adjusts 'OOMScoreAdjust' and 'LimitNOFILE' we should take those settings and not try to adjust them again on our side. Signed-off-by: Hannes Reinecke --- multipathd/main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/multipathd/main.c b/multipathd/main.c index 448ed39..b57fa5d 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1553,7 +1553,13 @@ set_oom_adj (void) #endif FILE *fp; struct stat st; + char *envp; + envp = getenv("OOMScoreAdjust"); + if (envp) { + condlog(3, "Using systemd provided OOMScoreAdjust"); + return; + } do { if (stat(file, &st) == 0){ fp = fopen(file, "w"); @@ -1630,7 +1636,11 @@ child (void * param) setlogmask(LOG_UPTO(conf->verbosity + 3)); - if (conf->max_fds) { + envp = getenv("LimitNOFILE"); + + if (envp) { + condlog(2,"Using systemd provided open fds limit of %s", envp); + } else if (conf->max_fds) { struct rlimit fd_limit; if (getrlimit(RLIMIT_NOFILE, &fd_limit) < 0) {