#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
ctime = LTIME_S(inode->i_ctime);
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)
if (IS_ERR(env))
GOTO(out, rc = PTR_ERR(env));
- 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, rc);
+
/* 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. */
}
run_test 252 "Timeout'ed running archive of a removed file should be canceled"
+test_253() {
+ local rc
+ # test needs a running copytool
+ copytool_setup
+
+ mkdir -p $DIR/$tdir
+ local f=$DIR/$tdir/$tfile
+
+ dd if=/dev/zero of=$f bs=1MB count=10
+ local fid=$(path2fid $f)
+
+ $LFS hsm_archive $f || error "could not archive file"
+ wait_request_state $fid ARCHIVE SUCCEED
+
+ # clear locks to discard inode data
+ cancel_lru_locks osc
+
+ #define OBD_FAIL_MDC_MERGE 0x807
+ $LCTL set_param fail_loc=0x807
+
+ #expect error here, instead of release with wrong size
+ $LFS hsm_release $f
+ rc=$?
+ if ((rc == 0)); then
+ file_size=$(stat -c '%s' $f)
+ if ((file_size != 10485760)); then
+ error "Wrong file size after hsm_release"
+ fi
+ else
+ echo "could not release file"
+ fi
+ copytool_cleanup
+}
+run_test 253 "Check for wrong file size after release"
+
test_300() {
# the only way to test ondisk conf is to restart MDS ...
echo "Stop coordinator and remove coordinator state at mount"