From 2dfc63659cd30ecb8a33b7b8f9d139b7477303d6 Mon Sep 17 00:00:00 2001 From: "hongchao.zhang" Date: Wed, 30 Jun 2010 23:57:49 +0800 Subject: [PATCH] b=23139 workaround to avoid assertion in osc_init_grant 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 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 72ce8f8..8ed40e5 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -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)) -- 1.8.3.1