Skip to content

Commit b69ae0a

Browse files
Joe EykholtJames Bottomley
authored andcommitted
[SCSI] libfcoe: fix checking of conflicting fabrics in fcoe_ctlr_select()
The check for conflicting fabrics in fcoe_ctlr_select() ignores any FCFs that aren't usable. This is a minor problem now but becomes more pronounced after later patches. Signed-off-by: Joe Eykholt <[email protected]> Signed-off-by: Robert Love <[email protected]> Signed-off-by: James Bottomley <[email protected]>
1 parent c47036a commit b69ae0a

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

drivers/scsi/fcoe/libfcoe.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,12 +1361,22 @@ static void fcoe_ctlr_select(struct fcoe_ctlr *fip)
13611361
{
13621362
struct fcoe_fcf *fcf;
13631363
struct fcoe_fcf *best = NULL;
1364+
struct fcoe_fcf *first;
1365+
1366+
first = list_first_entry(&fip->fcfs, struct fcoe_fcf, list);
13641367

13651368
list_for_each_entry(fcf, &fip->fcfs, list) {
13661369
LIBFCOE_FIP_DBG(fip, "consider FCF for fab %16.16llx "
13671370
"VFID %d map %x val %d\n",
13681371
fcf->fabric_name, fcf->vfid,
13691372
fcf->fc_map, fcoe_ctlr_mtu_valid(fcf));
1373+
if (fcf->fabric_name != first->fabric_name ||
1374+
fcf->vfid != first->vfid ||
1375+
fcf->fc_map != first->fc_map) {
1376+
LIBFCOE_FIP_DBG(fip, "Conflicting fabric, VFID, "
1377+
"or FC-MAP\n");
1378+
return NULL;
1379+
}
13701380
if (!fcoe_ctlr_fcf_usable(fcf)) {
13711381
LIBFCOE_FIP_DBG(fip, "FCF for fab %16.16llx "
13721382
"map %x %svalid %savailable\n",
@@ -1380,13 +1390,6 @@ static void fcoe_ctlr_select(struct fcoe_ctlr *fip)
13801390
best = fcf;
13811391
continue;
13821392
}
1383-
if (fcf->fabric_name != best->fabric_name ||
1384-
fcf->vfid != best->vfid ||
1385-
fcf->fc_map != best->fc_map) {
1386-
LIBFCOE_FIP_DBG(fip, "Conflicting fabric, VFID, "
1387-
"or FC-MAP\n");
1388-
return;
1389-
}
13901393
if (fcf->pri < best->pri)
13911394
best = fcf;
13921395
}

0 commit comments

Comments
 (0)