]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[aoe] Fail immediately when network device is closed
authorMichael Brown <mcb30@ipxe.org>
Tue, 21 Sep 2010 23:20:31 +0000 (00:20 +0100)
committerMichael Brown <mcb30@ipxe.org>
Wed, 22 Sep 2010 15:43:37 +0000 (16:43 +0100)
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>
src/net/aoe.c

index fec8d33f0612e41d215fb716005b79b39f8e7fc9..b959a00a1db789101ead909392acc9eb9a4b5dca 100644 (file)
@@ -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 )