diff --git a/scst/include/scst.h b/scst/include/scst.h index c1dffdd98..31e78d323 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -1453,7 +1453,9 @@ struct scst_dev_type { * be started. Can be used to close open file handlers, which might * prevent the state switch. * - * Called under scst_dg_mutex and no activities on the dev handler level. + * Called under scst_dg_mutex and no activities on the dev handler level + * (for implicit ALUA case supposed to be done by the user space via + * "block" sysfs attribute as described in the README). * * OPTIONAL */ @@ -1465,7 +1467,9 @@ struct scst_dev_type { * be finished. Can be used to (re)open file handlers closed in * on_alua_state_change_start(). * - * Called under scst_dg_mutex and no activities on the dev handler level. + * Called under scst_dg_mutex and no activities on the dev handler level + * (for implicit ALUA case supposed to be done by the user space via + * "block" sysfs attribute as described in the README). * * OPTIONAL */ diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 380e1729a..892cae1d9 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -145,6 +145,13 @@ static struct scst_trace_log vdisk_local_trace_tbl[] = { struct scst_vdisk_dev { uint64_t nblocks; + + /* + * Not protected, because assignments to aligned 64-bit integers are + * atomic. At worst, accesses to it should be covered by ACCESS_ONCE(), + * but not sure if that is really needed, so would prefer to keep it + * away from the fast path. + */ loff_t file_size; /* in bytes */ /* diff --git a/scst/src/scst_tg.c b/scst/src/scst_tg.c index b8cc4456c..cb65574eb 100644 --- a/scst/src/scst_tg.c +++ b/scst/src/scst_tg.c @@ -954,7 +954,8 @@ out_fail: * group @tg->dg. */ static void __scst_tg_set_state(struct scst_target_group *tg, - enum scst_tg_state state) + enum scst_tg_state state, + bool call_on_alua_state_change) { struct scst_dg_dev *dg_dev; struct scst_device *dev; @@ -1018,7 +1019,7 @@ int scst_tg_set_state(struct scst_target_group *tg, enum scst_tg_state state) if (res) goto out; - __scst_tg_set_state(tg, state); + __scst_tg_set_state(tg, state, true); mutex_unlock(&scst_dg_mutex); out: @@ -1325,7 +1326,7 @@ static void __scst_dg_remove(struct scst_dev_group *dg) list_del(&dg->entry); scst_dg_sysfs_del(dg); list_for_each_entry(tg, &dg->tg_list, entry) - __scst_tg_set_state(tg, SCST_TG_STATE_OPTIMIZED); + __scst_tg_set_state(tg, SCST_TG_STATE_OPTIMIZED, false); while (!list_empty(&dg->dev_list)) { dgdev = list_first_entry(&dg->dev_list, struct scst_dg_dev, entry);