converted into a lockless mode.
b=18104
i=oleg.drokin@sun.com
i=jinshan.xiong@sun.com
*/
CEF_DISCARD_DATA = 0x00000004,
/**
- * tell the sub layers that it must be a `real' lock.
+ * tell the sub layers that it must be a `real' lock. This is used for
+ * mmapped-buffer locks and glimpse locks that must be never converted
+ * into lockless mode.
+ *
+ * \see vvp_mmap_locks(), cl_glimpse_lock().
*/
CEF_MUST = 0x00000008,
/**
- * tell the sub layers that never request a `real' lock.
- * currently, the CEF_MUST & CEF_NEVER are only used for mmap locks.
- * cl_io::ci_lockreq and these two flags: ci_lockreq just describes
- * generic information of lock requirement for this IO, especially for
- * locks which belong to the object doing IO; however, lock itself may
- * have precise requirements, this is described by the latter.
+ * tell the sub layers that never request a `real' lock. This flag is
+ * not used currently.
+ *
+ * cl_io::ci_lockreq and CEF_{MUST,NEVER} flags specify lockless
+ * conversion policy: ci_lockreq describes generic information of lock
+ * requirement for this IO, especially for locks which belong to the
+ * object doing IO; however, lock itself may have precise requirements
+ * that are described by the enqueue flags.
*/
CEF_NEVER = 0x00000010,
/**
*descr = whole_file;
descr->cld_obj = clob;
descr->cld_mode = CLM_PHANTOM;
- /* The lockreq for glimpse should be mandatory,
- * otherwise, osc may decide to use lockless */
- io->ci_lockreq = CILR_MANDATORY;
cio->cui_glimpse = 1;
- lock = cl_lock_request(env, io, descr, CEF_ASYNC,
+ /*
+ * CEF_ASYNC is used because glimpse sub-locks cannot
+ * deadlock (because they never conflict with other
+ * locks) and, hence, can be enqueued out-of-order.
+ *
+ * CEF_MUST protects glimpse lock from conversion into
+ * a lockless mode.
+ */
+ lock = cl_lock_request(env, io, descr,
+ CEF_ASYNC|CEF_MUST,
"glimpse", cfs_current());
cio->cui_glimpse = 0;
if (!IS_ERR(lock)) {
olck->ols_state = OLS_GRANTED;
osc_lock_lvb_update(env, olck, rc);
- /* release DLM spin-locks to allow cl_lock_modify() to take a
- * semaphore on a parent lock. This is safe, because
+ /* release DLM spin-locks to allow cl_lock_{modify,signal}()
+ * to take a semaphore on a parent lock. This is safe, because
* spin-locks are needed to protect consistency of
* dlmlock->l_*_mode and LVB, and we have finished processing
* them. */
unlock_res_and_lock(dlmlock);
cl_lock_modify(env, lock, descr);
- lock_res_and_lock(dlmlock);
-
cl_lock_signal(env, lock);
+ lock_res_and_lock(dlmlock);
}
EXIT;
}
slice->cls_ops = &osc_lock_lockless_ops;
}
}
+ LASSERT(ergo(ols->ols_glimpse, !osc_lock_is_lockless(ols)));
}
/**
ols->ols_state = OLS_GRANTED;
}
}
-
+ LASSERT(ergo(ols->ols_glimpse, !osc_lock_is_lockless(ols)));
RETURN(result);
}