Details
-
Bug
-
Resolution: Duplicate
-
Major
-
None
-
Lustre 2.8.0
-
3
-
HSM
-
9223372036854775807
Description
Symlink in shadow directory links to a wrong path when archiving files managed by MDT1(right path when by MDT0).
To reproduce:
[Clinet] # mkdir /lustre/mdt0_dir # lfs mkdir -i 1 /lustre/mdt1_dir/ # echo aaa > /lustre/mdt0_dir/file # echo aaa > /lustre/mdt1_dir/file # lfs hsm_archive /lustre/mdt0_dir/file # lfs hsm_archive /lustre/mdt1_dir/file
[Agent] # ls -l /mnt/hsm-arc/shadow/mdt0_dir/file lrwxrwxrwx 1 root root 55 Apr 15 16:04 /mnt/hsm-arc/shadow/mdt0_dir/file -> ../../0006/0000/0403/0000/0002/0000/0x200000403:0x6:0x0 # ls -l /mnt/hsm-arc/shadow/mdt1_dir/file lrwxrwxrwx 1 root root 58 Apr 15 16:04 /mnt/hsm-arc/shadow/mdt1_dir/file -> ../../../0002/0000/0403/4000/0002/0000/0x240000403:0x2:0x0
This is because lhsmtool_posix counts the number of "/" to figure out how many parent directories to symlink back.
But, llapi_fid2path() adds the pathname to an extra "/" in the case of files managed by MDT1.
So, the symlink links to a wrong path
(This may be a llapi_fid2path's bug).
ptr = opt.o_hsm_root; while (*ptr) (*ptr++ == '/') ? depth-- : 0; rc = llapi_fid2path(opt.o_mnt, buf, src + strlen(src), sizeof(src) - strlen(src), &recno, &linkno); /* Figure out how many parent dirs to symlink back */ ptr = src; while (*ptr) (*ptr++ == '/') ? depth++ : 0; sprintf(buf, ".."); while (--depth > 1) strcat(buf, "/..");
[Clinet] # lfs fid2path /lustre/ 0x200000403:0x6:0x0 /lustre/mdt0_dir/file # lfs fid2path /lustre/ 0x240000403:0x2:0x0 /lustre//mdt1_dir/file