From: Christian Brauner <christian.brauner@ubuntu.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Giuseppe Scrivano <gscrivan@redhat.com>,
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
Date: Tue, 13 Oct 2020 23:32:22 +0200 [thread overview]
Message-ID: <20201013213222.wlnhiocw6zi5eegx@wittgenstein> (raw)
In-Reply-To: <20201013210925.GJ3576660@ZenIV.linux.org.uk>
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
next prev parent reply other threads:[~2020-10-13 21:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-13 14:06 [PATCH 0/2] fs, close_range: add flag CLOSE_RANGE_CLOEXEC Giuseppe Scrivano
2020-10-13 14:06 ` [PATCH 1/2] " Giuseppe Scrivano
2020-10-13 20:54 ` Christian Brauner
2020-10-13 21:04 ` Rasmus Villemoes
2020-10-13 21:22 ` Christian Brauner
2020-10-13 22:45 ` Giuseppe Scrivano
2020-10-13 21:09 ` Al Viro
2020-10-13 21:32 ` Christian Brauner [this message]
2020-10-13 21:49 ` Rasmus Villemoes
2020-10-13 14:06 ` [PATCH 2/2] selftests: add tests for CLOSE_RANGE_CLOEXEC Giuseppe Scrivano
2020-10-13 15:22 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201013213222.wlnhiocw6zi5eegx@wittgenstein \
--to=christian.brauner@ubuntu.com \
--cc=containers@lists.linux-foundation.org \
--cc=gscrivan@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).