YAS3FS (Yet Another S3-backed File System) is a Filesystem in Userspace (FUSE) interface to Amazon S3. It was inspired by s3fs but rewritten from scratch to implement a distributed cache synchronized by Amazon SNS notifications. A web console is provided to easily monitor the nodes of a cluster.
removedirs() tries to successively remove every parent directory mentioned in path until an error is raised (which is ignored, because it generally means that a parent directory is not empty).
Therefore if /tmp is empty after deleting /tmp/yas3fs, then it will be deleted too.
What should happen
yas3fs shouldn't recursively delete beyond its own cache path (i.e. the --cache-path option, in this case /tmp/yas3fs)
It might be necessary to implement a custom recursive delete function rather than use os.removedirs(), since it doesn't look like it's possible to limit that to a specific root directory.
Hi,
I've discovered a specific set of conditions under which the entire
/tmp
directory is deleted when yas3fs cleans its cache.This causes all sorts of problems in Linux since
/tmp
is a system directory that should always exist.How to recreate
/tmp
directory./tmp/yas3fs/...
/tmp/yas3fs
directory is deleted/tmp
is now empty so it gets deletedWhy it happens
This happens because
FSCache.delete()
callsFSData.delete()
, which callsremove_empty_dirs_for_file()
, which callsremove_empty_dirs()
, which usesos.removedirs()
.The docs for os.removedirs() say that:
Therefore if
/tmp
is empty after deleting/tmp/yas3fs
, then it will be deleted too.What should happen
yas3fs shouldn't recursively delete beyond its own cache path (i.e. the
--cache-path
option, in this case/tmp/yas3fs
)It might be necessary to implement a custom recursive delete function rather than use
os.removedirs()
, since it doesn't look like it's possible to limit that to a specific root directory.