Whamcloud - gitweb
LU-10092 llite: Add persistent cache on client
[fs/lustre-release.git] / lustre / utils / lhsmtool_posix.c
index 93e72be..ce1e48e 100644 (file)
@@ -1243,6 +1243,16 @@ static int ct_restore(const struct hsm_action_item *hai, const long hal_flags)
                goto fini;
        }
 
+       /* When restore request for a file triggered by read/write/
+        * truncate operation from another client, it needs to detach
+        * the file first if it is PCC-attached.
+        */
+       rc = llapi_pcc_detach_fid_fd(opt.o_mnt_fd, &hai->hai_fid);
+       if (rc) {
+               CT_ERROR(rc, "cannot detach pcc for file '%s'", dst);
+               goto fini;
+       }
+
        dst_fd = llapi_hsm_action_get_fd(hcp);
        if (dst_fd < 0) {
                rc = dst_fd;