summaryrefslogtreecommitdiffstats
path: root/src/net/aoe.c
diff options
context:
space:
mode:
authorMichael Brown2010-09-22 01:20:31 +0200
committerMichael Brown2010-09-22 17:43:37 +0200
commitadbe63860ad3b42539e4f6e5e14051e04ebe8447 (patch)
treebfb5b3eb6a38c37debb3bd484644d5d1b6ab3da4 /src/net/aoe.c
parent[contrib] Allow "cow" script to create the SAN device itself (diff)
downloadipxe-adbe63860ad3b42539e4f6e5e14051e04ebe8447.tar.gz
ipxe-adbe63860ad3b42539e4f6e5e14051e04ebe8447.tar.xz
ipxe-adbe63860ad3b42539e4f6e5e14051e04ebe8447.zip
[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 <mcb30@ipxe.org>
Diffstat (limited to 'src/net/aoe.c')
-rw-r--r--src/net/aoe.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/net/aoe.c b/src/net/aoe.c
index fec8d33f..b959a00a 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 )