int rc;
rc = dt_declare_xattr_set(env, next, buf, name, fl, handle);
- if (rc >= 0 && strcmp(name, LL_XATTR_NAME_ENCRYPTION_CONTEXT) == 0) {
+ if (rc >= 0 &&
+ (strcmp(name, LL_XATTR_NAME_ENCRYPTION_CONTEXT) == 0 ||
+ strcmp(name, LL_XATTR_NAME_ENCRYPTION_CONTEXT_OLD) == 0)) {
struct lu_attr la = { 0 };
la.la_valid = LA_FLAGS;
* being created or migrated (LU_XATTR_CREATE flag not set), or
* if it is empty.
*/
- if ((strcmp(name, LL_XATTR_NAME_ENCRYPTION_CONTEXT) == 0) &&
+ if ((strcmp(name, LL_XATTR_NAME_ENCRYPTION_CONTEXT) == 0 ||
+ strcmp(name, LL_XATTR_NAME_ENCRYPTION_CONTEXT_OLD) == 0) &&
(!S_ISDIR(mdd_object_type(obj)) ||
!(fl & LU_XATTR_CREATE) ||
(rc = mdd_dir_is_empty(env, obj)) == 0)) {
la.la_valid = LA_FLAGS;
la.la_flags = LUSTRE_ENCRYPT_FL;
+ /* if this is an old client using the old enc xattr name,
+ * switch to the new name for consistency
+ */
+ if (strcmp(name, LL_XATTR_NAME_ENCRYPTION_CONTEXT_OLD) == 0)
+ name = LL_XATTR_NAME_ENCRYPTION_CONTEXT;
rc = dt_attr_set(env, next, &la, handle);
}
if (rc >= 0)