From: Michael Brown Date: Tue, 21 Sep 2010 23:20:31 +0000 (+0100) Subject: [aoe] Fail immediately when network device is closed X-Git-Tag: v1.20.1~2492 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=adbe63860ad3b42539e4f6e5e14051e04ebe8447;p=thirdparty%2Fipxe.git [aoe] Fail immediately when network device is closed Avoid a tedious timeout delay when attempting to issue a command over a network device that has been closed. Signed-off-by: Michael Brown --- diff --git a/src/net/aoe.c b/src/net/aoe.c index fec8d33f0..b959a00a1 100644 --- a/src/net/aoe.c +++ b/src/net/aoe.c @@ -647,8 +647,16 @@ static struct aoe_command * aoecmd_create ( struct aoe_device *aoedev, static int aoedev_ata_command ( struct aoe_device *aoedev, struct interface *parent, struct ata_cmd *command ) { + struct net_device *netdev = aoedev->netdev; struct aoe_command *aoecmd; + /* Fail immediately if net device is closed */ + if ( ! netdev_is_open ( netdev ) ) { + DBGC ( aoedev, "AoE %s cannot issue command while net device " + "is closed\n", aoedev_name ( aoedev ) ); + return -EWOULDBLOCK; + } + /* Create command */ aoecmd = aoecmd_create ( aoedev, &aoecmd_ata ); if ( ! aoecmd )