* @{ */
/**
+ * Flags for lustre_mdt_attrs::lma_compat and lustre_mdt_attrs::lma_incompat.
+ */
+enum lma_compat {
+ LMAC_HSM = 0x00000001,
+ LMAC_SOM = 0x00000002,
+};
+
+/**
+ * Masks for all features that should be supported by a Lustre version to
+ * access a specific file.
+ * This information is stored in lustre_mdt_attrs::lma_incompat.
+ *
+ * NOTE: No incompat feature should be added before bug #17670 is landed.
+ */
+#define LMA_INCOMPAT_SUPP 0x0
+
+/**
* Following struct for MDT attributes, that will be kept inode's EA.
* Introduced in 2.0 release (please see b15993, for details)
*/
struct lustre_mdt_attrs {
+ /**
+ * Bitfield for supported data in this structure. From enum lma_compat.
+ * lma_self_fid and lma_flags are always available.
+ */
+ __u32 lma_compat;
+ /**
+ * Per-file incompat feature list. Lustre version should support all
+ * flags set in this field. The supported feature mask is available in
+ * LMA_INCOMPAT_SUPP.
+ */
+ __u32 lma_incompat;
/** FID of this inode */
struct lu_fid lma_self_fid;
/** SOM state, mdt/ost type, others */
ENTRY;
mdd_changelog_fini(env, m);
dt_txn_callback_del(m->mdd_child, &m->mdd_txn_cb);
- mdd_object_put(env, m->mdd_dot_lustre_objs.mdd_obf);
- mdd_object_put(env, m->mdd_dot_lustre);
+ if (m->mdd_dot_lustre_objs.mdd_obf)
+ mdd_object_put(env, m->mdd_dot_lustre_objs.mdd_obf);
+ if (m->mdd_dot_lustre)
+ mdd_object_put(env, m->mdd_dot_lustre);
if (m->mdd_obd_dev)
mdd_fini_obd(env, m, cfg);
orph_index_fini(env, m);
[DTO_INDEX_DELETE] = 20,
/**
* Unused now.
- */
+ */
[DTO_IDNEX_UPDATE] = 16,
/*
* Create a object. Same as create object in EXT3 filesystem.
* INDEX_EXTRA_BLOCKS(8) +
* 3(inode bits, groups, GDT) +
* QUOTA(?)
- */
+ */
[DTO_OBJECT_DELETE] = 27,
/**
* Attr set credits.
rc = inode->i_op->getxattr(dentry, XATTR_NAME_LMA, (void *)mdt_attrs,
sizeof *mdt_attrs);
+ /* Check LMA compatibility */
+ if (rc > 0 &&
+ (mdt_attrs->lma_incompat & ~cpu_to_be32(LMA_INCOMPAT_SUPP))) {
+ CWARN("Inode %lx: Unsupported incompat LMA feature(s) %#x\n",
+ inode->i_ino, be32_to_cpu(mdt_attrs->lma_incompat) &
+ ~LMA_INCOMPAT_SUPP);
+ return -ENOSYS;
+ }
+
if (rc > 0) {
fid_be_to_cpu(fid, &mdt_attrs->lma_self_fid);
rc = 0;