diff --git a/kmod/src/dir.c b/kmod/src/dir.c index 21d29b6b..242a6f5c 100644 --- a/kmod/src/dir.c +++ b/kmod/src/dir.c @@ -1443,6 +1443,11 @@ static int item_d_ancestor(struct super_block *sb, u64 p1, u64 p2, u64 *p_ret) *p_ret = 0; + if (p2 == SCOUTFS_ROOT_INO) { + ret = 0; + goto out; + } + ret = scoutfs_dir_get_backref_path(sb, p2, 0, 0, &list); if (ret) goto out; diff --git a/tests/golden/basic-posix-consistency b/tests/golden/basic-posix-consistency index 87951532..2c5fb6ab 100644 --- a/tests/golden/basic-posix-consistency +++ b/tests/golden/basic-posix-consistency @@ -49,6 +49,7 @@ four --- can't overwrite non-empty dir mv: cannot move ‘/mnt/test/test/basic-posix-consistency/dir/c/clobber’ to ‘/mnt/test/test/basic-posix-consistency/dir/a/dir’: Directory not empty --- can overwrite empty dir +--- can rename into root == path resoluion == inode indexes match after syncing existing == inode indexes match after copying and syncing diff --git a/tests/tests/basic-posix-consistency.sh b/tests/tests/basic-posix-consistency.sh index 5571405a..8b466054 100644 --- a/tests/tests/basic-posix-consistency.sh +++ b/tests/tests/basic-posix-consistency.sh @@ -149,6 +149,10 @@ find "$T_D0/dir" -ls 2>&1 | t_filter_fs > "$T_TMP.0" find "$T_D1/dir" -ls 2>&1 | t_filter_fs > "$T_TMP.1" diff -u "$T_TMP.0" "$T_TMP.1" rm -rf "$T_D0/dir" +echo "--- can rename into root" +touch "$T_D0/rename-into-root" +mv "$T_D0/rename-into-root" "$T_M0/" +rm -f "$T_M0/rename-into-root" echo "== path resoluion" touch "$T_D0/file"