On Tue, Mar 27, 2018 at 11:18:29AM +0200, Martin Pieuchot wrote: > FREF() is currently needed before any sleep point. That's because > there's almost no parallelism in the top half of the kernel. I'd > like to improve that. > > The first step is to make sure all operations manipulating a > 'struct file *' do so with a properly refcounted element. So here's > a diff moving FREF() just after fd_getfile() in sys_flock(). > > Ok?
OK bluhm@ > Index: kern/kern_descrip.c > =================================================================== > RCS file: /cvs/src/sys/kern/kern_descrip.c,v > retrieving revision 1.142 > diff -u -p -r1.142 kern_descrip.c > --- kern/kern_descrip.c 19 Feb 2018 08:59:52 -0000 1.142 > +++ kern/kern_descrip.c 27 Mar 2018 09:12:45 -0000 > @@ -1205,9 +1205,11 @@ sys_flock(struct proc *p, void *v, regis > > if ((fp = fd_getfile(fdp, fd)) == NULL) > return (EBADF); > - if (fp->f_type != DTYPE_VNODE) > - return (EOPNOTSUPP); > FREF(fp); > + if (fp->f_type != DTYPE_VNODE) { > + error = EOPNOTSUPP; > + goto out; > + } > vp = fp->f_data; > lf.l_whence = SEEK_SET; > lf.l_start = 0;