Whamcloud - gitweb
b=23139 workaround to avoid assertion in osc_init_grant
authorhongchao.zhang <Hongchao.Zhang@Sun.COM>
Wed, 30 Jun 2010 15:57:49 +0000 (23:57 +0800)
committerjohann <johann@granier.local>
Wed, 7 Jul 2010 05:53:35 +0000 (07:53 +0200)
workaround for 1.6 servers which don't have
the patch from bug20278 applied

i=oleg.drokin
i=eric.mei

lustre/osc/osc_request.c

index 72ce8f8..8ed40e5 100644 (file)
@@ -1034,11 +1034,20 @@ static void osc_init_grant(struct client_obd *cli, struct obd_connect_data *ocd)
                 cli->cl_avail_grant = ocd->ocd_grant;
         else
                 cli->cl_avail_grant = ocd->ocd_grant - cli->cl_dirty;
+
+        if (cli->cl_avail_grant < 0) {
+                CWARN("%s: available grant < 0, the OSS is probaly not running"
+                      " with patch from bug 20278 (%ld)\n",
+                      cli->cl_import->imp_obd->obd_name, cli->cl_avail_grant);
+                /* workaround for 1.6 servers which do not have
+                 * the patch from bug 20278 */
+                cli->cl_avail_grant = ocd->ocd_grant;
+        }
         client_obd_list_unlock(&cli->cl_loi_list_lock);
 
-        CDEBUG(D_CACHE, "setting cl_avail_grant: %ld cl_lost_grant: %ld \n",
+        CDEBUG(D_CACHE, "%s: setting cl_avail_grant: %ld cl_lost_grant: %ld \n",
+               cli->cl_import->imp_obd->obd_name,
                cli->cl_avail_grant, cli->cl_lost_grant);
-        LASSERT(cli->cl_avail_grant >= 0);
 
         if (ocd->ocd_connect_flags & OBD_CONNECT_GRANT_SHRINK &&
             list_empty(&cli->cl_grant_shrink_list))