Whamcloud - gitweb
- fixes in pdirops
authoryury <yury>
Thu, 19 Oct 2006 08:45:23 +0000 (08:45 +0000)
committeryury <yury>
Thu, 19 Oct 2006 08:45:23 +0000 (08:45 +0000)
lustre/cmm/cmm_object.c
lustre/mdt/mdt_handler.c

index 8294033..1e2da83 100644 (file)
@@ -377,21 +377,28 @@ static lu_mode_t cml_lock_mode(const struct lu_env *env,
 {
         ENTRY;
 #ifdef HAVE_SPLIT_SUPPORT
-        if (lm == LU_EX) {
-                RETURN(LU_EX);
-        } else if (lm == LU_PR) {
-                RETURN(LU_CR);
-        } else if (lm == LU_PW) {
+        {
                 struct md_attr *ma = &cmm_env_info(env)->cmi_ma;
                 int split;
-
+        
                 memset(ma, 0, sizeof(*ma));
                 split = cmm_expect_splitting(env, mo, ma);
 
-                if (split == CMM_EXPECT_SPLIT) {
-                        RETURN(LU_EX);
+                if (split == CMM_NOT_SPLITTABLE) {
+                        if (lm == LU_PW)
+                                RETURN(LU_CW);
                 } else {
-                        RETURN(LU_CW);
+                        if (lm == LU_EX) {
+                                RETURN(LU_EX);
+                        } else if (lm == LU_PR) {
+                                RETURN(LU_CR);
+                        } else if (lm == LU_PW) {
+                                if (split == CMM_EXPECT_SPLIT) {
+                                        RETURN(LU_EX);
+                                } else {
+                                        RETURN(LU_CW);
+                                }
+                        }
                 }
         }
 #endif
index ebab34b..ec7b35a 100644 (file)
@@ -1504,10 +1504,16 @@ int mdt_object_lock_mode(struct mdt_thread_info *info,
                          * our selves. No special protection is needed, just flush
                          * client's cache on modification.
                          */
-                        if (lm == LCK_PW)
+                        if (lm == LCK_EX) {
+                                lh->mlh_pdo_mode = LCK_EX;
+                        } else if (lm == LCK_PR) {
+                                lh->mlh_pdo_mode = LCK_CR;
+                        } else if (lm == LCK_PW) {
                                 lh->mlh_pdo_mode = LCK_CW;
-                        else
+                        } else {
+                                CWARN("Not expected lock type (0x%x)\n", (int)lm);
                                 lh->mlh_pdo_mode = LCK_MINMODE;
+                        }
                 }
         }
 #endif
@@ -1772,7 +1778,6 @@ static inline void mdt_finish_reply(struct mdt_thread_info *info, int rc)
 }
 #endif
 
-
 static int mdt_init_capa_ctxt(const struct lu_env *env, struct mdt_device *m)
 {
         struct md_device *next = m->mdt_child;