Whamcloud - gitweb
Branch:HEAD
authorwangdi <wangdi>
Sun, 14 Oct 2007 20:18:32 +0000 (20:18 +0000)
committerwangdi <wangdi>
Sun, 14 Oct 2007 20:18:32 +0000 (20:18 +0000)
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
lustre/obdfilter/filter_io.c
lustre/osc/osc_request.c

index 9866492..9370a6d 100644 (file)
@@ -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.
 
 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>
 --------------------------------------------------------------------------------
 
 2007-08-10         Cluster File Systems, Inc. <info@clusterfs.com>
index 81e1ace..ad94fad 100644 (file)
@@ -438,7 +438,7 @@ static int filter_grant_check(struct obd_export *exp, struct obdo *oa,
                                         continue;
                                 }
                         }
                                         continue;
                                 }
                         }
-                        if (*left > ungranted) {
+                        if (*left > ungranted + bytes) {
                                 /* if enough space, pretend it was granted */
                                 ungranted += bytes;
                                 rnb[n].flags |= OBD_BRW_GRANTED;
                                 /* 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. */
 
         /* 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_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);
 
         spin_unlock(&exp->exp_obd->obd_osfs_lock);
         filter_fmd_put(exp, fmd);
index b778f1a..d08e621 100644 (file)
@@ -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);
 {
         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);
 }
         /* waiters are woken in brw_interpret_oap */
         client_obd_list_unlock(&cli->cl_loi_list_lock);
 }