Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp5587093pxb; Mon, 28 Mar 2022 14:36:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyc/kX8vKKBfmsXH3xlv7easDnJQ8S5ZulD7tGVS/VUdopZn47rUi7N5FsjUp8wypXrC7/R X-Received: by 2002:a05:6870:8929:b0:db:1bf5:3b8f with SMTP id i41-20020a056870892900b000db1bf53b8fmr593790oao.285.1648503374069; Mon, 28 Mar 2022 14:36:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648503374; cv=none; d=google.com; s=arc-20160816; b=oGO69urv/lD41nWMvRGE9zbtufQziDtafqQH4UignT8pFFo7yN7M+0Hgxu+fYJcRfG qb44AHxgH8C+Y43YZ7UMs7XgqegamLAvQ5hocHk1lMCirS/kJShnbs0yRvADBsDl1imc 1f5e9mPd20JtdYHq/LsgHX1O4Dclp2YiVLGVnC2MyZv+u7eqYLEiMFoOwrnVOE0U+OXw HFlCX9DX929nKvDto9s2KBblxlU764BEodwM4/dCdT2Y7ZDkRcTYqQhyJzW+849BbEiA K/XMhsqs3xoMV6djP+kvw1yUmInc9mnrIBlDCj+TEi1Q4fD9MBNOkc1GhYi3kSehlKs6 0EUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=MIw0OaLe72Ajmxvq86IY/8SlfSXIJSuwPuKfK90ooC4=; b=PU1YOmOU3MZUihpRiG+ttrmH57RaLD+ufwKbUKbYQPbq92BIW6ICX9HNiR4tZ1Tvhx M2iKgMAkQL/sRGT5A4zW2p3B7jRyCTjkgWzFy6kbobywNqaER5JrD0Tgl6g0Qp4MP5lW dTKIu3mAsWiwp68HZ+YwEZx3NOYdeSOKNWFYmQMRdZ0eb/+5tDM5dETYeR0tKNq84l5n hI7JuSMfFsmJqSAZebgdby8tKseviFbsDEPUcn3fcdry2p2uy/KHokL06PQFUPNPuF5A cKXElHw/CaISyUEdPf+Ele64rTPPP9bMzsseg9jT8HpH3ravS63EHvxmeCn7AcjjOQkZ Zf7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=KcGQja8a; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=j3WtelO1; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id y31-20020a056870b49f00b000da716e620csi11041415oap.149.2022.03.28.14.36.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 14:36:14 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=KcGQja8a; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=j3WtelO1; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D59C48930B; Mon, 28 Mar 2022 14:14:10 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241449AbiC1UuO (ORCPT + 99 others); Mon, 28 Mar 2022 16:50:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346514AbiC1UtB (ORCPT ); Mon, 28 Mar 2022 16:49:01 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48069AE6A for ; Mon, 28 Mar 2022 13:47:19 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 05AD81F85F; Mon, 28 Mar 2022 20:47:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1648500438; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=MIw0OaLe72Ajmxvq86IY/8SlfSXIJSuwPuKfK90ooC4=; b=KcGQja8aDu7NcEzQnovhw1pzuuefLyTKxDTzB3aylvRZx9bwyoWB1LCeGFAyVg7H5Pj1su qdYWIqg2ntvFfQ7mU0QryoMZ7by2M3mrtoCPZ1YS3/sw9s3M3MGZuJGR+gRgM+dNArfG1X k8RiVrDYrLVX8LSiNgSxfH7xRRT/hGY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1648500438; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=MIw0OaLe72Ajmxvq86IY/8SlfSXIJSuwPuKfK90ooC4=; b=j3WtelO1H7oyKji/Ywki1QlL+4Jk0GfxNZLa4NhX3xgyum7J7Hk4hbh1Ia6PIhuwIA0E27 5HMkW7jFI9b81SCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C7DD01332D; Mon, 28 Mar 2022 20:47:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id LdABLtUeQmJsUwAAMHmgww (envelope-from ); Mon, 28 Mar 2022 20:47:17 +0000 Date: Mon, 28 Mar 2022 22:47:16 +0200 From: Petr Vorel To: linux-kernel@vger.kernel.org Cc: Cyril Hrubis , Andrea Cervesato Subject: Re: [PATCH v2 1/1] lib: Retry safe_clone() on ENOSPC|EUSERS Message-ID: Reply-To: Petr Vorel References: <20220328204554.2528-1-pvorel@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220328204554.2528-1-pvorel@suse.cz> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Oops, wrong list, sorry. Kind regards, Petr > In some tests we are creating the namespaces faster than they are being > asynchronously cleaned up in the kernel: > $ sudo ./userns08 -i 10 > userns08.c:65: TPASS: Denied write access to ./restricted : EACCES (13) > userns08.c:65: TPASS: Denied write access to ./restricted : EACCES (13) > userns08.c:65: TPASS: Denied write access to ./restricted : EACCES (13) > userns08.c:65: TPASS: Denied write access to ./restricted : EACCES (13) > userns08.c:65: TPASS: Denied write access to ./restricted : EACCES (13) > userns08.c:36: TBROK: clone3 failed: ENOSPC (28) > Thus retrying the clone() on ENOSPC (or EUSERS for kernel < 4.9). > Suggested-by: Cyril Hrubis > Signed-off-by: Petr Vorel > --- > changes v1->v2: > * use TST_RETRY_FN_EXP_BACKOFF() (Cyril) > NOTE: 0.1s seems to be safe, although using TST_RETRY_FUNC() with 1s > (the default) would be of course OK. > Kind regards, > Petr > lib/tst_test.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > diff --git a/lib/tst_test.c b/lib/tst_test.c > index 384c73e163..2e89d954ec 100644 > --- a/lib/tst_test.c > +++ b/lib/tst_test.c > @@ -436,6 +436,9 @@ pid_t safe_fork(const char *filename, unsigned int lineno) > return pid; > } > +/* too fast creating namespaces => retrying */ > +#define TST_CHECK_ENOSPC(x) ((x) >= 0 || !(errno == ENOSPC || errno == EUSERS)) > + > pid_t safe_clone(const char *file, const int lineno, > const struct tst_clone_args *args) > { > @@ -444,7 +447,7 @@ pid_t safe_clone(const char *file, const int lineno, > if (!tst_test->forks_child) > tst_brk(TBROK, "test.forks_child must be set!"); > - pid = tst_clone(args); > + pid = TST_RETRY_FN_EXP_BACKOFF(tst_clone(args), TST_CHECK_ENOSPC, 0.1); > switch (pid) { > case -1: