@@ -269,6 +269,7 @@
struct pathgroup * pgp;
struct path * pp;
int i, j;
+ int x, y;
if (!mpp || !mpp->pg)
return 0;
@@ -279,12 +280,25 @@
vector_foreach_slot(pgp->paths, pp, j) {
if (lock && flock(pp->fd, LOCK_EX | LOCK_NB) &&
errno == EWOULDBLOCK)
- return 1;
+ goto fail;
else if (!lock)
flock(pp->fd, LOCK_UN);
}
}
return 0;
+fail:
+ vector_foreach_slot (mpp->pg, pgp, x) {
+ if (x > i)
+ return 1;
+ if (!pgp->paths)
+ continue;
+ vector_foreach_slot(pgp->paths, pp, y) {
+ if (x == i && y > j)
+ return 1;
+ flock(pp->fd, LOCK_UN);
+ }
+ }
+ return 1;
}
/*
@@ -331,8 +345,10 @@
return DOMAP_RETRY;
}
- if (dm_map_present(mpp->alias))
+ if (dm_map_present(mpp->alias)) {
+ lock_multipath(mpp, 0);
break;
+ }
r = dm_addmap(DM_DEVICE_CREATE, DEFAULT_TARGET, mpp, 1, 0);
@@ -344,11 +360,12 @@
* DM_TABLE_LOAD. Failing the second part leaves an
* empty map. Clean it up.
*/
- if (!r && dm_map_present(mpp->alias)) {
+ if (!r) {
+ if (dm_map_present(mpp->alias))
+ dm_flush_map(mpp->alias, DEFAULT_TARGET);
condlog(3, "%s: failed to load map "
"(a path might be in use)",
mpp->alias);
- dm_flush_map(mpp->alias, DEFAULT_TARGET);
}
lock_multipath(mpp, 0);
@@ -752,8 +752,9 @@
if (apply_format(pp->getuid, &buff[0], pp)) {
condlog(0, "error formatting uid callout command");
memset(pp->wwid, 0, WWID_SIZE);
- } else if (execute_program(buff, pp->wwid, WWID_SIZE)) {
- condlog(0, "error calling out %s", buff);
+ } else if (execute_program(buff, pp->wwid, WWID_SIZE) ||
+ pp->wwid[0] == 0) {
+ condlog(0, "cannot get the the wwid for %s", pp->dev);
memset(pp->wwid, 0, WWID_SIZE);
return 1;
}