- if (ldlm_is_converting(lock)) {
- /* this is called on already converted lock, so
- * ibits has remained bits only and cancel_bits
- * are bits that were dropped.
- * Note that DOM lock is handled prior lock convert
- * and is excluded here.
+ /* If 'ld' is supplied then bits to be cancelled are passed
+ * implicitly by lock converting and cancel_bits from 'ld'
+ * should be used. Otherwise full cancel is being performed
+ * and lock inodebits are used.
+ *
+ * Note: we cannot rely on cancel_bits in lock itself at this
+ * moment because they can be changed by concurrent thread,
+ * so ldlm_cli_inodebits_convert() pass cancel bits implicitly
+ * in 'ld' parameter.
+ */
+ if (ld) {
+ /* partial bits cancel allowed only during convert */
+ LASSERT(ldlm_is_converting(lock));
+ /* mask cancel bits by lock bits so only no any unused
+ * bits are passed to ll_lock_cancel_bits()