On 2014年07月10日 14:29, Ruoyu wrote:
For fear that req->data is not allocated successfully, move
increament of cluster info refcnt after memory alloc is reasonable.
Typo, should be 'client info'
Signed-off-by: Ruoyu <lian...@ucweb.com>
---
sheep/request.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sheep/request.c b/sheep/request.c
index f2ccff6..eb72b00 100644
--- a/sheep/request.c
+++ b/sheep/request.c
@@ -687,8 +687,6 @@ static struct request *alloc_request(struct client_info
*ci, int data_length)
if (!req)
return NULL;
- req->ci = ci;
- refcount_inc(&ci->refcnt);
if (data_length) {
req->data_length = data_length;
req->data = valloc(data_length);
@@ -698,6 +696,9 @@ static struct request *alloc_request(struct client_info
*ci, int data_length)
}
}
+ req->ci = ci;
+ refcount_inc(&ci->refcnt);
+
refcount_set(&req->refcnt, 1);
uatomic_inc(&sys->nr_outstanding_reqs);
--
sheepdog mailing list
sheepdog@lists.wpkg.org
http://lists.wpkg.org/mailman/listinfo/sheepdog