mar-file-system / marfs

MarFS provides a scalable near-POSIX file system by using one or more POSIX file systems as a scalable metadata component and one or more data stores (object, file, etc) as a scalable data component.
Other
96 stars 27 forks source link

FUSE not closing deleted directories after `rm -r` #155

Closed wfvining closed 8 years ago

wfvining commented 8 years ago

FUSE fails to close directories after deleting them when user executes rm -r ./bar/. For example:

$ pwd
/campaign.otl/example.otl/wfvining
$ ls -l
...
drwxr-xr-x 2 wfvining wfvining       4096 Aug 19 11:26 bar
...
$ rm -rf ./bar
$ lsof -p 2721 # marfs_fuse pid
...
marfs_fus 2721 root   12r   DIR               0,23     4096    101129 /gpfs/ccfs1/example.otl/mdfs/wfvining/bar (deleted)
...

The directory remains open whether or not it was empty when it was deleted.

This issue appears with and without MDAL enabled. If the directory is empty and the user executes rmdir ./foo/ then the directory is closed.

Eventually the fuse daemon will run out of file descriptors and stop working.

wfvining commented 8 years ago

I have a fix for this in the branch issue-155. This needs integration testing and a discussion of whether it is a security issue since it circumvents the CHECK_PERMS call in the case of a deleted directory (when the kernel passes path="-").

There is no way to check the permissions in this case since there is no path, and closedir on a DIR* that refers to a deleted directory will not affect the metadata (it will neither read nor write in the mdfs).

jti-lanl commented 8 years ago

The issue was that we potentially skip the R_META test in marfs_releasedir(). However, that seems fine as there was already an RM test in opendir(), and an RM|WM test in rmdir(). If the rmdir test failed, the directory won't have been deleted and closing the dirp in releasedir won't hurt.

wfvining commented 8 years ago

Resolved: e077973