Skip to content

Commit

Permalink
multipathd: sync features on flush_map failure corner case
Browse files Browse the repository at this point in the history
If dm_suspend_and_flush_map() disables queueing on a device, and then
fails both to flush the device and restore queueing, the device will
still have queue_if_no_path set in mpp->features, but not in reality.
Fix this.

Signed-off-by: Benjamin Marzinski <[email protected]>
Reviewed-by: Martin Wilck <[email protected]>
  • Loading branch information
bmarzins authored and mwilck committed Jan 5, 2024
1 parent 75e05cd commit 8a38983
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions libmultipath/devmapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -1136,8 +1136,8 @@ int _dm_flush_map (const char * mapname, int need_sync, int deferred_remove,
sleep(1);
} while (retries-- > 0);

if (queue_if_no_path == 1)
_dm_queue_if_no_path(mapname, 1);
if (queue_if_no_path == 1 && _dm_queue_if_no_path(mapname, 1) != 0)
return DM_FLUSH_FAIL_CANT_RESTORE;

return DM_FLUSH_FAIL;
}
Expand Down
1 change: 1 addition & 0 deletions libmultipath/devmapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ int dm_is_mpath(const char *);
enum {
DM_FLUSH_OK = 0,
DM_FLUSH_FAIL,
DM_FLUSH_FAIL_CANT_RESTORE,
DM_FLUSH_DEFERRED,
DM_FLUSH_BUSY,
};
Expand Down
3 changes: 2 additions & 1 deletion libmultipath/libmultipath.version
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ LIBMPATHCOMMON_1.0.0 {
put_multipath_config;
};

LIBMULTIPATH_22.0.0 {
LIBMULTIPATH_23.0.0 {
global:
/* symbols referenced by multipath and multipathd */
add_foreign;
Expand Down Expand Up @@ -151,6 +151,7 @@ global:
_print_multipath_topology;
reinstate_paths;
remember_wwid;
remove_feature;
remove_map;
remove_map_by_alias;
remove_map_callback;
Expand Down
2 changes: 2 additions & 0 deletions multipathd/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,8 @@ flush_map(struct multipath * mpp, struct vectors * vecs)
{
int r = dm_suspend_and_flush_map(mpp->alias, 0);
if (r != DM_FLUSH_OK) {
if (DM_FLUSH_FAIL_CANT_RESTORE)
remove_feature(&mpp->features, "queue_if_no_path");
condlog(0, "%s: can't flush", mpp->alias);
return r;
}
Expand Down

0 comments on commit 8a38983

Please sign in to comment.