Re: [PATCH] 9p: fix access mode flags being ORed instead of replaced
From: Pierre Barre
Date: Thu Apr 16 2026 - 02:43:28 EST
> Note your patch converted tabs to space and couldn't be applied -- if
> you have to send patches by web mail please attach them instead, that'll
> be easier to apply than a corrupted patch, even if some tooling like
> sashiko won't run (it doesn't run on corrupted patches anyway..)
Argh, I'll just commit to using git-send-email from now on.
> If you're fine with my wording for the comment I'll modify it in place,
Sounds great, thank you.
Pierre.
On Thu, Apr 16, 2026, at 04:53, Dominique Martinet wrote:
> Christian Schoenebeck wrote on Thu, Apr 09, 2026 at 04:51:07PM +0200:
>> > diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
>> > index 057487efaaeb..05a5e1c4df35 100644
>> > --- a/fs/9p/v9fs.c
>> > +++ b/fs/9p/v9fs.c
>> > @@ -413,7 +413,11 @@ static void v9fs_apply_options(struct v9fs_session_info
>> > *v9ses, /*
>> > * Note that we must |= flags here as session_init already
>> > * set basic flags. This adds in flags from parsed options.
>> > + * Access flags are mutually exclusive, so clear any access
>> > + * bits set by session_init before applying the user's choice.
>>
>> That phrase is a bit suboptimal, because V9FS_ACCESS_ANY is actually a bit
>> combination of single, user and client. But OK, I currently don't have a
>> better phrase for it since the access fields have to be replaced altogether.
>
> Yeah, it's not so much that they're mutually exclusive that we need to
> clear the default value before applying the settings.
> The key distinction here is that it's not "any access bits set" -- if it
> were arbitrary values then it wouldn't be acceptable to just or the
> flags out, you could risk e.g. creating a client with 2000L but setting
> another protocol in the flags and there'd be no end of things to check.
>
> Something like this?
> * Default access flags must be cleared if session options
> * change them to avoid mangling the setting.
>
>> As for the actual behaviour change; makes sense to me:
>
> Yes, that works for me.
>
> Note your patch converted tabs to space and couldn't be applied -- if
> you have to send patches by web mail please attach them instead, that'll
> be easier to apply than a corrupted patch, even if some tooling like
> sashiko won't run (it doesn't run on corrupted patches anyway..)
>
>
> If you're fine with my wording for the comment I'll modify it in place,
> otherwise we have a few more days to discuss this before I sent to Linus
> for 7.1-rc1
> (and I'm really sorry for my lack of reactivity, I'm sure I'll miss some
> patches anyway...)
>
> --
> Dominique Martinet | Asmadeus