From 27fc145d8417210482c8be212d97d8b720e271b7 Mon Sep 17 00:00:00 2001 From: wangdi <wangdi> Date: Sun, 14 Oct 2007 20:18:32 +0000 Subject: [PATCH] Branch:HEAD b=13570 In filter_check_grant, for non_grant cache write, we should check the left space by if (*left > ungranted + bytes), instead of (*left > ungranted), because only we are sure the left space is enough for another "bytes", then the ungrant space should be increase. In client, we should update cl_avail_grant only there is OBD_MD_FLGRANT in the reply. i=adilger,green --- lustre/ChangeLog | 10 ++++++++++ lustre/obdfilter/filter_io.c | 6 ++---- lustre/osc/osc_request.c | 3 ++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 9866492db9..9370a6da66 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -413,6 +413,16 @@ Description: adapt the lustre_config script to support the upgrade case Details : Add "-u" option for lustre_config script to support upgrading 1.4 server targets to 1.6 in parallel. +Severity : normal +Bugzilla : 13570 +Description: grant fixes to avoid grant_space > avail_space +Details : In filter_check_grant, for non_grant cache write, we should + check the left space by if (*left > ungranted + bytes), instead + of (*left > ungranted), because only we are sure the left space + is enough for another "bytes", then the ungrant space should be + increase. In client, we should update cl_avail_grant only there + is OBD_MD_FLGRANT in the reply. + -------------------------------------------------------------------------------- 2007-08-10 Cluster File Systems, Inc. <info@clusterfs.com> diff --git a/lustre/obdfilter/filter_io.c b/lustre/obdfilter/filter_io.c index 81e1acefa9..ad94fad5d5 100644 --- a/lustre/obdfilter/filter_io.c +++ b/lustre/obdfilter/filter_io.c @@ -438,7 +438,7 @@ static int filter_grant_check(struct obd_export *exp, struct obdo *oa, continue; } } - if (*left > ungranted) { + if (*left > ungranted + bytes) { /* if enough space, pretend it was granted */ ungranted += bytes; rnb[n].flags |= OBD_BRW_GRANTED; @@ -588,10 +588,8 @@ static int filter_preprw_write(int cmd, struct obd_export *exp, struct obdo *oa, /* do not zero out oa->o_valid as it is used in filter_commitrw_write() * for setting UID/GID and fid EA in first write time. */ - if (oa->o_valid & OBD_MD_FLGRANT) { + if (oa->o_valid & OBD_MD_FLGRANT) oa->o_grant = filter_grant(exp,oa->o_grant,oa->o_undirty,left); - oa->o_valid |= OBD_MD_FLGRANT; - } spin_unlock(&exp->exp_obd->obd_osfs_lock); filter_fmd_put(exp, fmd); diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index b778f1a64f..d08e62103a 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -803,7 +803,8 @@ static void osc_update_grant(struct client_obd *cli, struct ost_body *body) { client_obd_list_lock(&cli->cl_loi_list_lock); CDEBUG(D_CACHE, "got "LPU64" extra grant\n", body->oa.o_grant); - cli->cl_avail_grant += body->oa.o_grant; + if (body->oa.o_valid & OBD_MD_FLGRANT) + cli->cl_avail_grant += body->oa.o_grant; /* waiters are woken in brw_interpret_oap */ client_obd_list_unlock(&cli->cl_loi_list_lock); } -- GitLab