Re: git: b8bb73ab724b - main - pseudofs: Fix LOR in VOP_READDIR.

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Sun, 26 Feb 2023 18:14:39 UTC
On Sun, Feb 26, 2023 at 05:30:22PM +0100, Mateusz Guzik wrote:
> On 2/26/23, Dag-Erling Smørgrav <des@freebsd.org> wrote:
> > The branch main has been updated by des:
> >
> > URL:
> > https://cgit.FreeBSD.org/src/commit/?id=b8bb73ab724b19063481dba089c3dc9a8e1926b1
> >
> > commit b8bb73ab724b19063481dba089c3dc9a8e1926b1
> > Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
> > AuthorDate: 2023-02-26 15:30:53 +0000
> > Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
> > CommitDate: 2023-02-26 15:30:53 +0000
> >
> >     pseudofs: Fix LOR in VOP_READDIR.
> >
> >     MFC after:      3 days
> >     Differential Revision:  https://reviews.freebsd.org/D20862
> > ---
> >  sys/fs/pseudofs/pseudofs_vnops.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/sys/fs/pseudofs/pseudofs_vnops.c
> > b/sys/fs/pseudofs/pseudofs_vnops.c
> > index eae4c1c71ab9..f4e27b469213 100644
> > --- a/sys/fs/pseudofs/pseudofs_vnops.c
> > +++ b/sys/fs/pseudofs/pseudofs_vnops.c
> > @@ -897,8 +897,8 @@ pfs_readdir(struct vop_readdir_args *va)
> >  		if (!pfs_visible_proc(curthread, pd, proc)) {
> >  			_PRELE(proc);
> >  			PROC_UNLOCK(proc);
> > -			sx_sunlock(&allproc_lock);
> >  			pfs_unlock(pd);
> > +			sx_sunlock(&allproc_lock);
> >  			PFS_RETURN (ENOENT);
> >  		}
> >  	}
> >
> 
> this does not fix any LORs. it is legal to *unlock* in any order.

To be pedantic:  it is true that unlock of normal locks is correct in any
order.  There are exceptions for spinlocks.  This is, of course, not relevant
for the commit starting the thread.