From 9fdbdd8c4b2f2664a09f0cc04b5c7ac9600d2ca0 Mon Sep 17 00:00:00 2001 From: yury Date: Thu, 19 Oct 2006 08:45:23 +0000 Subject: [PATCH] - fixes in pdirops --- lustre/cmm/cmm_object.c | 25 ++++++++++++++++--------- lustre/mdt/mdt_handler.c | 11 ++++++++--- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/lustre/cmm/cmm_object.c b/lustre/cmm/cmm_object.c index 8294033..1e2da83 100644 --- a/lustre/cmm/cmm_object.c +++ b/lustre/cmm/cmm_object.c @@ -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 diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index ebab34b..ec7b35a 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -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; -- 1.8.3.1