Re: nfsd_copy_write_verifier: wrong usage of read_seqbegin_or_lock()

From: Oleg Nesterov
Date: Wed Oct 25 2023 - 14:12:43 EST


On 10/25, Chuck Lever wrote:
>
> On Wed, Oct 25, 2023 at 07:39:31PM +0200, Oleg Nesterov wrote:
> > Hi Chuck,
> >
> > Thanks for your reply. But I am already sleeping and I can't understand it.
>
> I was responding to "I can not understand the intent." But also I
> was hoping that explanation would help you provide a correct
> replacement for the existing code.

In case I was not clear, I have already provided the replacement for the
existing code which looks "correct" for me ;) Nevermind, please forget.

> > 1. Do you agree that the current nfsd_copy_write_verifier() code makes no sense?
>
> Probably.
>
>
> > I mean, the usage of read_seqbegin_or_lock() suggests that if the lockless
> > pass fails it should take writeverf_lock for writing. But this can't happen,
> > and thus this code doesn't look right no matter what. None of the
> > read_seqbegin_or_lock/need_seqretry/done_seqretry helpers make any sense
> > because "seq" is alway even.
>
> > 2. If yes, which change do you prefer? I'd prefer the patch at the end.
>
> Based on my limited understanding of read_seqbegin(), the patch at
> the end seems cleanest and is on-point. Please post an official
> version of that to linux-nfs@ with a full patch description, and
> I'll see that it gets into v6.8-rc with proper tags, review, and
> testing.

Ok, will do tomorrow.

Thanks,

Oleg.