* 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.
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,
.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,