Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp182219pxb; Wed, 18 Aug 2021 19:28:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxd++8L1Bk2GM7p5N8gNd9ro7ZrAnD9bO8QMYCdbpP3TBTMog0JLkM4qmTQH6HqU2MMDTuP X-Received: by 2002:a17:906:c342:: with SMTP id ci2mr13329267ejb.122.1629340114853; Wed, 18 Aug 2021 19:28:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629340114; cv=none; d=google.com; s=arc-20160816; b=r/t4sioJU7NED5eaqjYaxHEMo1zruMu7rZramW12ePNjybgwduCLufI8x78inNaTaJ JRaxvYIr3S/TU5WANEnmZzlApE4ULzzt28ax16iWnv5BLFhsXgpBCiqItiSYuvVtFkDC 8RYf45ovFfvEJHzw4FLcc+0NL8CSR2j7RmQaiI5JC/Gf4KNJpCt2EXE0WV+9k0+xSZS4 TLMonWm5yfCYUgaCp3QMACCwwhfkzvyUgKcwCNN4Wr53tPoC3OWx7VlIsVgpduX6sZLb VGVMysgKoVWWsUN/+2MYzXbDkzpCBr+H2NLazXZxUtpPJNPy+t3jRzNNo3A66aDWdQew f1Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=EvF+TVMEg7FdtNR5//wvwatfFB3PHgGZBIhFARQhq60=; b=lqap+jfwTQfKYeqqPtq6R/fdaHUnnDS+hUh9csoc05zgPOFspKume47Yjtjk9cOnjX Xt3PZkom+5zZheXT9KJPgwWHn5JE3/RXpbL9EErBwIzPTdiY2UxLrNfv4K1S/u4v5jj4 QEe9Ro6aIVt68JfaxJb0c62ps02aVAgCPlr84BEWlfZG0eTK0oG4D/zo2rw4+ZAr3XDR GIfFkH83lIZkPvMbUuDqF9nmyLAjueNuZZgqgCNwu4dGM9k4Qu8Nuqo+bUkJ1d399OhE yUhDHZ5CZytetf3iW4Qz6Fm//3ZBHmtXs1mVshURk3XO6ANGbCgJmmxC+eFfiWYx9Bs7 wSiw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jy4si1770294ejc.149.2021.08.18.19.28.08; Wed, 18 Aug 2021 19:28:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235627AbhHSC1X (ORCPT + 99 others); Wed, 18 Aug 2021 22:27:23 -0400 Received: from out30-43.freemail.mail.aliyun.com ([115.124.30.43]:33261 "EHLO out30-43.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235384AbhHSC1W (ORCPT ); Wed, 18 Aug 2021 22:27:22 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04423;MF=eguan@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0Ujw66VG_1629340004; Received: from localhost(mailfrom:eguan@linux.alibaba.com fp:SMTPD_---0Ujw66VG_1629340004) by smtp.aliyun-inc.com(127.0.0.1); Thu, 19 Aug 2021 10:26:44 +0800 Date: Thu, 19 Aug 2021 10:26:44 +0800 From: Eryu Guan To: Luis Chamberlain Cc: Eryu Guan , fstests@vger.kernel.org, hare@suse.de, dgilbert@interlog.com, jeyu@kernel.org, lucas.demarchi@intel.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/3] common/module: add patient module rmmod support Message-ID: <20210819022644.GP60846@e18g06458.et15sqa> References: <20210811154512.1813622-1-mcgrof@kernel.org> <20210811154512.1813622-3-mcgrof@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 18, 2021 at 07:02:56AM -0700, Luis Chamberlain wrote: > On Sun, Aug 15, 2021 at 08:29:42PM +0800, Eryu Guan wrote: > > On Wed, Aug 11, 2021 at 08:45:11AM -0700, Luis Chamberlain wrote: > > > common/config | 31 +++++++++++++++ > > > common/module | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++ > > > > Please also update README to document the new configurable variables. > > Got it. > > > > 2 files changed, 138 insertions(+) > > > > > > diff --git a/common/config b/common/config > > > index 005fd50a..9b8a2bc4 100644 > > > --- a/common/config > > > +++ b/common/config > > > > 100s as default seems a bit long to me, use 10s as in v1 patch? > > In practice I tried using 10s and from my observations we *still* ran > into false positives. So from my own testing peace of mind I'd prefer at > least something higher, and if its going to be higher might as well go > with something which at least makes painfully safe. I'll go with 50s > for my next submission. > > > > + fi > > > +else > > > + MODPROBE_RM_PATIENT_TIMEOUT_ARGS="" > > > + if [[ ! -z "$MODPROBE_PATIENT_RM_TIMEOUT_SECONDS" ]]; then > > > + if [[ "$MODPROBE_PATIENT_RM_TIMEOUT_MS" != "forever" ]]; then > > > > Should check MODPROBE_PATIENT_RM_TIMEOUT_SECONDS instead? > > Indeed will fix. > > > > diff --git a/common/module b/common/module > > > index 39e4e793..03953fa1 100644 > > > --- a/common/module > > > +++ b/common/module > > > @@ -4,6 +4,8 @@ > > > # > > > # Routines for messing around with loadable kernel modules > > > > > > +source common/config > > > + > > > > Seems there's no need to source common/config here, as it's sourced in > > common/rc, which is sourced by every test. > > OK. > > > > + local max_tries_max=$MODPROBE_PATIENT_RM_TIMEOUT_SECONDS > <-- snip --> > > > > + local max_tries=0 > <-- snip --> > > > > + max_tries=$max_tries_max > > > + > > > + while [[ "$max_tries" != "0" ]]; do > > > > Use "$max_tries -ne 0" to check inters seems better. > > max_tries can be "forever", in which case this is -eq 0: > > $ foo="forever"; if [[ $foo -eq 0 ]]; then echo buggy; else echo ok; fi > buggy I see, that makes sense. Then perhaps some comments would help. Thanks, Eryu > > > > + refcnt_is_zero=1 > > > + break > > > + fi > > > + sleep 1 > > > + if [[ "$max_tries" == "forever" ]]; then > > > + continue > > > + fi > > > + let max_tries=$max_tries-1 > > > + done > > > + > > > + if [[ $refcnt_is_zero -ne 1 ]]; then > > > + echo "custom patient module removal for $module timed out waiting for refcnt to become 0 using timeout of $max_tries_max" > > > + return -1 > > > + fi > > > + > > > + # If we ran out of time but our refcnt check confirms we had > > > + # a refcnt of 0, just try to remove the module once. > > > + if [[ "$max_tries" == "0" ]]; then > > > > $max_tries -eq 0 > > Same issue. > > Luis