* if no retry will be attempted and if object is still alive,
* in other cases we just unlock the object */
if (car->car_hai->hai_action == HSMA_RESTORE) {
+ struct mdt_lock_handle *lh;
+
/* restore in data FID done, we swap the layouts
* only if restore is successful */
if (pgs->hpk_errval == 0 && !IS_ERR(obj)) {
need_changelog = false;
cdt_restore_handle_del(mti, cdt, &car->car_hai->hai_fid);
+ if (!IS_ERR_OR_NULL(obj)) {
+ /* flush UPDATE lock so attributes are upadated */
+ lh = &mti->mti_lh[MDT_LH_OLD];
+ mdt_lock_reg_init(lh, LCK_EX);
+ mdt_object_lock(mti, obj, lh, MDS_INODELOCK_UPDATE);
+ mdt_object_unlock(mti, obj, lh, 1);
+ }
}
GOTO(out, rc);
}
run_test 112 "State of recorded request"
+test_113() {
+ local file1=$DIR/$tdir/$tfile
+ local file2=$DIR2/$tdir/$tfile
+
+ local fid=$(create_small_sync_file $file1)
+
+ stack_trap "zconf_umount \"$(facet_host $SINGLEAGT)\" \"$MOUNT3\"" EXIT
+ zconf_mount "$(facet_host $SINGLEAGT)" "$MOUNT3" ||
+ error "cannot mount '$MOUNT3' on '$SINGLEAGT'"
+
+ copytool setup -m "$MOUNT3"
+
+ do_nodes $(comma_list $(nodes_list)) $LCTL clear
+
+ $LFS hsm_archive $file1 || error "Fail to archive $file1"
+ wait_request_state $fid ARCHIVE SUCCEED
+
+ $LFS hsm_release $file1
+ echo "Verifying released state: "
+ check_hsm_flags $file1 "0x0000000d"
+
+ multiop_bg_pause $file1 oO_WRONLY:O_APPEND:_w4c || error "multiop failed"
+ MULTIPID=$!
+ stat $file2 &
+ kill -USR1 $MULTIPID
+
+ wait
+ sync
+
+ local size1=$(stat -c "%s" $file1)
+ local size2=$(stat -c "%s" $file2)
+
+ [ $size1 -eq $size2 ] || error "sizes are different $size1 $size2"
+}
+run_test 113 "wrong stat after restore"
+
test_200() {
local f=$DIR/$tdir/$tfile
local fid=$(create_empty_file "$f")