瀏覽代碼

Fixes subvol delete on a non-btrfs volume

Inode numbers are guaranteed to be unique only within a filesystem.
As such there is an edge case where these predicates are true on a
non-btrfs filesystem.

Closes #42271

Signed-off-by: Brett Milford <brettmilford@gmail.com>
Brett Milford 4 年之前
父節點
當前提交
398cb1dc4f
共有 1 個文件被更改,包括 6 次插入4 次删除
  1. 6 4
      contrib/nuke-graph-directory.sh

+ 6 - 4
contrib/nuke-graph-directory.sh

@@ -61,10 +61,12 @@ if command -v btrfs > /dev/null 2>&1; then
 	# Source: http://stackoverflow.com/a/32865333
 	for subvol in $(find "$dir" -type d -inum 256 | sort -r); do
 		if [ "$dir" != "$subvol" ]; then
-			(
-				set -x
-				btrfs subvolume delete "$subvol"
-			)
+			if [ "$(stat -f --format=%T $subvol)" == "btrfs" ]; then
+				(
+					set -x
+					btrfs subvolume delete "$subvol"
+				)
+			fi
 		fi
 	done
 fi