Whamcloud - gitweb
Correctly check stale fid and not start epoch if ost not support SOM
[fs/lustre-release.git] / lustre / mdc / mdc_locks.c
index 70aca4a..343b918 100644 (file)
@@ -644,11 +644,10 @@ int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo,
                         struct mdt_remote_perm *perm;
 
                         LASSERT(client_is_remote(exp));
-                        perm = req_capsule_server_get(pill, &RMF_ACL);
+                        perm = req_capsule_server_swab_get(pill, &RMF_ACL,
+                                                lustre_swab_mdt_remote_perm);
                         if (perm == NULL)
                                 RETURN(-EPROTO);
-
-                        lustre_swab_mdt_remote_perm(perm);
                 }
                 if (body->valid & OBD_MD_FLMDSCAPA) {
                         struct lustre_capa *capa, *p;
@@ -817,8 +816,17 @@ int mdc_intent_lock(struct obd_export *exp, struct md_op_data *op_data,
                 it_set_disposition(it, DISP_ENQ_COMPLETE);
 
                 /* Also: did we find the same inode? */
-                if (!lu_fid_eq(&op_data->op_fid2, &mdt_body->fid1))
+                /* sever can return one of two fids:
+                 * op_fid2 - new allocated fid - if file is created.
+                 * op_fid3 - existent fid - if file only open.
+                 * op_fid3 is saved in lmv_intent_open */
+                if ((!lu_fid_eq(&op_data->op_fid2, &mdt_body->fid1)) &&
+                    (!lu_fid_eq(&op_data->op_fid3, &mdt_body->fid1))) {
+                        CDEBUG(D_DENTRY, "Found stale data "DFID"("DFID")/"DFID
+                               "\n", PFID(&op_data->op_fid2),
+                               PFID(&op_data->op_fid2), PFID(&mdt_body->fid1));
                         RETURN(-ESTALE);
+                }
         }
 
         rc = it_open_error(DISP_LOOKUP_EXECD, it);