return rc;
}
- if (la->la_valid & LA_FLAGS &&
- la->la_flags & LUSTRE_ORPHAN_FL)
+ if (la->la_valid & LA_FLAGS && la->la_flags & LUSTRE_ORPHAN_FL)
obj->mod_flags |= ORPHAN_OBJ | DEAD_OBJ;
return 0;
mdd = mdo2mdd(obj);
/* record only getting user xattrs and acls */
- if (rc >= 0 &&
+ if (rc >= 0 && buf->lb_buf &&
mdd_changelog_enabled(env, mdd, CL_GETXATTR) &&
(has_prefix(name, XATTR_USER_PREFIX) ||
has_prefix(name, XATTR_NAME_POSIX_ACL_ACCESS) ||
/*
* LU-3671
+ * LU-7239
*
* permission changes may require sync operation, to mitigate performance
* impact, only do this for dir and when permission is reduced.
if (!S_ISDIR(old->la_mode))
return false;
- if (new->la_valid & (LA_UID | LA_GID))
+ if (new->la_valid & LA_UID && old->la_uid != new->la_uid)
return true;
- if (new->la_valid & LA_MODE &&
- new->la_mode & (S_ISUID | S_ISGID | S_ISVTX))
+ if (new->la_valid & LA_GID && old->la_gid != new->la_gid)
return true;
- if ((new->la_valid & LA_MODE) &&
- ((new->la_mode & old->la_mode) & S_IRWXUGO) !=
- (old->la_mode & S_IRWXUGO))
- return true;
+ if (new->la_valid & LA_MODE) {
+ /* turned on sticky bit */
+ if (!(old->la_mode & S_ISVTX) && (new->la_mode & S_ISVTX))
+ return true;
+
+ /* set-GID has no impact on what is allowed, not checked */
+
+ /* turned off setuid bit, or one of rwx for someone */
+ if (((new->la_mode & old->la_mode) & (0777 | S_ISUID)) !=
+ (old->la_mode & (0777 | S_ISUID)))
+ return true;
+ }
return false;
}
struct lu_attr *attr = MDD_ENV_VAR(env, cattr);
const struct lu_attr *la = &ma->ma_attr;
struct lu_ucred *uc;
+ bool chrgrp_by_unprivileged_user = false;
int rc;
ENTRY;
uc = lu_ucred_check(env);
if (S_ISREG(attr->la_mode) && la->la_valid & LA_GID &&
la->la_gid != attr->la_gid && uc != NULL && uc->uc_fsuid != 0) {
+ /* LU-10048: disable synchronous chgrp operation for it will
+ * cause deadlock between MDT and OST.
la_copy->la_valid |= LA_FLAGS;
la_copy->la_flags |= LUSTRE_SET_SYNC_FL;
+ */
+ chrgrp_by_unprivileged_user = true;
- /* Flush the possible existing sync requests to OSTs to
- * keep the order of sync for the current setattr operation
+ /* Flush the possible existing client setattr requests to OSTs
+ * to keep the order with the current setattr operation that
* will be sent directly to OSTs. see LU-5152 */
+ /* LU-11303 disable sync as this is too heavyweight.
+ * This should be replaced with a sync only for the object
+ * being modified here, not the whole filesystem.
rc = dt_sync(env, mdd->mdd_child);
if (rc)
GOTO(out, rc);
+ */
}
handle = mdd_trans_create(env, mdd);
if (rc)
GOTO(out, rc);
- if (mdd->mdd_sync_permission && permission_needs_sync(attr, la))
+ if (!chrgrp_by_unprivileged_user && mdd->mdd_sync_permission &&
+ permission_needs_sync(attr, la))
handle->th_sync = 1;
if (la->la_valid & (LA_MTIME | LA_CTIME))
/* Read HSM attrs from disk */
current_buf = lu_buf_check_and_alloc(&info->mti_xattr_buf,
- mdo2mdd(obj)->mdd_dt_conf.ddp_max_ea_size);
+ MIN(mdd_obj2mdd_dev(mdd_obj)->mdd_dt_conf.ddp_max_ea_size,
+ XATTR_SIZE_MAX));
rc = mdo_xattr_get(env, mdd_obj, current_buf, XATTR_NAME_HSM);
rc = lustre_buf2hsm(current_buf->lb_buf, rc, current_mh);
if (rc < 0 && rc != -ENODATA)