Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3034933pxp; Mon, 14 Mar 2022 09:31:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8n5zM6EgbgweJ7V8Syk+6XoLXO3McYYcfPitiAUz5+2w4YdZ0lxLBqtTPqMAcYhCEn3q+ X-Received: by 2002:a54:4010:0:b0:2ec:af98:5dc2 with SMTP id x16-20020a544010000000b002ecaf985dc2mr7317403oie.195.1647275486709; Mon, 14 Mar 2022 09:31:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647275486; cv=none; d=google.com; s=arc-20160816; b=PhdUInn6mMzmWEUVOnJpLTswSHjEcv7RNDiMT9eDz3jmMX9L3el0D+vFLK9mvVU+9z CMDATTm5TEqxBkR/59AQCAH8S4q3DrbTvkxKc/qbi61sBZEYwI5BzUzmKORmGAxQL9sc Klw310+mNoHckI8aU4O+PKKFqa4ny+TyC8Xsv5iHum/V7GBLaxUdAIRzKXhrEtRtUib2 sRyqK8wr1Zl/fwAw8xPq8IpUXe2EpD/u8WevoIxSqT/AkwqU6gSMwDlLD2zuOWKHojxM kUgLtc9EcQAgcxqy0rD6sfGDMymnkalePROOiAmr5eoexqo24v1t9WKBrM6Dqe6XgEr5 t4Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rH+LcGhhx+b1tWawdBjFE8kcTOWWboFf5Culb1CiBfw=; b=Pxyu5abTBmb2GgBykuZgkQSu8x4i8nUvI9EFcZFpxNxRF1JTOy/vbutSM3WSGXhlUW 0rzVmPjTC3fBNURcGxVdMCpzvMK7fQ6XKJA1JAV855v/pPmhJG3DiEW/68HhY5Ah7HvB 9DRJbDHnci71S7/TmFIjzHvXsMYErkCH7D2jJvdC0LnllyPyGE8TIJ7yBJF2N5dkPI3i w7uuw3dwcGzo7HaLVIWHHVjyKAhVfSzRKaQLtELVUbs5JV4k81LLATvR9XVYXLdUHMPg vsGLPdxI9AUa4l2Z6OALFd7WJxV3+xiI8R9q8kFKBjuIaHJVX/Auzec7UvF6c0qqea25 03xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yRkdJVa1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gk6-20020a0568703c0600b000da716e61d5si8351424oab.94.2022.03.14.09.31.13; Mon, 14 Mar 2022 09:31:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yRkdJVa1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241707AbiCNMSU (ORCPT + 99 others); Mon, 14 Mar 2022 08:18:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242221AbiCNMJo (ORCPT ); Mon, 14 Mar 2022 08:09:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2318C50B04; Mon, 14 Mar 2022 05:06:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ABEB76130C; Mon, 14 Mar 2022 12:06:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E2EAC340EC; Mon, 14 Mar 2022 12:06:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647259597; bh=YeTe//0SAgavio9Xw86XZZ+I6TczDnfWm8tRimdCf7o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yRkdJVa1Qv/ZNWSZsiTwP1k38v/cmLT+TNXrMJpGsgp6S1jkpTDFxbpLwquk+l1MV 5Iom95mdcBrl5jrGgB9z8GEHZfvz+qrZ6luwAGvVjnjbssgFYVO3qraX8yWn/wGT9r vFU5QqWe73JSaeNk2nunLCvDYpcmOrWmj7AvpicM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Nault , Shuah Khan , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 045/110] selftests: pmtu.sh: Kill nettest processes launched in subshell. Date: Mon, 14 Mar 2022 12:53:47 +0100 Message-Id: <20220314112744.295152342@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112743.029192918@linuxfoundation.org> References: <20220314112743.029192918@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guillaume Nault [ Upstream commit 94a4a4fe4c696413932eed8bdec46574de9576b8 ] When using "run_cmd &", then "$!" refers to the PID of the subshell used to run , not the command itself. Therefore nettest_pids actually doesn't contain the list of the nettest commands running in the background. So cleanup() can't kill them and the nettest processes run until completion (fortunately they have a 5s timeout). Fix this by defining a new command for running processes in the background, for which "$!" really refers to the PID of the command run. Also, double quote variables on the modified lines, to avoid shellcheck warnings. Fixes: ece1278a9b81 ("selftests: net: add ESP-in-UDP PMTU test") Signed-off-by: Guillaume Nault Reviewed-by: Shuah Khan Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- tools/testing/selftests/net/pmtu.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh index 2e8972573d91..694732e4b344 100755 --- a/tools/testing/selftests/net/pmtu.sh +++ b/tools/testing/selftests/net/pmtu.sh @@ -374,6 +374,16 @@ run_cmd() { return $rc } +run_cmd_bg() { + cmd="$*" + + if [ "$VERBOSE" = "1" ]; then + printf " COMMAND: %s &\n" "${cmd}" + fi + + $cmd 2>&1 & +} + # Find the auto-generated name for this namespace nsname() { eval echo \$NS_$1 @@ -670,10 +680,10 @@ setup_nettest_xfrm() { [ ${1} -eq 6 ] && proto="-6" || proto="" port=${2} - run_cmd ${ns_a} nettest ${proto} -q -D -s -x -p ${port} -t 5 & + run_cmd_bg "${ns_a}" nettest "${proto}" -q -D -s -x -p "${port}" -t 5 nettest_pids="${nettest_pids} $!" - run_cmd ${ns_b} nettest ${proto} -q -D -s -x -p ${port} -t 5 & + run_cmd_bg "${ns_b}" nettest "${proto}" -q -D -s -x -p "${port}" -t 5 nettest_pids="${nettest_pids} $!" } -- 2.34.1