main: fix if shutdown race with writeback

This commit is contained in:
Thomas Schoebel-Theuer 2019-02-06 18:04:25 +01:00 committed by Thomas Schoebel-Theuer
parent ce456788a4
commit b465105a18
1 changed files with 3 additions and 1 deletions

View File

@ -4135,8 +4135,10 @@ int make_dev(void *buf, struct mars_dent *dent)
switch_on =
(rot->if_brick && atomic_read(&rot->if_brick->open_count) > 0) ||
(rot->todo_primary &&
rot->trans_brick &&
!rot->trans_brick->replay_mode &&
rot->trans_brick->power.led_on &&
(rot->trans_brick->power.led_on ||
(!rot->trans_brick->power.button && !rot->trans_brick->power.led_off)) &&
_check_allow(global, dent->d_parent, "attach"));
if (!global->global_power.button) {
switch_on = false;