Whamcloud - gitweb
LU-5423 llite: pack suppgid to MDS correctly
[fs/lustre-release.git] / lustre / mdt / mdt_open.c
index c779056..97918c4 100644 (file)
@@ -755,8 +755,18 @@ static int mdt_mfd_open(struct mdt_thread_info *info, struct mdt_object *p,
 
         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)