struct lu_env *env;
struct obd_client_handle *och = NULL;
__u64 data_version = 0;
- int rc;
__u16 refcheck;
+ int rc;
+
ENTRY;
CDEBUG(D_INODE, "%s: Releasing file "DFID".\n",
GOTO(out, rc = PTR_ERR(och));
/* Grab latest data_version and [am]time values */
- rc = ll_data_version(inode, &data_version, LL_DV_WR_FLUSH);
+ rc = ll_data_version(inode, &data_version,
+ LL_DV_WR_FLUSH | LL_DV_SZ_UPDATE);
if (rc != 0)
GOTO(out, rc);
const struct cl_io_slice *slice)
{
struct cl_data_version_io *dv = &slice->cis_io->u.ci_data_version;
- struct osc_io *oio = cl2osc_io(env, slice);
+ struct osc_io *oio = cl2osc_io(env, slice);
+ struct cl_object *obj = slice->cis_obj;
struct osc_async_cbargs *cbargs = &oio->oi_cbarg;
+ struct cl_attr *attr = &osc_env_info(env)->oti_attr;
+ struct obdo *oa = &oio->oi_oa;
+ unsigned int cl_valid = 0;
ENTRY;
wait_for_completion(&cbargs->opc_sync);
slice->cis_io->ci_result = cbargs->opc_rc;
} else {
slice->cis_io->ci_result = 0;
- if (!(oio->oi_oa.o_valid &
+ if (!(oa->o_valid &
(OBD_MD_LAYOUT_VERSION | OBD_MD_FLDATAVERSION)))
slice->cis_io->ci_result = -ENOTSUPP;
- if (oio->oi_oa.o_valid & OBD_MD_LAYOUT_VERSION)
- dv->dv_layout_version = oio->oi_oa.o_layout_version;
- if (oio->oi_oa.o_valid & OBD_MD_FLDATAVERSION)
- dv->dv_data_version = oio->oi_oa.o_data_version;
+ if (oa->o_valid & OBD_MD_LAYOUT_VERSION)
+ dv->dv_layout_version = oa->o_layout_version;
+ if (oa->o_valid & OBD_MD_FLDATAVERSION)
+ dv->dv_data_version = oa->o_data_version;
+
+ if (dv->dv_flags & LL_DV_SZ_UPDATE) {
+ if (oa->o_valid & OBD_MD_FLSIZE) {
+ attr->cat_size = oa->o_size;
+ cl_valid |= CAT_SIZE;
+ }
+
+ if (oa->o_valid & OBD_MD_FLBLOCKS) {
+ attr->cat_blocks = oa->o_blocks;
+ cl_valid |= CAT_BLOCKS;
+ }
+
+ cl_object_attr_lock(obj);
+ cl_object_attr_update(env, obj, attr, cl_valid);
+ cl_object_attr_unlock(obj);
+ }
}
EXIT;
}
run_test 260c "Requests are not reordered on the 'hot' path of the coordinator"
+test_261() {
+ local file=$DIR/$tdir/$tfile
+ local size
+ local fid
+
+ copytool setup
+ mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
+
+ dd if=/dev/zero of=$file bs=4k count=2 || error "Write $file failed"
+ fid=$(path2fid $file)
+ $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $file
+ wait_request_state $fid ARCHIVE SUCCEED
+
+ $LFS hsm_state $file
+ $LFS hsm_release $file
+ $LFS hsm_restore $file
+ wait_request_state $fid RESTORE SUCCEED
+ $LFS hsm_release $file
+ size=$(stat -c %s $file)
+ [[ $size == 8192 ]] || error "Size after HSM release: $size"
+
+ $LFS hsm_release $file
+ $LFS hsm_restore $file
+ $LFS hsm_release $file
+ size=$(stat -c %s $file)
+ [[ $size == 8192 ]] || error "Size after HSM release: $size"
+ $LFS hsm_state $file
+}
+run_test 261 "Report 0 bytes size after HSM release"
+
test_300() {
[ "$CLIENTONLY" ] && skip "CLIENTONLY mode" && return