Re: [PATCH 1/2] fs, close_range: add flag CLOSE_RANGE_CLOEXEC

2020-10-14 Thread Rasmus Villemoes
On 13/10/2020 23.09, Al Viro wrote: > On Tue, Oct 13, 2020 at 04:06:08PM +0200, Giuseppe Scrivano wrote: >> +spin_lock(_fds->file_lock); >> +fdt = files_fdtable(cur_fds); >> +cur_max = fdt->max_fds - 1; >> +max_fd = min(max_fd, cur_max); >> +

Re: [PATCH 1/2] fs, close_range: add flag CLOSE_RANGE_CLOEXEC

2020-10-13 Thread Giuseppe Scrivano
Christian Brauner writes: > On Tue, Oct 13, 2020 at 04:06:08PM +0200, Giuseppe Scrivano wrote: > > Hey Guiseppe, > > Thanks for the patch! > >> When the flag CLOSE_RANGE_CLOEXEC is set, close_range doesn't >> immediately close the files but it sets the close-on-exec bit. > > Hm, please expand on

Re: [PATCH 1/2] fs, close_range: add flag CLOSE_RANGE_CLOEXEC

2020-10-13 Thread Christian Brauner
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(_fds->file_lock); > > + fdt = files_fdtable(cur_fds); > > + cur_max = fdt->max_fds - 1; > > + max_fd = min(max_fd,

Re: [PATCH 1/2] fs, close_range: add flag CLOSE_RANGE_CLOEXEC

2020-10-13 Thread Christian Brauner
On Tue, Oct 13, 2020 at 11:04:21PM +0200, Rasmus Villemoes wrote: > On 13/10/2020 22.54, Christian Brauner wrote: > > On Tue, Oct 13, 2020 at 04:06:08PM +0200, Giuseppe Scrivano wrote: > > > > Hey Guiseppe, > > > > Thanks for the patch! > > > >> When the flag CLOSE_RANGE_CLOEXEC is set,

Re: [PATCH 1/2] fs, close_range: add flag CLOSE_RANGE_CLOEXEC

2020-10-13 Thread Al Viro
On Tue, Oct 13, 2020 at 04:06:08PM +0200, Giuseppe Scrivano wrote: > + spin_lock(_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) > +

Re: [PATCH 1/2] fs, close_range: add flag CLOSE_RANGE_CLOEXEC

2020-10-13 Thread Rasmus Villemoes
On 13/10/2020 22.54, Christian Brauner wrote: > On Tue, Oct 13, 2020 at 04:06:08PM +0200, Giuseppe Scrivano wrote: > > Hey Guiseppe, > > Thanks for the patch! > >> When the flag CLOSE_RANGE_CLOEXEC is set, close_range doesn't >> immediately close the files but it sets the close-on-exec bit. >

Re: [PATCH 1/2] fs, close_range: add flag CLOSE_RANGE_CLOEXEC

2020-10-13 Thread Christian Brauner
On Tue, Oct 13, 2020 at 04:06:08PM +0200, Giuseppe Scrivano wrote: Hey Guiseppe, Thanks for the patch! > When the flag CLOSE_RANGE_CLOEXEC is set, close_range doesn't > immediately close the files but it sets the close-on-exec bit. Hm, please expand on the use-cases a little here so people

[PATCH 1/2] fs, close_range: add flag CLOSE_RANGE_CLOEXEC

2020-10-13 Thread Giuseppe Scrivano
When the flag CLOSE_RANGE_CLOEXEC is set, close_range doesn't immediately close the files but it sets the close-on-exec bit. Signed-off-by: Giuseppe Scrivano --- fs/file.c| 56 ++-- include/uapi/linux/close_range.h | 3 ++ 2 files changed, 42