Whamcloud - gitweb
LU-2991 osd: Overflow of transaction credits counters
authorBruno Faccini <bruno.faccini@intel.com>
Sun, 7 Apr 2013 17:39:07 +0000 (19:39 +0200)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 9 Apr 2013 03:17:19 +0000 (23:17 -0400)
Switching size of transaction credits counters from uchar to
ushort to avoid possible overflow scenarios, like when
wide-striping.
Also allow OSD_TRACK_DECLARES to be undefined without
compile-time errors for unsatisfied-externals/unused vars.

Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
Change-Id: I2588cf11741ca4e3ee80b795a7d4318f9ed4fd3d
Reviewed-on: http://review.whamcloud.com/5830
Tested-by: Hudson
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-ldiskfs/osd_internal.h

index 9ad62ed..135acf9 100644 (file)
@@ -680,10 +680,15 @@ static struct thandle *osd_trans_create(const struct lu_env *env,
                 CFS_INIT_LIST_HEAD(&oh->ot_dcb_list);
                 osd_th_alloced(oh);
 
                 CFS_INIT_LIST_HEAD(&oh->ot_dcb_list);
                 osd_th_alloced(oh);
 
-               memset(oti->oti_declare_ops, 0, OSD_OT_MAX);
-               memset(oti->oti_declare_ops_rb, 0, OSD_OT_MAX);
-               memset(oti->oti_declare_ops_cred, 0, OSD_OT_MAX);
+#ifdef OSD_TRACK_DECLARES
+               memset(oti->oti_declare_ops, 0,
+                                       sizeof(oti->oti_declare_ops));
+               memset(oti->oti_declare_ops_rb, 0,
+                                       sizeof(oti->oti_declare_ops_rb));
+               memset(oti->oti_declare_ops_cred, 0,
+                                       sizeof(oti->oti_declare_ops_cred));
                oti->oti_rollback = false;
                oti->oti_rollback = false;
+#endif
         }
         RETURN(th);
 }
         }
         RETURN(th);
 }
@@ -713,8 +718,10 @@ int osd_trans_start(const struct lu_env *env, struct dt_device *d,
                 GOTO(out, rc);
 
        if (unlikely(osd_param_is_not_sane(dev, th))) {
                 GOTO(out, rc);
 
        if (unlikely(osd_param_is_not_sane(dev, th))) {
+#ifdef OSD_TRACK_DECLARES
                static unsigned long last_printed;
                static int last_credits;
                static unsigned long last_printed;
                static int last_credits;
+#endif
 
                CWARN("%.16s: too many transaction credits (%d > %d)\n",
                      LDISKFS_SB(osd_sb(dev))->s_es->s_volume_name,
 
                CWARN("%.16s: too many transaction credits (%d > %d)\n",
                      LDISKFS_SB(osd_sb(dev))->s_es->s_volume_name,
index b2c13b2..73432fe 100644 (file)
@@ -595,8 +595,8 @@ struct osd_thread_info {
        /* Tracking for transaction credits, to allow debugging and optimizing
         * cases where a large number of credits are being allocated for
         * single transaction. */
        /* Tracking for transaction credits, to allow debugging and optimizing
         * cases where a large number of credits are being allocated for
         * single transaction. */
-       unsigned char           oti_declare_ops[OSD_OT_MAX];
-       unsigned char           oti_declare_ops_rb[OSD_OT_MAX];
+       unsigned short          oti_declare_ops[OSD_OT_MAX];
+       unsigned short          oti_declare_ops_rb[OSD_OT_MAX];
        unsigned short          oti_declare_ops_cred[OSD_OT_MAX];
        bool                    oti_rollback;
 #endif
        unsigned short          oti_declare_ops_cred[OSD_OT_MAX];
        bool                    oti_rollback;
 #endif