Skip to content

fuse: fix races related to fuse writeback

Maxim Patlasov lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2fuse: postpone end_page_writeback() in fuse_writepage_locked()fs/fuse/file.c+2 -11 reply
2/2fuse: wait for writeback in fuse_file_fallocate()fs/fuse/file.c+44 -94 replies
2/2fuse: wait for writeback in fuse_file_fallocate() -v2fs/fuse/file.c+48 -69 replies

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchBrian Foster
1/2
2/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] fuse: fix races related to fuse writeback

Hi,

The patchset fixes a few subtle races stemmed from incorrect expectation of what fuse_set_nowrite() guarantees. The fact that it makes fi->writectr negative and waits for fi->writectr == FUSE_NOWRITE ensures only two things:

1) If there are any in-flight writeback requests right now, let's wait for them being completed.
2) Suspend processing new writeback requests until fuse_release_nowrite().

Both are related to communication between in-kernel fuse and userspace fuse daemon. But fuse_set_nowrite() does not prevent generic kernel code from sending dirty pages to writeback resulting in fuse_writepage being called. I.e. fi->queued_writes may grow independently on fuse_set_nowrite() machinery.

As soon as fuse_writepage_locked() called end_page_writeback() generic kernel code may do with the page virtually anything w/o notifying fuse. See per-patch descriptions for details of some races.

Thanks,
Maxim

---

Maxim Patlasov (2):
fuse: postpone end_page_writeback() in fuse_writepage_locked()
fuse: wait for writeback in fuse_file_fallocate()

 fs/fuse/file.c |   56 ++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 46 insertions(+), 10 deletions(-)
Signature · 1 line
Signature