]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bnx2fc: Prevent creating of NPIV port with duplicate WWN
authorBhanu Prakash Gollapudi <bprakash@broadcom.com>
Fri, 5 Aug 2011 00:38:51 +0000 (17:38 -0700)
committerJoe Jin <joe.jin@oracle.com>
Thu, 17 May 2012 01:36:47 +0000 (09:36 +0800)
This patch adds a validation step before allowing creation of a new NPIV port.
It checks whether the WWPN passed for the new NPIV port to be created is unique
for the given physical port.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 861efc547ce517e3d75a507ebc2268e6a0dfa767)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
drivers/scsi/bnx2fc/bnx2fc_fcoe.c

index 4c39f31a132e989762e4813f08c0ebe72d6d69d5..39f6867530879da2de3b5fe01cddc6ca0c34643e 100644 (file)
@@ -1021,6 +1021,17 @@ static int bnx2fc_vport_create(struct fc_vport *vport, bool disabled)
        struct bnx2fc_interface *interface = port->priv;
        struct net_device *netdev = interface->netdev;
        struct fc_lport *vn_port;
+       int rc;
+       char buf[32];
+
+       rc = fcoe_validate_vport_create(vport);
+       if (rc) {
+               fcoe_wwn_to_str(vport->port_name, buf, sizeof(buf));
+               printk(KERN_ERR PFX "Failed to create vport, "
+                      "WWPN (0x%s) already exists\n",
+                      buf);
+               return rc;
+       }
 
        if (!test_bit(BNX2FC_FLAG_FW_INIT_DONE, &interface->hba->flags)) {
                printk(KERN_ERR PFX "vn ports cannot be created on"