From 9edc89c11eb673b0c0da08381a6a779e40ff8ac2 Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Wed, 28 Sep 2016 15:01:46 +0300 Subject: [PATCH] LU-8527 osd: ot_credits must be 32bit ot_credits used to calculate journal credits must be 32bit, otherwise it can overflow by huge transactions (e.g. 1K striped dirs) Change-Id: I53545989fd3653e72b5227281fc2ec6b2ccd309d Signed-off-by: Alex Zhuravlev Reviewed-on: http://review.whamcloud.com/22782 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/osd-ldiskfs/osd_internal.h | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h index 7bf0738..0c40868 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -333,7 +333,7 @@ enum osd_full_scrub_ratio { */ #define OSD_MAX_UGID_CNT 10 -enum { +enum osd_op_type { OSD_OT_ATTR_SET = 0, OSD_OT_PUNCH = 1, OSD_OT_XATTR_SET = 2, @@ -356,11 +356,11 @@ struct osd_thandle { struct list_head ot_stop_dcb_list; /* Link to the device, for debugging. */ struct lu_ref_link ot_dev_link; - unsigned short ot_credits; - unsigned short ot_id_cnt; - unsigned short ot_id_type; + unsigned int ot_credits; + unsigned short ot_id_cnt; + unsigned short ot_id_type; unsigned int ot_remove_agents:1; - uid_t ot_id_array[OSD_MAX_UGID_CNT]; + uid_t ot_id_array[OSD_MAX_UGID_CNT]; struct lquota_trans *ot_quota_trans; #if OSD_THANDLE_STATS /** time when this handle was allocated */ @@ -622,9 +622,9 @@ struct osd_thread_info { * cases where a large number of credits are being allocated for * single transaction. */ unsigned int oti_credits_before; - unsigned short oti_declare_ops[OSD_OT_MAX]; - unsigned short oti_declare_ops_cred[OSD_OT_MAX]; - unsigned short oti_declare_ops_used[OSD_OT_MAX]; + unsigned int oti_declare_ops[OSD_OT_MAX]; + unsigned int oti_declare_ops_cred[OSD_OT_MAX]; + unsigned int oti_declare_ops_used[OSD_OT_MAX]; }; extern int ldiskfs_pdo; @@ -1004,7 +1004,7 @@ void osd_trans_dump_creds(const struct lu_env *env, struct thandle *th); static inline void osd_trans_declare_op(const struct lu_env *env, struct osd_thandle *oh, - unsigned int op, int credits) + enum osd_op_type op, int credits) { struct osd_thread_info *oti = osd_oti_get(env); @@ -1025,7 +1025,8 @@ static inline void osd_trans_declare_op(const struct lu_env *env, } static inline void osd_trans_exec_op(const struct lu_env *env, - struct thandle *th, unsigned int op) + struct thandle *th, + enum osd_op_type op) { struct osd_thread_info *oti = osd_oti_get(env); struct osd_thandle *oh = container_of(th, struct osd_thandle, @@ -1090,7 +1091,7 @@ proceed: static inline void osd_trans_exec_check(const struct lu_env *env, struct thandle *th, - unsigned int op) + enum osd_op_type op) { struct osd_thread_info *oti = osd_oti_get(env); struct osd_thandle *oh = container_of(th, struct osd_thandle, -- 1.8.3.1