Restore project ID, retention et al in restore_copy

We didn't migrate the extra data from inodes on folders before,
which is a gap in testing. Make sure to test with a nested restored
folder to test that inheritance isn't in the way.

Signed-off-by: Auke Kok <auke.kok@versity.com>
This commit is contained in:
Auke Kok
2025-03-25 15:12:32 -04:00
parent a1e8f38ef3
commit c759928602
3 changed files with 15 additions and 3 deletions

View File

@@ -16,6 +16,8 @@ f /mnt/test/data/mode_t
f /mnt/test/data/uidgid
f /mnt/test/data/retention
f /mnt/test/data/proj
f /mnt/test/data/proj_d/f
d /mnt/test/data/proj_d
d /mnt/test/data
Quota rule: 7 13,L,- 0,L,- 0,L,- I 33 -
Quota rule: 7 11,L,- 0,L,- 0,L,- I 33 -
@@ -31,6 +33,7 @@ crw-r--r--. 1 0 0 2, 2 u
-rw-r--r--. 1 0 0 16777216 truncate
srwxr-xr-x. 1 0 0 0 s
-rw-r--r--. 1 0 0 0 retention
drwxr-xr-x. 2 0 0 1 proj_d
-rw-r--r--. 1 0 0 0 proj
prw-r--r--. 1 0 0 0 p
-rwsrwsrwx. 1 0 0 0 mode_t
@@ -57,6 +60,8 @@ extents: 1
7 12,L,- 0,L,- 0,L,- I 33 -
7 11,L,- 0,L,- 0,L,- I 33 -
7 10,L,- 0,L,- 0,L,- I 33 -
12345
54321
== verify quota rules on restored fs
7 14,L,- 0,L,- 0,L,- I 33 -
7 13,L,- 0,L,- 0,L,- I 33 -

View File

@@ -358,10 +358,11 @@ static struct scoutfs_parallel_restore_inode *read_inode_data(char *path, u64 in
inode->data_seq = 0;
inode->crtime = st.st_ctim;
if (S_ISREG(inode->mode)) {
if (inode->size > 0)
inode->offline = true;
/* we don't restore data */
if (S_ISREG(inode->mode) && (inode->size > 0))
inode->offline = true;
if (S_ISREG(inode->mode) || S_ISDIR(inode->mode)) {
if (is_scoutfs) {
fd = open(path, O_RDONLY);
error_exit(!fd, "open failure"ERRF, ERRA);

View File

@@ -57,6 +57,10 @@ scoutfs set-attr-x -t 1 "$T_M0/data/retention"
# set project ID
touch "$T_M0/data/proj"
scoutfs set-attr-x -p 12345 "$T_M0/data/proj"
mkdir -p "$T_M0/data/proj_d"
touch "$T_M0/data/proj_d/f"
scoutfs set-attr-x -p 12345 "$T_M0/data/proj_d/f"
scoutfs set-attr-x -p 54321 "$T_M0/data/proj_d"
# quotas
for a in $(seq 10 15); do
scoutfs quota-add -p "$T_M0" -r "7 $a,L,- 0,L,- 0,L,- I 33 -"
@@ -77,6 +81,8 @@ inspect() {
scoutfs get-fiemap -L "falloc"
scoutfs get-fiemap -L "truncate"
scoutfs quota-list -p "."
scoutfs get-attr-x -p "proj_d/f"
scoutfs get-attr-x -p "proj_d"
}
( cd "$SCR" ; inspect )