Re: [PATCH v1 1/2] open: add close_range()

2019-05-24 Thread Christian Brauner
On Thu, May 23, 2019 at 07:22:17PM +0300, Konstantin Khlebnikov wrote: > On 22.05.2019 18:52, Christian Brauner wrote:> This adds the close_range() > syscall. It allows to efficiently close a range > > of file descriptors up to all file descriptors of a calling task. > > > > The syscall came up

Re: [PATCH v1 1/2] open: add close_range()

2019-05-24 Thread Christian Brauner
On Fri, May 24, 2019 at 09:43:53AM +0200, Arnd Bergmann wrote: > On Thu, May 23, 2019 at 6:33 PM Christian Brauner > wrote: > > On Thu, May 23, 2019 at 07:22:17PM +0300, Konstantin Khlebnikov wrote: > > > On 22.05.2019 18:52, Christian Brauner wrote:> This adds the > > > close_range() syscall.

Re: [PATCH v1 1/2] open: add close_range()

2019-05-24 Thread Arnd Bergmann
On Thu, May 23, 2019 at 6:33 PM Christian Brauner wrote: > On Thu, May 23, 2019 at 07:22:17PM +0300, Konstantin Khlebnikov wrote: > > On 22.05.2019 18:52, Christian Brauner wrote:> This adds the close_range() > > syscall. It allows to efficiently close a range > > > 22 files changed, 100

Re: [PATCH v1 1/2] open: add close_range()

2019-05-23 Thread Christian Brauner
On Thu, May 23, 2019 at 07:22:17PM +0300, Konstantin Khlebnikov wrote: > On 22.05.2019 18:52, Christian Brauner wrote:> This adds the close_range() > syscall. It allows to efficiently close a range > > of file descriptors up to all file descriptors of a calling task. > > > > The syscall came up

RE: [PATCH v1 1/2] open: add close_range()

2019-05-23 Thread David Laight
From: Konstantin Khlebnikov > Sent: 23 May 2019 17:22 > > In addition, the syscall will also work for tasks that do not have procfs > > mounted and on kernels that do not have procfs support compiled in. In such > > situations the only way to make sure that all file descriptors are closed

Re: [PATCH v1 1/2] open: add close_range()

2019-05-23 Thread Konstantin Khlebnikov
On 22.05.2019 18:52, Christian Brauner wrote:> This adds the close_range() syscall. It allows to efficiently close a range > of file descriptors up to all file descriptors of a calling task. > > The syscall came up in a recent discussion around the new mount API and > making new file descriptor

Re: [PATCH v1 1/2] open: add close_range()

2019-05-23 Thread Oleg Nesterov
On 05/23, Christian Brauner wrote: > > So given that we would really need another find_next_open_fd() I think > sticking to the simple cond_resched() version I sent before is better > for now until we see real-world performance issues. OK, agreed. Oleg.

Re: [PATCH v1 1/2] open: add close_range()

2019-05-23 Thread Christian Brauner
On Thu, May 23, 2019 at 04:32:14PM +0200, Jann Horn wrote: > On Thu, May 23, 2019 at 1:51 PM Christian Brauner > wrote: > [...] > > I kept it dumb and was about to reply that your solution introduces more > > code when it seemed we wanted to keep this very simple for now. > > But then I saw that

Re: [PATCH v1 1/2] open: add close_range()

2019-05-23 Thread Christian Brauner
On Thu, May 23, 2019 at 04:14:47PM +0200, Christian Brauner wrote: > On Thu, May 23, 2019 at 01:51:18PM +0200, Christian Brauner wrote: > > On Wed, May 22, 2019 at 06:57:37PM +0200, Oleg Nesterov wrote: > > > On 05/22, Christian Brauner wrote: > > > > > > > > +static struct file *pick_file(struct

Re: [PATCH v1 1/2] open: add close_range()

2019-05-23 Thread Christian Brauner
On Thu, May 23, 2019 at 01:51:18PM +0200, Christian Brauner wrote: > On Wed, May 22, 2019 at 06:57:37PM +0200, Oleg Nesterov wrote: > > On 05/22, Christian Brauner wrote: > > > > > > +static struct file *pick_file(struct files_struct *files, unsigned fd) > > > { > > > - struct file *file; > > > +

Re: [PATCH v1 1/2] open: add close_range()

2019-05-23 Thread Christian Brauner
On Wed, May 22, 2019 at 06:57:37PM +0200, Oleg Nesterov wrote: > On 05/22, Christian Brauner wrote: > > > > +static struct file *pick_file(struct files_struct *files, unsigned fd) > > { > > - struct file *file; > > + struct file *file = NULL; > > struct fdtable *fdt; > > > >

Re: [PATCH v1 1/2] open: add close_range()

2019-05-22 Thread Oleg Nesterov
On 05/22, Christian Brauner wrote: > > +static struct file *pick_file(struct files_struct *files, unsigned fd) > { > - struct file *file; > + struct file *file = NULL; > struct fdtable *fdt; > > spin_lock(>file_lock); > @@ -632,15 +629,65 @@ int __close_fd(struct