From adbe63860ad3b42539e4f6e5e14051e04ebe8447 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 22 Sep 2010 00:20:31 +0100 Subject: [PATCH] [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 --- src/net/aoe.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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 )