Re: [PATCH] kernel/watch_queue: Make pipe NULL while clearing watch_queue

From: Siddh Raman Pant
Date: Sat Jul 23 2022 - 10:30:29 EST


On Sat, 23 Jul 2022 19:34:17 +0530 Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> Also you now have a spinlock held when calling rcu_read_unlock(), are
> you sure that's ok?
>
>

We logically should not do write operations in a read critical section, so the
nulling of `wqueue->pipe->watch_queue` should happen after rcu_read_unlock().
Also, since we already have a spinlock, we can use it to ensure the nulling.
So I think it is okay.

Though, it is my first time encountering a spinlock and an rcu lock together,
so if I am wrong, please do correct me.

Thanks,
Siddh