Whamcloud - gitweb
b=21980 cache `ll_obdo_cache': Can't free all objects
authorDmitry Zogin <dmitry.zoguine@oracle.com>
Mon, 5 Jul 2010 23:17:46 +0000 (19:17 -0400)
committerjohann <johann@granier.local>
Tue, 6 Jul 2010 20:39:27 +0000 (22:39 +0200)
Always use OBDO_ALLOC/FREE for obdo allocations to prevent slab fragmentation.
 Other related fixes.

 o=johann
 i=di.wang
 i=dmitry.zoguine

lustre/osc/osc_request.c

index b839d2f..72ce8f8 100644 (file)
@@ -880,7 +880,7 @@ static int osc_shrink_grant_interpret(struct ptlrpc_request *req,
                                 lustre_swab_ost_body);
         osc_update_grant(cli, body);
 out:
-        OBD_FREE_PTR(oa);
+        OBDO_FREE(oa);
         return rc;
 }
 
@@ -1940,7 +1940,12 @@ static int osc_brw_async(int cmd, struct obd_export *exp,
                                 GOTO(out, rc = -ENOMEM);
                         }
                         memcpy(oa, oinfo->oi_oa, sizeof(*oa));
-                        oa->o_flags |= OBD_FL_TEMPORARY;
+                        if (oa->o_valid & OBD_MD_FLFLAGS) {
+                                oa->o_flags |= OBD_FL_TEMPORARY;
+                        } else {
+                                oa->o_valid |= OBD_MD_FLFLAGS;
+                                oa->o_flags = OBD_FL_TEMPORARY;
+                        }
                 } else {
                         copy = ppga;
                         oa = oinfo->oi_oa;
@@ -1954,7 +1959,8 @@ static int osc_brw_async(int cmd, struct obd_export *exp,
                         if (copy != ppga)
                                 OBD_FREE(copy, pages_per_brw * sizeof(*copy));
 
-                        if (oa->o_flags & OBD_FL_TEMPORARY)
+                        if (oa->o_valid & OBD_MD_FLFLAGS &&
+                            oa->o_flags & OBD_FL_TEMPORARY)
                                 OBDO_FREE(oa);
                         break;
                 }
@@ -2289,7 +2295,8 @@ static int brw_interpret(struct ptlrpc_request *request, void *data, int rc)
                 for (i = 0; i < aa->aa_page_count; i++)
                         osc_release_write_grant(aa->aa_cli, aa->aa_ppga[i], 1);
 
-                if (aa->aa_oa->o_flags & OBD_FL_TEMPORARY)
+                if (aa->aa_oa->o_valid & OBD_MD_FLFLAGS &&
+                    aa->aa_oa->o_flags & OBD_FL_TEMPORARY)
                         OBDO_FREE(aa->aa_oa);
         }
         osc_wake_cache_waiters(cli);
@@ -4162,7 +4169,7 @@ static int osc_set_info_async(struct obd_export *exp, obd_count keylen,
 
                 CLASSERT(sizeof(*aa) <= sizeof(req->rq_async_args));
                 aa = ptlrpc_req_async_args(req);
-                OBD_ALLOC_PTR(oa);
+                OBDO_ALLOC(oa);
                 if (!oa) {
                         ptlrpc_req_finished(req);
                         RETURN(-ENOMEM);