Re: [PATCH v2 09/24] file: Replace fcheck_files with files_lookup_fd_rcu

From: Al Viro
Date: Mon Dec 07 2020 - 17:50:04 EST


On Mon, Dec 07, 2020 at 10:46:57PM +0000, Al Viro wrote:
> On Fri, Nov 20, 2020 at 05:14:26PM -0600, Eric W. Biederman wrote:
>
> > /*
> > * Check whether the specified fd has an open file.
> > */
> > -#define fcheck(fd) fcheck_files(current->files, fd)
> > +#define fcheck(fd) files_lookup_fd_rcu(current->files, fd)
>
> Huh?
> fs/file.c:1113: file = fcheck(oldfd);
> dup3(), under ->file_lock, no rcu_read_lock() in sight
>
> fs/locks.c:2548: f = fcheck(fd);
> fcntl_setlk(), ditto
>
> fs/locks.c:2679: f = fcheck(fd);
> fcntl_setlk64(), ditto
>
> fs/notify/dnotify/dnotify.c:330: f = fcheck(fd);
> fcntl_dirnotify(); this one _is_ under rcu_read_lock().
>
>
> IOW, unless I've missed something earlier in the series, this is wrong.

I have missed something, all right. Ignore that comment...