PCC_DETACH_FL_KNOWN_READONLY = 0x04,
/* Indicate PCC cached copy is removed */
PCC_DETACH_FL_CACHE_REMOVED = 0x08,
+ /* Indicate the file is being attached */
+ PCC_DETACH_FL_ATTACHING = 0x10,
};
struct lu_pcc_detach_fid {
pcc_inode_lock(inode);
pcci = lli->lli_pcc_inode;
- if (!pcci || lli->lli_pcc_state & PCC_STATE_FL_ATTACHING ||
- !pcc_inode_has_layout(pcci))
+ if (lli->lli_pcc_state & PCC_STATE_FL_ATTACHING) {
+ *flags |= PCC_DETACH_FL_ATTACHING;
+ GOTO(out_unlock, rc = 0);
+ }
+
+ if (!pcci || !pcc_inode_has_layout(pcci))
GOTO(out_unlock, rc = 0);
LASSERT(atomic_read(&pcci->pcci_refcount) > 0);
llapi_printf(LLAPI_MSG_DEBUG,
"Detach and remove the PCC cached file: %s\n",
fidname);
+ } else if (detach.pccd_flags & PCC_DETACH_FL_ATTACHING) {
+ llapi_printf(LLAPI_MSG_DEBUG,
+ "'%s' is being attached, skip it", fidname);
} else {
snprintf(fullname, sizeof(fullname), "%s/%s", pname, fidname);
llapi_printf(LLAPI_MSG_DEBUG,