diff --git a/scst/include/scst.h b/scst/include/scst.h index 8c6923bbb..2b7588b08 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -2276,8 +2276,13 @@ struct scst_device { /**************************************************************/ - /* How many cmds alive on this dev */ - atomic_t dev_cmd_count; + /* + * How many cmds alive on this dev. Modified independently to the + * above fields, hence the alignment. Gcc reported to have + * a long standing bug, when it uses 64-bit memory accesses for + * int bit fields, so this alignment must be here to workaroud it. + */ + atomic_t dev_cmd_count __aligned(sizeof(long)); spinlock_t dev_lock; /* device lock */ diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index 426b83fcd..e684b42cb 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -106,8 +106,12 @@ struct scst_user_cmd { struct scst_cmd *cmd; struct scst_user_dev *dev; - atomic_t ucmd_ref; - + /* + * Note, gcc reported to have a long standing bug, when it uses 64-bit + * memory accesses for int bit fields, so, if any neighbor int field + * modified intependently to those bit fields, it must be 64-bit + * aligned to workaround this gcc bug! + */ unsigned int buff_cached:1; unsigned int buf_dirty:1; unsigned int background_exec:1; @@ -115,6 +119,8 @@ struct scst_user_cmd { struct scst_user_cmd *buf_ucmd; + atomic_t ucmd_ref; + int cur_data_page; int num_data_pages; int first_page_offset;