diff --git a/lustre/liblustre/llite_lib.h b/lustre/liblustre/llite_lib.h index 78c0bd45bfd9e8121417c7a7e4318eb4e591d5cc..e943aa46eca2711a1fb231d37189c423e7d693b9 100644 --- a/lustre/liblustre/llite_lib.h +++ b/lustre/liblustre/llite_lib.h @@ -216,6 +216,9 @@ int llu_iop_read(struct inode *ino, struct ioctx *ioctxp); int llu_iop_write(struct inode *ino, struct ioctx *ioctxp); int llu_iop_iodone(struct ioctx *ioctxp); int llu_glimpse_size(struct inode *inode); +int llu_extent_lock_cancel_cb(struct ldlm_lock *lock, + struct ldlm_lock_desc *new, void *data, + int flag); int llu_extent_lock(struct ll_file_data *fd, struct inode *inode, struct lov_stripe_md *lsm, int mode, ldlm_policy_data_t *policy, struct lustre_handle *lockh, diff --git a/lustre/liblustre/rw.c b/lustre/liblustre/rw.c index f164d29f6378ad4549126c4e51e97e5f55b07668..e096a0e84afe55217b5e66ac0fcfc9cefbb9f4bd 100644 --- a/lustre/liblustre/rw.c +++ b/lustre/liblustre/rw.c @@ -112,7 +112,7 @@ static int llu_lock_to_stripe_offset(struct inode *inode, struct ldlm_lock *lock RETURN(stripe); } -static int llu_extent_lock_callback(struct ldlm_lock *lock, +int llu_extent_lock_cancel_cb(struct ldlm_lock *lock, struct ldlm_lock_desc *new, void *data, int flag) { @@ -240,7 +240,7 @@ int llu_glimpse_size(struct inode *inode) einfo.ei_type = LDLM_EXTENT; einfo.ei_mode = LCK_PR; - einfo.ei_cb_bl = llu_extent_lock_callback; + einfo.ei_cb_bl = osc_extent_blocking_cb; einfo.ei_cb_cp = ldlm_completion_ast; einfo.ei_cb_gl = llu_glimpse_callback; einfo.ei_cbdata = inode; @@ -300,7 +300,7 @@ int llu_extent_lock(struct ll_file_data *fd, struct inode *inode, einfo.ei_type = LDLM_EXTENT; einfo.ei_mode = mode; - einfo.ei_cb_bl = llu_extent_lock_callback; + einfo.ei_cb_bl = osc_extent_blocking_cb; einfo.ei_cb_cp = ldlm_completion_ast; einfo.ei_cb_gl = llu_glimpse_callback; einfo.ei_cbdata = inode; diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c index 784101a964e1a06c545acfc73c6ceaabf3481204..ad7e2221527b4e0937d4b37074a8420a0b57a0f7 100644 --- a/lustre/liblustre/super.c +++ b/lustre/liblustre/super.c @@ -95,6 +95,8 @@ static void llu_fsop_gone(struct filesys *fs) ENTRY; list_del(&sbi->ll_conn_chain); + obd_unregister_lock_cancel_cb(sbi->ll_osc_exp, + llu_extent_lock_cancel_cb); obd_disconnect(sbi->ll_osc_exp); obd_disconnect(sbi->ll_mdc_exp); @@ -1982,12 +1984,19 @@ llu_fsswop_mount(const char *source, sbi->ll_osc_exp = class_conn2export(&osc_conn); sbi->ll_lco.lco_flags = ocd.ocd_connect_flags; + err = obd_register_lock_cancel_cb(sbi->ll_osc_exp, + llu_extent_lock_cancel_cb); + if (err) { + CERROR("cannot register lock cancel callback: rc = %d\n", err); + GOTO(out_osc, err); + } + mdc_init_ea_size(sbi->ll_mdc_exp, sbi->ll_osc_exp); err = mdc_getstatus(sbi->ll_mdc_exp, &rootfid); if (err) { CERROR("cannot mds_connect: rc = %d\n", err); - GOTO(out_osc, err); + GOTO(out_lock_cn_cb, err); } CDEBUG(D_SUPER, "rootfid "LPU64"\n", rootfid.id); sbi->ll_rootino = rootfid.id; @@ -1998,7 +2007,7 @@ llu_fsswop_mount(const char *source, &request); if (err) { CERROR("mdc_getattr failed for root: rc = %d\n", err); - GOTO(out_osc, err); + GOTO(out_lock_cn_cb, err); } err = mdc_req2lustre_md(request, REPLY_REC_OFF, sbi->ll_osc_exp, &md); @@ -2041,6 +2050,9 @@ out_inode: _sysio_i_gone(root); out_request: ptlrpc_req_finished(request); +out_lock_cn_cb: + obd_unregister_lock_cancel_cb(sbi->ll_osc_exp, + llu_extent_lock_cancel_cb); out_osc: obd_disconnect(sbi->ll_osc_exp); out_mdc: