Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp258363pxu; Tue, 13 Oct 2020 23:55:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+hzL1dSc2rlUT3eEgPMKY7j70kDy3O1ecG2u+iDQP4RYy5YEY32cSfo2Es7eSc7O5++Jh X-Received: by 2002:a50:b063:: with SMTP id i90mr3748826edd.187.1602658540888; Tue, 13 Oct 2020 23:55:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602658540; cv=none; d=google.com; s=arc-20160816; b=lESQfIyOdAJf2lqGFawG/7ELXPamjpdrWwEOTHVV6P7k7b0K351vIEiKhYt/mfRFLs /NVuorvnag+rltFRVGDuqRn6dQCXGa2hg9QZbGpbV6tzkuUFU7yf+9Sang1Bxj+8r9ox jmPY0/0cNjxMgbCSoYgmzUc1Smlwsm9mkxD61LvKIskMG9BeUDD6nTjnZfQzOtty0Zs8 2C01DwLO1YWMmCD/R9RsazLyzUirXjOSrbJpfWeIXqfMYw2Q6HTcOOnSvRNjltq2h8j7 rg1Xh/uLo0S7UyM8d8Gei1dhVlMJkmbZBVU4P89XbocSjAtQdh6DuFXirADd53kzrXpi zeGw== 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:message-id:subject:cc:to:from:date; bh=aa3GtcKzCUqGJaf1yV9CFstJnMMrRPU/rZ7Sa3g0BTI=; b=jfnceEl5rHeapvDdjDSCgtAapSpwAKHr0eIkfr+/bv19eq59OSjuVnP9i2sf6dP7jm 3ff7NuWu9wTbdCT7hNs4rmS6C2rxFssJR2VhOR7x4eRmGpyskVz8YNfW1mj397WiIgVY Nuwp4A67n3nLPUgiKsEkwV9N7MY2hMUSOlbhbxk4nTDqoft5pBggiytVcM6yb5TRTlAD AWwku6UIm6FcpSYuACQqaErfmCnDSUGTydZvCF5nAXtSABwjy8H9V6374O+5NQiXY1Y5 ecg7aR8ElDy6sEzsHgMmB80ahGf/dLM+97Zduj/a0OmIZQhIWBp7LRTPFW1UafZti0xl 03GA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ly6si1577189ejb.594.2020.10.13.23.55.17; Tue, 13 Oct 2020 23:55:40 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728307AbgJMVc0 (ORCPT + 99 others); Tue, 13 Oct 2020 17:32:26 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:37801 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726652AbgJMVc0 (ORCPT ); Tue, 13 Oct 2020 17:32:26 -0400 Received: from ip5f5af0a0.dynamic.kabel-deutschland.de ([95.90.240.160] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kSRuA-00088m-MW; Tue, 13 Oct 2020 21:32:22 +0000 Date: Tue, 13 Oct 2020 23:32:22 +0200 From: Christian Brauner To: Al Viro Cc: Giuseppe Scrivano , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, containers@lists.linux-foundation.org Subject: Re: [PATCH 1/2] fs, close_range: add flag CLOSE_RANGE_CLOEXEC Message-ID: <20201013213222.wlnhiocw6zi5eegx@wittgenstein> References: <20201013140609.2269319-1-gscrivan@redhat.com> <20201013140609.2269319-2-gscrivan@redhat.com> <20201013210925.GJ3576660@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20201013210925.GJ3576660@ZenIV.linux.org.uk> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 13, 2020 at 10:09:25PM +0100, Al Viro wrote: > On Tue, Oct 13, 2020 at 04:06:08PM +0200, Giuseppe Scrivano wrote: > > + spin_lock(&cur_fds->file_lock); > > + fdt = files_fdtable(cur_fds); > > + cur_max = fdt->max_fds - 1; > > + max_fd = min(max_fd, cur_max); > > + while (fd <= max_fd) > > + __set_close_on_exec(fd++, fdt); > > + spin_unlock(&cur_fds->file_lock); > > First of all, this is an atrocious way to set all bits > in a range. What's more, you don't want to set it for *all* Hm, good point. Would it make sense to just use the bitmap_set() proposal since the 3 to ~0 case is most common or to actually iterate based on the open fds? Christian