Whamcloud - gitweb
- Do proper refcounting on export->exp_connection -- maybe this will fix the
authorpschwan <pschwan>
Wed, 2 Oct 2002 17:05:16 +0000 (17:05 +0000)
committerpschwan <pschwan>
Wed, 2 Oct 2002 17:05:16 +0000 (17:05 +0000)
leaking conns we see?
- add some unbalanced ENTRYs and some LASSERTs to help track down a bug

lustre/lib/l_net.c
lustre/llite/file.c
lustre/obdclass/genops.c

index 4e5b8dc..2d111b6 100644 (file)
@@ -284,7 +284,7 @@ int target_handle_connect(struct ptlrpc_request *req)
         export->exp_connection = ptlrpc_get_connection(&req->rq_peer, cluuid);
         if (req->rq_connection != NULL)
                 ptlrpc_put_connection(req->rq_connection);
-        req->rq_connection = export->exp_connection;
+        req->rq_connection = ptlrpc_connection_addref(export->exp_connection);
 
         spin_lock(&export->exp_connection->c_lock);
         list_add(&export->exp_conn_chain, &export->exp_connection->c_exports);
index 6548237..37f40c7 100644 (file)
@@ -135,6 +135,7 @@ int ll_size_lock(struct inode *inode, struct lov_stripe_md *lsm, __u64 start,
         struct ldlm_extent extent;
         struct lustre_handle *lockhs = NULL;
         int rc, flags = 0, stripe_count;
+        ENTRY;
 
         if (sbi->ll_flags & LL_SBI_NOLCK) {
                 *lockhs_p = NULL;
@@ -168,6 +169,7 @@ int ll_size_unlock(struct inode *inode, struct lov_stripe_md *lsm, int mode,
 {
         struct ll_sb_info *sbi = ll_i2sbi(inode);
         int rc, stripe_count;
+        ENTRY;
 
         if (sbi->ll_flags & LL_SBI_NOLCK)
                 RETURN(0);
@@ -197,6 +199,10 @@ int ll_file_size(struct inode *inode, struct lov_stripe_md *lsm)
         struct lustre_handle *lockhs;
         struct obdo oa;
         int err, rc;
+        ENTRY;
+
+        LASSERT(lsm);
+        LASSERT(sbi);
 
         rc = ll_size_lock(inode, lsm, 0, LCK_PR, &lockhs);
         if (rc != ELDLM_OK) {
index 865b869..ee32fdb 100644 (file)
@@ -379,9 +379,13 @@ void class_destroy_export(struct obd_export *exp)
         spin_unlock(&exp->exp_obd->obd_dev_lock);
 
         /* XXXshaver no connection here... */
-        if (exp->exp_connection) spin_lock(&exp->exp_connection->c_lock);
+        if (exp->exp_connection)
+                spin_lock(&exp->exp_connection->c_lock);
         list_del(&exp->exp_conn_chain);
-        if (exp->exp_connection) spin_unlock(&exp->exp_connection->c_lock);
+        if (exp->exp_connection) {
+                spin_unlock(&exp->exp_connection->c_lock);
+                ptlrpc_put_connection(exp->exp_connection);
+        }
 
         kmem_cache_free(export_cachep, exp);