btrfs-progs icon indicating copy to clipboard operation
btrfs-progs copied to clipboard

"btrfs filesystem du -s ." tries to descend into network mounts or mount points, contrary to the documentation

Open kdave opened this issue 4 years ago • 0 comments
trafficstars

Forward report from: https://bugzilla.kernel.org/show_bug.cgi?id=214591

btrfs filesystem du command gives error when it can not descend int to a folder because of permission and quit further processing when used with -s option.

I have several nfs mount on my home directory and keybase-fuse mount. When I gave the command btrfs filesystem du -s ., the command exit on the first or second encounter of any mounted folder or any folder with not permissible permissions that does not allow descend into the folder. The expected behavior should be an error message relevant to the folder that could not be processed but the process should continue and report the overall size of the given submodule/path.

However if the command is given as btrfs filesystem du * it reports the size of every directory and report error for the mounted directories.

btrfs-filesystem man page states: "Each argument to btrfs filesystem du will have a set shared value calculated for it. We define each set as those files found by a recursive search of an argument (recursion descends to subvolumes but not mount points). The set shared value then is a sum of all shared space referenced by the set."

The documentation states that du should not descend into mount points. However currently btrfs filesystem du -s command tries to descends into mount points contrary what is stated in the documentation, in addition it gives error and stop processing.

Built-in du command (not the one in btrfs) has -x option that prevents du command to descent into other filesystems or network mounts. Even though the current btrfs filesystem du command is broken, an option similar to built-in command option could be helpful.

I have forgotten to add btrfs version which is 5.14.1-1 and I am running up-to-date manjaro with kernel 5.10.68-1.

kdave avatar Nov 03 '21 18:11 kdave