RETURN(rc);
if (rc > 0) {
+ struct layout_intent *intent = mlc->mlc_intent;
+
lustre_som_swab(som);
if (som->lsa_valid & SOM_FL_STRICT)
fl = LU_XATTR_REPLACE;
+
+ if (mlc->mlc_opc == MD_LAYOUT_WRITE &&
+ intent->li_extent.e_end > som->lsa_size) {
+ fl = LU_XATTR_REPLACE;
+ som->lsa_size = intent->li_extent.e_end;
+ if (intent->li_opc == LAYOUT_INTENT_TRUNC)
+ som->lsa_size -= 1;
+ }
}
rc = mdd_declare_layout_change(env, mdd, obj, mlc, handle);
struct thandle *handle)
{
struct mdd_device *mdd = mdd_obj2mdd_dev(obj);
+ struct lu_buf *som_buf = &mdd_env_info(env)->mti_buf[1];
+ struct lustre_som_attrs *som = &mlc->mlc_som;
+ int fl = 0;
int rc;
ENTRY;
* resync state. */
break;
case MD_LAYOUT_WRITE:
- /* legal race for concurrent write, the file state has been
- * changed by another client. */
+ /**
+ * legal race for concurrent write, the file state has been
+ * changed by another client. Or a jump over file size and
+ * write.
+ */
+ som_buf->lb_buf = som;
+ som_buf->lb_len = sizeof(*som);
+ rc = mdo_xattr_get(env, obj, som_buf, XATTR_NAME_SOM);
+ if (rc < 0 && rc != -ENODATA)
+ RETURN(rc);
+
+ if (rc > 0) {
+ struct layout_intent *intent = mlc->mlc_intent;
+
+ lustre_som_swab(som);
+ if (intent->li_extent.e_end > som->lsa_size) {
+ fl = LU_XATTR_REPLACE;
+ som->lsa_size = intent->li_extent.e_end;
+ if (intent->li_opc == LAYOUT_INTENT_TRUNC)
+ som->lsa_size -= 1;
+ }
+ }
break;
default:
RETURN(-EBUSY);
if (rc)
GOTO(out, rc);
+ if (fl) {
+ rc = mdd_declare_xattr_set(env, mdd, obj, som_buf,
+ XATTR_NAME_SOM, fl, handle);
+ if (rc)
+ GOTO(out, rc);
+ }
+
rc = mdd_trans_start(env, mdd, handle);
if (rc)
GOTO(out, rc);
mdd_write_lock(env, obj, DT_TGT_CHILD);
rc = mdo_layout_change(env, obj, mlc, handle);
+ if (!rc && fl) {
+ som->lsa_valid = SOM_FL_STALE;
+ lustre_som_swab(som);
+ rc = mdo_xattr_set(env, obj, som_buf, XATTR_NAME_SOM,
+ fl, handle);
+ }
mdd_write_unlock(env, obj);
if (rc)
GOTO(out, rc);
local file=$DIR/$tdir/$tfile
local file2=$DIR2/$tdir/$tfile
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
copytool setup -m "$MOUNT" -a "$HSM_ARCHIVE_NUMBER"
run_test 10b "Test RW-PCC with group quota on loop PCC device"
test_10c() {
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
test_usrgrp_quota "u" "-r"
run_test 10c "Test RO-PCC with user quota on loop PCC device"
test_10d() {
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
test_usrgrp_quota "g" "-r"
local id=$RUNAS_ID
local ug=$1
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
[[ $ug == "g" ]] && id=$RUNAS_GID
test_14() {
local file=$DIR/$tdir/$tfile
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
copytool setup -m "$MOUNT" -a "$HSM_ARCHIVE_NUMBER"
local hsm_root="$mntpt/$tdir"
local file=$DIR/$tdir/$tfile
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local file=$DIR/$tfile
local -a lpcc_path
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local hsm_root="$mntpt/$tdir"
local file=$DIR/$tfile
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local hsm_root="$mntpt/$tdir"
local file=$DIR/$tfile
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local file=$DIR/$tfile
local fid
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local hsm_root="$mntpt/$tdir"
local file=$DIR/$tfile
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local hsm_root="$mntpt/$tdir"
local file=$DIR/$tfile
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local hsm_root="$mntpt/$tdir"
local file=$DIR/$tfile
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local hsm_root="$mntpt/$tdir"
local file=$DIR/$tfile
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local hsm_root="$mntpt/$tdir"
local file=$DIR/$tfile
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local file2=$DIR2/$tfile
local fid
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local file2=$DIR2/$tfile
local fid
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local file=$DIR/$tfile
local -a lpcc_path
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local file=$DIR/$tdir/$tfile
local -a lpcc_path
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local hsm_root="$mntpt/$tdir"
local file=$DIR/$tdir/$tfile
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local file=$DIR/$tdir/$tfile
local content
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local hsm_root="$mntpt/$tdir"
local file=$DIR/$tfile
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local hsm_root="$mntpt/$tdir"
local file=$DIR/$tfile
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local file=$DIR/$tdir/$tfile
local file2=$DIR2/$tdir/$tfile
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
is_project_quota_supported || skip "project quota is not supported"
local hsm_root="$mntpt/$tdir"
local file=$DIR/myfile.dat
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local hsm_root="$mntpt/$tdir"
local file
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local -a lpcc_path3
local file
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local file=$DIR/$tfile
local -a lpcc_path
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local file=$DIR/myfile.doc
local file2=$DIR2/myfile.doc
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
local hsm_root="$mntpt/$tdir"
local file=$DIR/$tfile
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
is_project_quota_supported || skip "project quota is not supported"
local file=$DIR/$tfile
local -a lpcc_path
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50
run_test 36a "Stale RW-PCC copy should be deleted after remove the PCC backend"
test_36b() {
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
test_36_base "-r"
local file=$DIR/$tdir/$tfile
local file2=$DIR2/$tdir/$tfile
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir failed"
local dir=$DIR/$tdir
local file=$dir/$tfile
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
is_project_quota_supported || skip "project quota is not supported"
run_test 38 "Verify LFS pcc state does not trigger prefetch for auto PCC-RO"
test_39() {
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
quotaon --help |& grep -q 'project quotas' ||
}
test_40() {
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
is_project_quota_supported || skip "project quota is not supported"
local hsm_root="$mntpt/$tdir"
local file=$DIR/$tfile
- $LCTL get_param -n mdc.*.connect_flags | grep -q pccro ||
+ $LCTL get_param -n mdc.*.connect_flags | grep -q pcc_ro ||
skip "Server does not support PCC-RO"
setup_loopdev $SINGLEAGT $loopfile $mntpt 50