Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6821975ybl; Wed, 15 Jan 2020 10:43:08 -0800 (PST) X-Google-Smtp-Source: APXvYqyb8JmX8vyB7snhNP2biL8hHN+fqW6aApFLurCtt0ElsgzH8c/KicZfyVb7NNH/dn3W2uHp X-Received: by 2002:aca:5fc6:: with SMTP id t189mr1008995oib.166.1579113788585; Wed, 15 Jan 2020 10:43:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579113788; cv=none; d=google.com; s=arc-20160816; b=h2f0pkLQmdU8X2tukv2X0r1kiKb4wY/iRw38ZjkLTU4DeuP4DY1xJtmiZTj7K4Bv1x BC5he0VNuPEhZU5BbQz7dunI4D1uglSVR+Ir2qR9YhKyC2LzzlzfSQ2DCz0Mf7ocYlzy 6iN5CUqLN4avYlSF8MxWAYVSa/bGCGhbcYDIJut2CkpbZqb1QmqxlQkxIQeYge3TdDCj +PsVe1uV3gIfMMsrl17vHy++GXd3b1CXNwVdGBBfA6cWu02efttg/LovCxNz8Q6l2doi +2rMNkkcRnFfGmpP3WZMNZqxeNdBoMFT0xswLPOeVZQzYsFcZtGPdqMroKtgcpzyeX/c ei+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FfinOLqwdFdhYZe1AnbIMe0/TNWIknzNIzj+1zq5Eyc=; b=gEjcAI1vp069DMG5rOSPLFoP1N+HWflREGu+htSzEnBCaALb7LNrXhxNabVhLmuUo+ VxRgF4kuHf0fADitW8nW/pcBGhWlWya6CWcDE5ZMddYIDGQZoLxJyKKEIwYsuVNOQWqA TuyZ+Qar7Q8K1jLXikMZdkqdsXiEH7Cv/FrsH50GRoZHfVLTA/2sXpKHQOoJ8/T0jikf VvrPYs49yI8Cx1bdYMRW3IEwG0fzmKPlIhQNvgvexWDmVkp1bTyHwlvp3G/VgRYsULtl l1pAxbNiNT5nDetMaJEaDJ83u00KM4uE5ToVscqRW/65o93Dmis2I15zdN+unGnCInPk qSQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=c5tBQhDI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y23si11054176oti.65.2020.01.15.10.42.56; Wed, 15 Jan 2020 10:43:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=c5tBQhDI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729242AbgAOSmC (ORCPT + 99 others); Wed, 15 Jan 2020 13:42:02 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:36304 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729037AbgAOSmB (ORCPT ); Wed, 15 Jan 2020 13:42:01 -0500 Received: by mail-lj1-f195.google.com with SMTP id r19so19720402ljg.3 for ; Wed, 15 Jan 2020 10:42:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FfinOLqwdFdhYZe1AnbIMe0/TNWIknzNIzj+1zq5Eyc=; b=c5tBQhDIunGNFn53pgP9Ti5dbFYSwr2pnlwoGuPfWRYEUCz17T/jT5iIKPP6I0x/YR GHEMtMSuEj777U2+bcIe4PSCm6PeQy7AuSL9KUQAWEm0N40IpP6QwOJ0niFhN9wEYXPs nJqtzCU3Z5UMrmuSYc8T8Y4qagLCyiR5lESU0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FfinOLqwdFdhYZe1AnbIMe0/TNWIknzNIzj+1zq5Eyc=; b=FG2A0190afWucNXSk9lcZbV4VoP8C8418oWDxDK0RSZqbh8DCTibwkrs3bw8VhcAZT pOaSO45kEKRpMxMoJyHwRGWSWDaU3QoADcQgXEiDE4I6usFrgQe+L8dgaMIgqbijESy7 quMMMV21EsdkmZtMic/8Z8lgG1xE5164TGLfo0MaYkwlJ0eqdw7qox++X5hOMNQdJ+4i BmtUXmaRRRya5EKCRjAaeodb29TOx2Xkl07aVzVHfQuWH6XWVwJzEjD/3TUTFRUt4p7U mY4xk878S0Mi1njJnsQ53vkjmjkgLHj2H7ujhpnXS46CTENYvjKdfSGtgrRl44BOHuN+ OKjg== X-Gm-Message-State: APjAAAUUCMLhx+Pe0D2K1MgJaYMmhCueJkSOuXaCKJF2iiLiFzoQNTYt yO0wzEjY9fgVfV8djv4u1Sh3Bw== X-Received: by 2002:a2e:95c4:: with SMTP id y4mr2760330ljh.38.1579113719632; Wed, 15 Jan 2020 10:41:59 -0800 (PST) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id 21sm9598631ljv.19.2020.01.15.10.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2020 10:41:59 -0800 (PST) From: Rasmus Villemoes To: Greg Kroah-Hartman , "Rafael J. Wysocki" Cc: Rasmus Villemoes , linux-kernel@vger.kernel.org Subject: [PATCH 2/5] devtmpfs: factor out setup part of devtmpfsd() Date: Wed, 15 Jan 2020 19:41:50 +0100 Message-Id: <20200115184154.3492-3-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200115184154.3492-1-linux@rasmusvillemoes.dk> References: <20200115184154.3492-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Factor out the setup part of devtmpfsd() to make it a bit easier to see that we always call setup_done() exactly once (provided of course the kthread is succesfully created). Signed-off-by: Rasmus Villemoes --- drivers/base/devtmpfs.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c index ccb046fe12b7..963889331bb4 100644 --- a/drivers/base/devtmpfs.c +++ b/drivers/base/devtmpfs.c @@ -388,7 +388,7 @@ static int handle(const char *name, umode_t mode, kuid_t uid, kgid_t gid, return handle_remove(name, dev); } -static int devtmpfsd(void *p) +static int devtmpfs_setup(void *p) { int err; @@ -400,7 +400,18 @@ static int devtmpfsd(void *p) goto out; ksys_chdir("/.."); /* will traverse into overmounted root */ ksys_chroot("."); +out: + *(int *)p = err; complete(&setup_done); + return err; +} + +static int devtmpfsd(void *p) +{ + int err = devtmpfs_setup(p); + + if (err) + return err; while (1) { spin_lock(&req_lock); while (requests) { @@ -421,10 +432,6 @@ static int devtmpfsd(void *p) schedule(); } return 0; -out: - *(int *)p = err; - complete(&setup_done); - return err; } /* -- 2.23.0