@@ -384,6 +384,7 @@
#define OBD_FAIL_MDC_RPCS_SEM 0x804
#define OBD_FAIL_MDC_LIGHTWEIGHT 0x805
#define OBD_FAIL_MDC_CLOSE 0x806
+#define OBD_FAIL_MDC_MERGE 0x807
#define OBD_FAIL_MGS 0x900
#define OBD_FAIL_MGS_ALL_REQUEST_NET 0x901
@@ -1133,7 +1133,10 @@ int ll_merge_attr(const struct lu_env *env, struct inode *inode)
ctime = inode->i_ctime.tv_sec;
cl_object_attr_lock(obj);
- rc = cl_object_attr_get(env, obj, attr);
+ if (OBD_FAIL_CHECK(OBD_FAIL_MDC_MERGE))
+ rc = -EINVAL;
+ else
+ rc = cl_object_attr_get(env, obj, attr);
cl_object_attr_unlock(obj);
if (rc != 0) {
@@ -2050,9 +2053,15 @@ int ll_hsm_release(struct inode *inode)
goto out;
}
- ll_merge_attr(env, inode);
+ rc = ll_merge_attr(env, inode);
cl_env_put(env, &refcheck);
+ /* If error happen, we have the wrong size for a file.
+ * Don't release it.
+ */
+ if (rc != 0)
+ goto out;
+
/* Release the file.
* NB: lease lock handle is released in mdc_hsm_release_pack() because
* we still need it to pack l_remote_handle to MDT.