}
/* fixup layout information */
- lod_obj_inc_layout_gen(lo);
- lcm->lcm_layout_gen = cpu_to_le32(lo->ldo_layout_gen);
lcm->lcm_size = cpu_to_le32(size);
lcm->lcm_entry_count = cpu_to_le16(cur_entry_count + merge_entry_count);
lcm->lcm_mirror_count = cpu_to_le16(mirror_count);
if (rc)
GOTO(out, rc);
+ lod_obj_inc_layout_gen(lo);
+ lcm->lcm_layout_gen = cpu_to_le32(lo->ldo_layout_gen);
+
rc = lod_sub_declare_xattr_set(env, dt_object_child(dt), buf,
XATTR_NAME_LOV, LU_XATTR_REPLACE, th);
}
run_test 50d "mirror rsync keep holes"
+test_51a() {
+ local file="$DIR/$tdir/$tfile"
+ local mdt_index
+ local gen1
+ local gen2
+
+ test_mkdir $DIR/$tdir
+ rm -f -- "$file"
+
+ $LFS mirror create -N -E 1M -c 1 -E eof -c2 "$file"
+ echo XXX > "$file"
+ mdt_index=$($LFS getstripe --mdt-index "$file")
+ echo "mdt_index = $mdt_index" >&2
+
+ gen1=$($LFS getstripe "$file" | awk '$1 == "lcm_layout_gen:" { print $2; }')
+ # $LFS getstripe "$file"
+ echo "gen1 = '$gen1'" >&2
+ if [[ -z "$gen1" ]]; then
+ error "cannot get layout generation of '$file'"
+ fi
+
+ # I tried do do this with several combinations of sync,
+ # drop_caches, cancel_lru_locks on the client and mds but they
+ # didn't reliably reproduce the issue of incorrect layout
+ # generation after merge.
+ umount_client $MOUNT || error "cannot unmount '$MOUNT'"
+ stop mds$((mdt_index + 1)) || error "cannot stop mds$((mdt_index + 1))"
+ start mds$((mdt_index + 1)) || error "cannot start mds$((mdt_index + 1))"
+ mount_client $MOUNT || error "cannot mount '$MOUNT'"
+
+ $LFS mirror extend -N -c1 "$file"
+ gen2=$($LFS getstripe "$file" | awk '$1 == "lcm_layout_gen:" { print $2; }')
+ echo "gen2 = '$gen2'" >&2
+ # $LFS getstripe "$file"
+
+ if [[ -z "$gen2" ]]; then
+ error "cannot get layout generation of '$file'"
+ fi
+
+ if ! ((gen1 < gen2)); then
+ error "mirror extend did not increase layout generation"
+ fi
+}
+run_test 51a "mirror extend increases layout generation"
+
test_60a() {
$LCTL get_param osc.*.import | grep -q 'connect_flags:.*seek' ||
skip "OST does not support SEEK_HOLE"