rc = mo_open(info->mti_env, mdt_object_child(o),
created ? flags | MDS_OPEN_CREATED : flags);
- if (rc)
- GOTO(err_out, rc);
+ if (rc != 0) {
+ /* If we allow the client to chgrp (CFS_SETGRP_PERM), but the
+ * client does not know which suppgid should be sent to the MDS,
+ * or some other(s) changed the target file's GID after this RPC
+ * sent to the MDS with the suppgid as the original GID, then we
+ * give the client another chance to send the right suppgid. */
+ if (rc == -EACCES &&
+ allow_client_chgrp(info, lu_ucred(info->mti_env)))
+ mdt_set_disposition(info, rep, DISP_OPEN_DENY);
+
+ GOTO(err_out, rc);
+ }
mfd = mdt_mfd_new(med);
if (mfd == NULL)