if (rc)
GOTO(out_lock, rc);
- rc = mo_xattr_get(info->mti_env, mdt_object_child(o), &LU_BUF_NULL,
- XATTR_NAME_LOV);
- if (rc < 0 && rc != -ENODATA)
- GOTO(out_lock, rc);
- else if (rc > 0) /* has LOV EA*/
- tmp_ma->ma_valid |= MA_LOV;
+ /**
+ * If mti_big_lmm_used is set, it indicates that mti_big_lmm
+ * should contain valid LOV EA data, and can be used directly.
+ */
+ if (!info->mti_big_lmm_used) {
+ rc = mdt_big_xattr_get(info, o, XATTR_NAME_LOV);
+ if (rc < 0 && rc != -ENODATA)
+ GOTO(out_lock, rc);
+
+ /* No LOV EA */
+ if (rc == -ENODATA)
+ GOTO(out_lock, rc = 0);
+
+ rc = 0;
+ }
- rc = 0;
/**
* Check if a Lazy Size-on-MDS update is needed. Skip the
- * file with no LOV EA or unlink files.
+ * file with no LOV EA, unlink files or DoM-only file.
* MDS only updates LSOM of the file if the size or block
* size is being increased or the file is being truncated.
*/
- if ((tmp_ma->ma_valid & MA_LOV) &&
- !(tmp_ma->ma_valid & MA_INODE &&
- tmp_ma->ma_attr.la_nlink == 0)) {
+ if (mdt_lmm_dom_entry(info->mti_big_lmm) != LMM_DOM_ONLY &&
+ !(tmp_ma->ma_valid & MA_INODE && tmp_ma->ma_attr.la_nlink == 0)) {
__u64 size;
__u64 blocks;
bool changed = false;
}
run_test 808 "Check trusted.som xattr not logged in Changelogs"
+check_som_nodata()
+{
+ $LFS getsom $1
+ [[ $? -eq 61 ]] || error "DoM-only file $1 has SOM xattr"
+}
+
+test_809() {
+ [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.11.56) ] &&
+ skip "Need MDS version at least 2.11.56" && return
+
+ $LFS setstripe -E 1M -L mdt $DIR/$tfile ||
+ error "failed to create DoM-only file $DIR/$tfile"
+ touch $DIR/$tfile || error "touch $tfile failed"
+ check_som_nodata $DIR/$tfile
+
+ dd if=/dev/zero of=$DIR/$tfile bs=2048 count=1 ||
+ error "write $tfile failed"
+ check_som_nodata $DIR/$tfile
+
+ $TRUNCATE $DIR/$tfile 1234
+ check_som_nodata $DIR/$tfile
+
+ $TRUNCATE $DIR/$tfile 4097
+ check_som_nodata $DIR/$file
+}
+run_test 809 "Verify no SOM xattr store for DoM-only files"
+
#
# tests that do cleanup/setup should be run at the end
#
attrs = (void *)buf;
rc = lgetxattr(path, "trusted.som", attrs, sizeof(buf));
if (rc < 0) {
- fprintf(stderr, "%s failed to get som xattr: %s\n", argv[0],
- strerror(-rc));
+ rc = -errno;
+ fprintf(stderr, "%s failed to get som xattr: %s (%d)\n",
+ argv[0], strerror(errno), errno);
return rc;
}