]>
Commit | Line | Data |
---|---|---|
289c5516 MT |
1 | --- |
2 | libmultipath/devmapper.c | 21 +++++++++++++++++---- | |
3 | libmultipath/devmapper.h | 2 +- | |
4 | 2 files changed, 18 insertions(+), 5 deletions(-) | |
5 | ||
6 | Index: multipath-tools-130222/libmultipath/devmapper.c | |
7 | =================================================================== | |
8 | --- multipath-tools-130222.orig/libmultipath/devmapper.c | |
9 | +++ multipath-tools-130222/libmultipath/devmapper.c | |
10 | @@ -363,7 +363,7 @@ out: | |
11 | } | |
12 | ||
13 | extern int | |
14 | -dm_get_map(char * name, unsigned long long * size, char * outparams) | |
15 | +dm_get_map(const char * name, unsigned long long * size, char * outparams) | |
16 | { | |
17 | int r = 1; | |
18 | struct dm_task *dmt; | |
19 | @@ -682,7 +682,9 @@ _dm_flush_map (const char * mapname, int | |
20 | extern int | |
21 | dm_suspend_and_flush_map (const char * mapname) | |
22 | { | |
23 | - int s; | |
24 | + int s = 0, queue_if_no_path = 0; | |
25 | + unsigned long long mapsize; | |
26 | + char params[PARAMS_SIZE] = {0}; | |
27 | ||
28 | if (!dm_map_present(mapname)) | |
29 | return 0; | |
30 | @@ -690,8 +692,17 @@ dm_suspend_and_flush_map (const char * m | |
31 | if (dm_type(mapname, TGT_MPATH) <= 0) | |
32 | return 0; /* nothing to do */ | |
33 | ||
34 | - s = dm_queue_if_no_path((char *)mapname, 0); | |
35 | - if (!s) | |
36 | + if (!dm_get_map(mapname, &mapsize, params)) { | |
37 | + if (strstr(params, "queue_if_no_path")) | |
38 | + queue_if_no_path = 1; | |
39 | + } | |
40 | + | |
41 | + if (queue_if_no_path) | |
42 | + s = dm_queue_if_no_path((char *)mapname, 0); | |
43 | + /* Leave queue_if_no_path alone if unset failed */ | |
44 | + if (s) | |
45 | + queue_if_no_path = 0; | |
46 | + else | |
47 | s = dm_simplecmd_flush(DM_DEVICE_SUSPEND, mapname, 0); | |
48 | ||
49 | if (!dm_flush_map(mapname)) { | |
50 | @@ -700,6 +711,8 @@ dm_suspend_and_flush_map (const char * m | |
51 | } | |
52 | condlog(2, "failed to remove multipath map %s", mapname); | |
53 | dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname); | |
54 | + if (queue_if_no_path) | |
55 | + s = dm_queue_if_no_path((char *)mapname, 1); | |
56 | return 1; | |
57 | } | |
58 | ||
59 | Index: multipath-tools-130222/libmultipath/devmapper.h | |
60 | =================================================================== | |
61 | --- multipath-tools-130222.orig/libmultipath/devmapper.h | |
62 | +++ multipath-tools-130222/libmultipath/devmapper.h | |
63 | @@ -14,7 +14,7 @@ int dm_simplecmd_noflush (int, const cha | |
64 | int dm_addmap_create (struct multipath *mpp, char *params); | |
65 | int dm_addmap_reload (struct multipath *mpp, char *params); | |
66 | int dm_map_present (const char *); | |
67 | -int dm_get_map(char *, unsigned long long *, char *); | |
68 | +int dm_get_map(const char *, unsigned long long *, char *); | |
69 | int dm_get_status(char *, char *); | |
70 | int dm_type(const char *, char *); | |
71 | int _dm_flush_map (const char *, int); |