- /*
- * LU-3671
- *
- * permission changes may require sync operation, to mitigate
- * performance impact, only do this for dir and when permission is
- * reduced.
- *
- * For regular files, version is updated with permission change
- * (see VBR), async permission won't cause any issue, while missing
- * permission change on directory may affect accessibility of other
- * objects.
- */
- if (S_ISDIR(mdd_object_type(mdd_obj))) {
- if (la->la_valid & (LA_UID | LA_GID)) {
- sync_perm = true;
- } else if (la->la_valid & LA_MODE &&
- la->la_mode & (S_ISUID | S_ISGID | S_ISVTX)) {
- sync_perm = true;
- } else if (la->la_valid & LA_MODE) {
- struct lu_attr *tmp_la = &mdd_env_info(env)->mti_la;
-
- rc = mdd_la_get(env, mdd_obj, tmp_la, BYPASS_CAPA);
- if (rc)
- GOTO(stop, rc);
-
- if (permission_is_reduced(tmp_la, la))
- sync_perm = true;
- }
- }
-
- if (sync_perm)
- handle->th_sync |= !!mdd->mdd_sync_permission;