From b340e9d6a990d9055b05a7f7d879ae92678246a9 Mon Sep 17 00:00:00 2001 From: wangdi Date: Wed, 16 Sep 2009 20:20:21 +0000 Subject: [PATCH] Branch: HEAD b=20305 separate glimpse lock with other locks. (glimpse lock only match with glimpse lock), otherwise pages might be added to some doomed(detached) locks, and they might not be flushed later when the lock is deleted. i=Jay, Ericm --- lustre/lclient/lcommon_cl.c | 3 ++- lustre/osc/osc_lock.c | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lustre/lclient/lcommon_cl.c b/lustre/lclient/lcommon_cl.c index a66d91d..9eb6bbb 100644 --- a/lustre/lclient/lcommon_cl.c +++ b/lustre/lclient/lcommon_cl.c @@ -624,7 +624,8 @@ int ccc_lock_fits_into(const struct lu_env *env, * doesn't enqueue CLM_WRITE sub-locks. */ if (cio->cui_glimpse) - result = descr->cld_mode != CLM_WRITE; + result = descr->cld_mode == CLM_PHANTOM; + /* * Also, don't match incomplete write locks for read, otherwise read * would enqueue missing sub-locks in the write mode. diff --git a/lustre/osc/osc_lock.c b/lustre/osc/osc_lock.c index 136f7ff..b224bdd 100644 --- a/lustre/osc/osc_lock.c +++ b/lustre/osc/osc_lock.c @@ -1569,6 +1569,18 @@ static int osc_lock_print(const struct lu_env *env, void *cookie, return 0; } +static int osc_lock_fits_into(const struct lu_env *env, + const struct cl_lock_slice *slice, + const struct cl_lock_descr *need, + const struct cl_io *io) +{ + + if (need->cld_mode == CLM_PHANTOM) + return need->cld_mode == slice->cls_lock->cll_descr.cld_mode; + + return 1; +} + static const struct cl_lock_operations osc_lock_ops = { .clo_fini = osc_lock_fini, .clo_enqueue = osc_lock_enqueue, @@ -1579,7 +1591,8 @@ static const struct cl_lock_operations osc_lock_ops = { .clo_state = osc_lock_state, .clo_cancel = osc_lock_cancel, .clo_weigh = osc_lock_weigh, - .clo_print = osc_lock_print + .clo_print = osc_lock_print, + .clo_fits_into = osc_lock_fits_into, }; static int osc_lock_lockless_enqueue(const struct lu_env *env, -- 1.8.3.1