On Wed, 2017-03-29 at 00:19 -0500, Mike Christie wrote: > Multiple threads could be writing to alua_access_state at > the same time, or there could be multiple STPGs in flight > (different initiators sending them or one initiator sending > them to different ports), or a combo of both and the > core_alua_do_transition_tg_pt calls will race with each other. > > Because from the last patches we no longer delay running > core_alua_do_transition_tg_pt_work, there does not seem to be > any point in running that in a workqueue. And, we always > wait for it to complete one way or another, so we can sleep > in this code path. So, this patch made over target-pending just adds a > mutex and does the work core_alua_do_transition_tg_pt_work was doing in > core_alua_do_transition_tg_pt. > > There is also no need to use an atomic for the > tg_pt_gp_alua_access_state. In core_alua_do_transition_tg_pt we will > test and set it under the transition mutex. And, it is a int/32 bits > so in the other places where it is read, we will never see it partially > updated. > > Signed-off-by: Mike Christie <mchristi@xxxxxxxxxx> > --- > drivers/target/target_core_alua.c | 136 ++++++++++++---------------------- > drivers/target/target_core_configfs.c | 2 +- > include/target/target_core_base.h | 8 +- > 3 files changed, 51 insertions(+), 95 deletions(-) Applied to target-pending/master. Thanks MNC. Btw, I changed the subject to be a little more descriptive about it being a bug-fix: target: Fix ALUA transition state race between multiple initiators Also, adding a HARE CC', and this was his original domain.. Dr. Hannes, any objections..? -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html