- 20年前的2005年,在libfuse 2.2版本开始中支持了nonempty参数,用于避免用户fuse程序挂载时,在无意识的情况下覆盖了用户的文件夹而不知情,造成预期外的问题。
fix · libfuse/libfuse@437d811 · GitHub
本质上就是在挂载时判断挂载点是否除了'.'和'..'之外,还有其他文件。若有,且没有配置nonempty参数,则会报错'mountpoint is not empty, if you are sure this is safe, use the 'nonempty' mount option'。
2. 在libfuse 3.0.0 (2016-12-08)中,移除了对nonempty的支持,认为在非空目录上挂载始终是允许的。这样设计是为了降低libfuse的复杂度。这是个简单而独立的功能,把这部分逻辑放给fuse程序的开发者:如果开发者认为需要这个功能,就在调用libfuse接口前自行实现拦截即可。
Removed -o nonempty option · libfuse/libfuse@0bef21e · GitHub
* The `-o nonempty` mount point has been removed, mounting over
non-empty directories is now always allowed. This brings the
behavior of FUSE file systems in-line with the behavior of the
regular `mount` command.
File systems that do not want to allow mounting to non-empty
directories should perform this check themselves before handing
control to libfuse.
3. libfuse 3.10.2 (2021-02-05)中,又加入了nonempty的支持,但只是保持对libfuse2中的兼容性,不让其报错,实际上还是始终允许在非空目录上挂载:
Ignore "-o nonempty" (#582) · libfuse/libfuse@b9e3ea0 · GitHub
* Allow "nonempty" as a mount option, for backwards compatibility with fusermount 2. The
option has no effect since mounting over non-empty directories is allowed by default.
* Fix returning inode numbers from readdir() in offset==0 mode.
* FUSE filesystems can now be mounted underneath EXFAT mountpoints.
* Various minor bugfixes.
4. jacobsa/fuse在实现上会先检查客户端是否有fusermount3,若有,则优先使用该版本。若没有,才退而求其次到fusermount2。
Version 0.31 and later contains prefer fusermount3 (from FUSE 3), fall back to old fusermount · jacobsa/fuse@b6e2754 · GitHub
in a dependency library, which upgrades the fusermount to fusermount3 when the latter is available.
The options used by fusermount and fusermount3 are different. Option nonempty is supported by fusermount, but not fusermount3. So, when the OS has fusermount3 installed and nonempty used, the mounting will fail.
Simple fix: Remove nonempty when upgrading gcsfuse to v0.31 or later.
5. gcsfuse也没有支持该功能:
Error mounting bucket with 0.31 · Issue #424 · GoogleCloudPlatform/gcsfuse · GitHub
6. mount.fuse3没有针对nonempty的选项: