if: fix early kill of if_brick

This commit is contained in:
Thomas Schoebel-Theuer 2013-08-30 15:28:09 +02:00
parent 9134c1b771
commit 453fcb59d8
1 changed files with 8 additions and 0 deletions

View File

@ -801,6 +801,8 @@ static int if_switch(struct if_brick *brick)
mars_power_led_on((void*)brick, true);
status = 0;
} else if (!brick->power.led_off) {
int flying;
mars_power_led_on((void*)brick, false);
disk = input->disk;
if (!disk)
@ -818,6 +820,12 @@ static int if_switch(struct if_brick *brick)
status = -EBUSY;
goto done; // don't indicate "off" status
}
flying = atomic_read(&input->flying_count);
if (flying > 0) {
MARS_INF("device '%s' has %d flying requests, cannot shutdown\n", disk->disk_name, flying);
status = -EBUSY;
goto done; // don't indicate "off" status
}
if (input->bdev) {
MARS_DBG("calling bdput()\n");
bdput(input->bdev);