Re: [PATCH 6.12.y] fuse: fix fuse_set_nowrite() race with parallel direct writes

From: Sasha Levin

Date: Mon Nov 23 2026 - 19:12:19 EST


> @@ -1850,6 +1855,7 @@ void fuse_release_nowrite(struct inode *inode)
> spin_lock(&fi->lock);
> __fuse_release_nowrite(inode);
> spin_unlock(&fi->lock);
> + wake_up(&fi->page_waitq);
> }

fuse_do_setattr() drops NOWRITE with __fuse_release_nowrite() directly, so
it never gets this wake_up(). That path can run with the inode lock held
only shared: fuse_direct_IO() -> fuse_do_truncate() when i_size shrank after
fuse_dio_lock() (no writeback_cache). A parallel direct writer sleeping in
the new wait in fuse_set_nowrite() then misses its wakeup and hangs holding
i_rwsem shared. Could you do the wake_up() in __fuse_release_nowrite() (or
on that path as well)?

Since this is a stable-only fix (mainline only fixed it through
0c58a97f919c ("fuse: remove tmp folio for writebacks and internal rb
tree")), it also needs an ack from a FUSE maintainer.

> The patch also applies cleanly to linux-6.6.y (5139929c698c), though
> 6.6.y was not runtime-tested.

6.6.y and 6.1.y have the same bug from 153524053bbb ("fuse: allow
non-extending parallel direct writes on the same file"), so please send
v2 for 6.12.y, 6.6.y and 6.1.y together.

--
Thanks,
Sasha