From 9cd80d77ae28cc243e30072aa29cb8aa63359c7a Mon Sep 17 00:00:00 2001 From: pschwan Date: Wed, 2 Oct 2002 17:05:16 +0000 Subject: [PATCH] - Do proper refcounting on export->exp_connection -- maybe this will fix the leaking conns we see? - add some unbalanced ENTRYs and some LASSERTs to help track down a bug --- lustre/lib/l_net.c | 2 +- lustre/llite/file.c | 6 ++++++ lustre/obdclass/genops.c | 8 ++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lustre/lib/l_net.c b/lustre/lib/l_net.c index 4e5b8dc..2d111b6 100644 --- a/lustre/lib/l_net.c +++ b/lustre/lib/l_net.c @@ -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); diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 6548237..37f40c7 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -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) { diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 865b869..ee32fdb 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -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); -- 1.8.3.1