Whamcloud - gitweb
Branch HEAD
authorbobijam <bobijam>
Mon, 22 Dec 2008 02:06:48 +0000 (02:06 +0000)
committerbobijam <bobijam>
Mon, 22 Dec 2008 02:06:48 +0000 (02:06 +0000)
b=16972
o=Brian Behlendorf (behlendorf1@llnl.gov)
i=robert.read (rread)
i=adilger

Fix request leaks.

lustre/mgc/mgc_request.c

index 447a2a9..270de52 100644 (file)
@@ -792,11 +792,14 @@ static int mgc_set_mgs_param(struct obd_export *exp,
                 RETURN(-ENOMEM);
 
         req_msp = lustre_msg_buf(req->rq_reqmsg, REQ_REC_OFF, sizeof(*req_msp));
                 RETURN(-ENOMEM);
 
         req_msp = lustre_msg_buf(req->rq_reqmsg, REQ_REC_OFF, sizeof(*req_msp));
-        if (!req_msp)
+        if (!req_msp) {
+                ptlrpc_req_finished(req);
                 RETURN(-ENOMEM);
                 RETURN(-ENOMEM);
+        }
 
         memcpy(req_msp, msp, sizeof(*req_msp));
         ptlrpc_req_set_repsize(req, 2, rep_size);
 
         memcpy(req_msp, msp, sizeof(*req_msp));
         ptlrpc_req_set_repsize(req, 2, rep_size);
+
         rc = ptlrpc_queue_wait(req);
         if (!rc) {
                 rep_msp = lustre_swab_repbuf(req, REPLY_REC_OFF,
         rc = ptlrpc_queue_wait(req);
         if (!rc) {
                 rep_msp = lustre_swab_repbuf(req, REPLY_REC_OFF,
@@ -921,10 +924,13 @@ static int mgc_target_register(struct obd_export *exp,
                 RETURN(-ENOMEM);
 
         req_mti = req_capsule_client_get(&req->rq_pill, &RMF_MGS_TARGET_INFO);
                 RETURN(-ENOMEM);
 
         req_mti = req_capsule_client_get(&req->rq_pill, &RMF_MGS_TARGET_INFO);
-        memcpy(req_mti, mti, sizeof(*req_mti));
+        if (!req_mti) {
+                ptlrpc_req_finished(req);
+                RETURN(-ENOMEM);
+        }
 
 
+        memcpy(req_mti, mti, sizeof(*req_mti));
         ptlrpc_request_set_replen(req);
         ptlrpc_request_set_replen(req);
-
         CDEBUG(D_MGC, "register %s\n", mti->mti_svname);
 
         rc = ptlrpc_queue_wait(req);
         CDEBUG(D_MGC, "register %s\n", mti->mti_svname);
 
         rc = ptlrpc_queue_wait(req);
@@ -1336,7 +1342,7 @@ int mgc_process_log(struct obd_device *mgc,
          */
         if (rcl && cld->cld_is_sptlrpc)
                 goto out_pop;
          */
         if (rcl && cld->cld_is_sptlrpc)
                 goto out_pop;
-        
+
         /* Copy the setup log locally if we can. Don't mess around if we're
            running an MGS though (logs are already local). */
         if (lctxt && lsi && (lsi->lsi_flags & LSI_SERVER) &&
         /* Copy the setup log locally if we can. Don't mess around if we're
            running an MGS though (logs are already local). */
         if (lctxt && lsi && (lsi->lsi_flags & LSI_SERVER) &&