add FUSE_OVFS_IOC_REFRESH_DIR ioctl to refresh directory cache - #462
add FUSE_OVFS_IOC_REFRESH_DIR ioctl to refresh directory cache#462wangjia184 wants to merge 1 commit into
Conversation
|
you need to sign off your commit, and please use a real name for that |
|
|
||
| /// Clear all children and whiteouts. Used by cache invalidation to | ||
| /// force a full re-scan of the directory. | ||
| pub fn clear_children(&mut self) { |
There was a problem hiding this comment.
can't we just use mark_unloaded?
There was a problem hiding this comment.
In fact, I tried mark_unloaded but that does not work for .wh.* changes. And I dont want to change the load part.
| let is_get = cmd_ioctl == libc::FS_IOC_GETVERSION || cmd_ioctl == libc::FS_IOC_GETFLAGS; | ||
|
|
||
| // Custom command: clear and re-scan a directory's children. | ||
| if cmd_ioctl == FUSE_OVFS_IOC_REFRESH_DIR { |
There was a problem hiding this comment.
we need to make sure the caller has appropriate permissions, can a process without privileges call the ioctl?
There was a problem hiding this comment.
There is no special permission required by FUSE_OVFS_IOC_REFRESH_DIR.
There was a problem hiding this comment.
it can be abused by an unprivileged user (e.g. uid != 0 inside the container), to cause a lot of load on the file system as it invalidates the entire directory.
Summary
Add a custom FUSE ioctl (FUSE_OVFS_IOC_REFRESH_DIR) that clears and re-scans a directory's cached children on demand, so that externally created .wh.* whiteout files and other changes to the backing directories become visible
without remounting.
Motivation
When fuse-overlayfs scans a directory for the first time, it caches the child entries and marks the directory as "loaded." Subsequent reads skip the disk scan and return cached results. This means:
The ioctl gives users a way to explicitly refresh a directory when external modifications have been made.