Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 40c4f6fd authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Pradeep P V K
Browse files

fuse: make sure reclaim doesn't write the inode



In writeback cache mode mtime/ctime updates are cached, and flushed to the
server using the ->write_inode() callback.

Closing the file will result in a dirty inode being immediately written,
but in other cases the inode can remain dirty after all references are
dropped.  This result in the inode being written back from reclaim, which
can deadlock on a regular allocation while the request is being served.

The usual mechanisms (GFP_NOFS/PF_MEMALLOC*) don't work for FUSE, because
serving a request involves unrelated userspace process(es).

Instead do the same as for dirty pages: make sure the inode is written
before the last reference is gone.

 - fallocate(2)/copy_file_range(2): these call file_update_time() or
   file_modified(), so flush the inode before returning from the call

 - unlink(2), link(2) and rename(2): these call fuse_update_ctime(), so
   flush the ctime directly from this helper

fuse_flush_time_update(inode) was skipped to call in __fuse_copy_file_range()
because of huge dependent changes.

Change-Id: I102dab1992c9ed2b5e89606265b3d3aa9c1cdb8a
Reported-by: default avatarchenguanyou <chenguanyou@xiaomi.com>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
Git-commit: 5c791fe1e2a4f401f819065ea4fc0450849f1818
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarPradeep P V K <quic_pragalla@quicinc.com>
parent 2b533456
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment