On Thu, Sep 21, 2023 at 10:05:24AM +0200, Max Kellermann wrote: > On Thu, Sep 21, 2023 at 9:28 AM Max Kellermann <max.kellermann@xxxxxxxxx> wrote: > > I had another look at this, and something's fishy with the code or > > with your explanation (or I still don't get it). If there is a > > watch_queue, pipe_write() fails early with EXDEV - writing to such a > > pipe is simply forbidden, the code is not reachable in the presence of > > a watch_queue, therefore locking just because there might be a > > wait_queue does not appear to make sense? > > Meanwhile I have figured that the spinlock in pipe_write() is > obsolete. It was added by David as preparation for the notification > feature, but the notification was finally merged, it had the EXDEV, > and I believe it was not initially planned to implement it that way? It was supposed to get write support most likely but never got it. Good catch. > So I believe the spinlock is really not necessary (anymore) and I have For pipe_write() it isn't we still need it for pipe_read().