Whamcloud - gitweb
b=14422
authorgreen <green>
Fri, 7 Dec 2007 07:28:16 +0000 (07:28 +0000)
committergreen <green>
Fri, 7 Dec 2007 07:28:16 +0000 (07:28 +0000)
r=johann,adilger

Commit missing parts of bug 10718 to correctly clear lock cache on liblustre.

lustre/liblustre/llite_lib.h
lustre/liblustre/rw.c
lustre/liblustre/super.c

index 78c0bd4..e943aa4 100644 (file)
@@ -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,
index f164d29..e096a0e 100644 (file)
@@ -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;
index 784101a..ad7e222 100644 (file)
@@ -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: