Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp4281111pxp; Tue, 15 Mar 2022 17:14:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz16YrIUxu0+gy+q07BHSckHpgRMsnuhpUjWy1lZbuYdCm38MqfIsep9+ga4E9sLtpFfKw8 X-Received: by 2002:a17:903:1208:b0:151:93fd:d868 with SMTP id l8-20020a170903120800b0015193fdd868mr31013653plh.121.1647389683919; Tue, 15 Mar 2022 17:14:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647389683; cv=none; d=google.com; s=arc-20160816; b=QcFqOjgW7YIxmajQ+FAmf0+i/a6EO+jWp0SuJIGSzEsTOHBci49yDJeFmDilN7xHk/ +QDuXxmCaF52boTNxWYqrqxwgG3K53wndVE1LhqdIEzAl6zYfC64KDWZ4nnYaDintLyn fpRlxWVEDcrIGgKD6EBqa/cWSKlU3TIYCPt6DGZl5mNI6+2Iu79oVKCXrX4BilJEqAmZ 0LxpxAXM8LJ7Oepv0LDdMQcAJBZJ/sTk5nCBNIpoY+CG4zsN4IO5fEiBdS+B9ub7jLhb ib+9HL2p9PJ6csdcILCbts7hYDsBqTp1brt8posW/1jAWk3NlvLXRs0TXX7/Ur1+EDuP fC1g== 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=Hm3whZcqRb7v2P0VA7JuAkycBL8mYU8yZFd5Ty5weip5S16yYr4KS4p3doycMBjOJv pqt/5ZlNixxHOMnF8Soi8Mwn6lpCKWvuDa10OW20toGU+hW1NCYnzJgqBw8cPPb8LZye zmnrzfVjTbDchOtjK6gOSDgHaP/DN1s/ZxMFo7Wrm15lHIc8dxzINJR9T3XFT8LayDZM Rw4JkAfVjq/1kqa7osjsyER/5VkvCvGfzOFdugS4SK6bzBdA0ujPblH4aZLZvE5FPRKY poxIH7+7w7Q61SjNoF4p9OIH9cMvUnR0kpFsTspsJhx0RVKCnwbQ8G6uImIgq/uzBrnQ xDqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j9aoYKLP; 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 u7-20020a634547000000b003428174afe9si663134pgk.318.2022.03.15.17.14.29; Tue, 15 Mar 2022 17:14:43 -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=j9aoYKLP; 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 S243505AbiCNMbA (ORCPT + 99 others); Mon, 14 Mar 2022 08:31:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242866AbiCNMTt (ORCPT ); Mon, 14 Mar 2022 08:19:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EEAA50B37; Mon, 14 Mar 2022 05:14:50 -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 A3A42608C4; Mon, 14 Mar 2022 12:14:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A01E7C340EC; Mon, 14 Mar 2022 12:14:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647260085; bh=YeTe//0SAgavio9Xw86XZZ+I6TczDnfWm8tRimdCf7o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j9aoYKLPn2xkkXddZ3CmF1F2TQEj+xao1TZrJEwJ69UWh9tIpH1K+MqYRjjEzffiO 69+RlnODEaL1IZ7Piq2fyFp+3M/F2KTsUQO5tOmZOktQB05mG/Ln8CO7YSSvabMAF0 8znOhQKsKTtDkKV5hi89grMkCePjl4Stxo17qDxw= 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.16 051/121] selftests: pmtu.sh: Kill nettest processes launched in subshell. Date: Mon, 14 Mar 2022 12:53:54 +0100 Message-Id: <20220314112745.550881854@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112744.120491875@linuxfoundation.org> References: <20220314112744.120491875@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