Re: git: fe66e4caf456 - main - rangelock: Disable cheat mode by default

From: Mark Johnston <markj_at_freebsd.org>
Date: Wed, 28 Aug 2024 12:55:19 UTC
On Tue, Aug 27, 2024 at 10:09:31PM +0100, Jessica Clarke wrote:
> On 27 Aug 2024, at 21:38, Mark Johnston <markj@FreeBSD.org> wrote:
> > 
> > The branch main has been updated by markj:
> > 
> > URL: https://cgit.FreeBSD.org/src/commit/?id=fe66e4caf4561ee3349ad7a29cc9976108c3b04f
> > 
> > commit fe66e4caf4561ee3349ad7a29cc9976108c3b04f
> > Author:     Mark Johnston <markj@FreeBSD.org>
> > AuthorDate: 2024-08-27 20:31:25 +0000
> > Commit:     Mark Johnston <markj@FreeBSD.org>
> > CommitDate: 2024-08-27 20:36:31 +0000
> > 
> >    rangelock: Disable cheat mode by default
> > 
> >    Cheat mode is incompatible with code which locks multiple ranges in the
> >    same vnode, with at least one range being write-locked.  This can arise
> >    in kern_copy_file_range().  Until that's handled somehow, avoid the
> >    problem to make the fusefs tests stable.
> > 
> >    PR:             281073
> >    Fixes:          9ef425e560a9 ("rangelocks: add fast cheating mode")
> >    Reviewed by:    kib
> >    Differential Revision:  https://reviews.freebsd.org/D46457
> > ---
> > sys/kern/kern_rangelock.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/sys/kern/kern_rangelock.c b/sys/kern/kern_rangelock.c
> > index 14163dd1c782..38449f71a8b7 100644
> > --- a/sys/kern/kern_rangelock.c
> > +++ b/sys/kern/kern_rangelock.c
> > @@ -66,7 +66,7 @@
> >  * trylocks are same as normal locks but do not drain.
> >  */
> > 
> > -static int rangelock_cheat = 1;
> > +static int rangelock_cheat = 0;
> 
> This probably deserves a comment for why it’s disabled/the risks of
> enabling it, and/or some text in the sysctl description?

There's already a patch which aims to fix the underlying problem,
https://reviews.freebsd.org/D46465, so I will hold off on making further
changes here.

> Jess
> 
> > SYSCTL_INT(_debug, OID_AUTO, rangelock_cheat, CTLFLAG_RWTUN,
> >     &rangelock_cheat, 0,
> >     "");
>