blob: 8d1954725cfb291863ab5aa3f3c92b484ea9cf67 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Benjamin Marzinski <bmarzins@redhat.com>
3Date: Fri, 1 Jun 2018 16:30:44 -0500
4Subject: [PATCH] libmultipath: remove rbd code
5
6The Ceph tean has asked to drop support for multipathed rbd, since it
7was running into data corruption issues. There was never an upstream
8Ceph release based on it, and because of the corruption, there should be
9no users of this code. This patch simply reverts all the rbd code from
10multipath.
11
12Cc: Michael Christie <mchristi@redhat.com>
13Cc: Jason Dillaman <dillaman@redhat.com>
14Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
15---
16 libmultipath/checkers.c | 22 --
17 libmultipath/checkers.h | 6 -
18 libmultipath/checkers/Makefile | 7 -
19 libmultipath/checkers/cciss_tur.c | 5 -
20 libmultipath/checkers/directio.c | 5 -
21 libmultipath/checkers/emc_clariion.c | 5 -
22 libmultipath/checkers/hp_sw.c | 5 -
23 libmultipath/checkers/rbd.c | 653 -----------------------------------
24 libmultipath/checkers/rdac.c | 5 -
25 libmultipath/checkers/readsector0.c | 5 -
26 libmultipath/checkers/tur.c | 5 -
27 libmultipath/discovery.c | 70 ----
28 libmultipath/hwtable.c | 12 -
29 multipath/multipath.conf.5 | 3 -
30 multipathd/main.c | 11 -
31 15 files changed, 819 deletions(-)
32 delete mode 100644 libmultipath/checkers/rbd.c
33
34diff --git a/libmultipath/checkers.c b/libmultipath/checkers.c
35index 08cdfc3..0bacc86 100644
36--- a/libmultipath/checkers.c
37+++ b/libmultipath/checkers.c
38@@ -141,13 +141,6 @@ struct checker * add_checker (char *multipath_dir, char * name)
39 if (!c->free)
40 goto out;
41
42- c->repair = (void (*)(struct checker *)) dlsym(c->handle,
43- "libcheck_repair");
44- errstr = dlerror();
45- if (errstr != NULL)
46- condlog(0, "A dynamic linking error occurred: (%s)", errstr);
47- if (!c->repair)
48- goto out;
49 done:
50 c->fd = -1;
51 c->sync = 1;
52@@ -222,20 +215,6 @@ void checker_put (struct checker * dst)
53 free_checker(src);
54 }
55
56-void checker_repair (struct checker * c)
57-{
58- if (!checker_selected(c))
59- return;
60-
61- c->message[0] = '\0';
62- if (c->disable) {
63- MSG(c, "checker disabled");
64- return;
65- }
66- if (c->repair)
67- c->repair(c);
68-}
69-
70 int checker_check (struct checker * c, int path_state)
71 {
72 int r;
73@@ -310,7 +289,6 @@ void checker_get (char *multipath_dir, struct checker * dst, char * name)
74 dst->sync = src->sync;
75 strncpy(dst->name, src->name, CHECKER_NAME_LEN);
76 strncpy(dst->message, src->message, CHECKER_MSG_LEN);
77- dst->repair = src->repair;
78 dst->check = src->check;
79 dst->init = src->init;
80 dst->free = src->free;
81diff --git a/libmultipath/checkers.h b/libmultipath/checkers.h
82index 52154ca..7b18a1a 100644
83--- a/libmultipath/checkers.h
84+++ b/libmultipath/checkers.h
85@@ -86,7 +86,6 @@ enum path_check_state {
86 #define READSECTOR0 "readsector0"
87 #define CCISS_TUR "cciss_tur"
88 #define NONE "none"
89-#define RBD "rbd"
90
91 #define ASYNC_TIMEOUT_SEC 30
92
93@@ -113,9 +112,6 @@ struct checker {
94 multipath-wide. Use MALLOC if
95 you want to stuff data in. */
96 int (*check)(struct checker *);
97- void (*repair)(struct checker *); /* called if check returns
98- PATH_DOWN to bring path into
99- usable state */
100 int (*init)(struct checker *); /* to allocate the context */
101 void (*free)(struct checker *); /* to free the context */
102 };
103@@ -136,7 +132,6 @@ void checker_set_async (struct checker *);
104 void checker_set_fd (struct checker *, int);
105 void checker_enable (struct checker *);
106 void checker_disable (struct checker *);
107-void checker_repair (struct checker *);
108 int checker_check (struct checker *, int);
109 int checker_selected (struct checker *);
110 char * checker_name (struct checker *);
111@@ -148,6 +143,5 @@ void checker_get (char *, struct checker *, char *);
112 int libcheck_check(struct checker *);
113 int libcheck_init(struct checker *);
114 void libcheck_free(struct checker *);
115-void libcheck_repair(struct checker *);
116
117 #endif /* _CHECKERS_H */
118diff --git a/libmultipath/checkers/Makefile b/libmultipath/checkers/Makefile
119index 87c15bd..02caea6 100644
120--- a/libmultipath/checkers/Makefile
121+++ b/libmultipath/checkers/Makefile
122@@ -15,15 +15,8 @@ LIBS= \
123 libcheckhp_sw.so \
124 libcheckrdac.so
125
126-ifneq ($(call check_file,/usr/include/rados/librados.h),0)
127-LIBS += libcheckrbd.so
128-endif
129-
130 all: $(LIBS)
131
132-libcheckrbd.so: rbd.o
133- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ -lrados -ludev
134-
135 libcheckdirectio.so: libsg.o directio.o
136 $(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ -laio
137
138diff --git a/libmultipath/checkers/cciss_tur.c b/libmultipath/checkers/cciss_tur.c
139index 436470c..1cab201 100644
140--- a/libmultipath/checkers/cciss_tur.c
141+++ b/libmultipath/checkers/cciss_tur.c
142@@ -59,11 +59,6 @@ void libcheck_free (struct checker * c)
143 return;
144 }
145
146-void libcheck_repair (struct checker * c)
147-{
148- return;
149-}
150-
151 int libcheck_check(struct checker * c)
152 {
153 int rc;
154diff --git a/libmultipath/checkers/directio.c b/libmultipath/checkers/directio.c
155index ce60e4c..a80848d 100644
156--- a/libmultipath/checkers/directio.c
157+++ b/libmultipath/checkers/directio.c
158@@ -118,11 +118,6 @@ void libcheck_free (struct checker * c)
159 free(ct);
160 }
161
162-void libcheck_repair (struct checker * c)
163-{
164- return;
165-}
166-
167 static int
168 check_state(int fd, struct directio_context *ct, int sync, int timeout_secs)
169 {
170diff --git a/libmultipath/checkers/emc_clariion.c b/libmultipath/checkers/emc_clariion.c
171index 9c1ffed..9115b1b 100644
172--- a/libmultipath/checkers/emc_clariion.c
173+++ b/libmultipath/checkers/emc_clariion.c
174@@ -90,11 +90,6 @@ void libcheck_free (struct checker * c)
175 free(c->context);
176 }
177
178-void libcheck_repair (struct checker * c)
179-{
180- return;
181-}
182-
183 int libcheck_check (struct checker * c)
184 {
185 unsigned char sense_buffer[128] = { 0, };
186diff --git a/libmultipath/checkers/hp_sw.c b/libmultipath/checkers/hp_sw.c
187index cee9aab..0ad34a6 100644
188--- a/libmultipath/checkers/hp_sw.c
189+++ b/libmultipath/checkers/hp_sw.c
190@@ -45,11 +45,6 @@ void libcheck_free (struct checker * c)
191 return;
192 }
193
194-void libcheck_repair (struct checker * c)
195-{
196- return;
197-}
198-
199 static int
200 do_inq(int sg_fd, int cmddt, int evpd, unsigned int pg_op,
201 void *resp, int mx_resp_len, int noisy, unsigned int timeout)
202diff --git a/libmultipath/checkers/rbd.c b/libmultipath/checkers/rbd.c
203deleted file mode 100644
204index 4ff54f4..0000000
205--- a/libmultipath/checkers/rbd.c
206+++ /dev/null
207@@ -1,653 +0,0 @@
208-/*
209- * Copyright (c) 2016 Red Hat
210- * Copyright (c) 2004 Christophe Varoqui
211- *
212- * Code based off of tur.c and ceph's krbd.cc
213- */
214-#define _GNU_SOURCE
215-#include <stdio.h>
216-#include <stdlib.h>
217-#include <string.h>
218-#include <unistd.h>
219-#include <fcntl.h>
220-#include <errno.h>
221-#include <pthread.h>
222-#include <libudev.h>
223-#include <ifaddrs.h>
224-#include <sys/types.h>
225-#include <sys/stat.h>
226-#include <sys/ioctl.h>
227-#include <sys/time.h>
228-#include <sys/wait.h>
229-#include <urcu.h>
230-
231-#include "rados/librados.h"
232-
233-#include "structs.h"
234-#include "checkers.h"
235-
236-#include "../libmultipath/debug.h"
237-#include "../libmultipath/util.h"
238-#include "../libmultipath/time-util.h"
239-#include "../libmultipath/util.h"
240-
241-struct rbd_checker_context;
242-typedef int (thread_fn)(struct rbd_checker_context *ct, char *msg);
243-
244-#define RBD_MSG(msg, fmt, args...) snprintf(msg, CHECKER_MSG_LEN, fmt, ##args);
245-
246-#define RBD_FEATURE_EXCLUSIVE_LOCK (1 << 2)
247-
248-struct rbd_checker_context {
249- int rbd_bus_id;
250- char *client_addr;
251- char *config_info;
252- char *snap;
253- char *pool;
254- char *image;
255- char *username;
256- int remapped;
257- int blacklisted;
258- unsigned lock_on_read:1;
259-
260- rados_t cluster;
261-
262- int state;
263- int running;
264- time_t time;
265- thread_fn *fn;
266- pthread_t thread;
267- pthread_mutex_t lock;
268- pthread_cond_t active;
269- pthread_spinlock_t hldr_lock;
270- int holders;
271- char message[CHECKER_MSG_LEN];
272-};
273-
274-int libcheck_init(struct checker * c)
275-{
276- struct rbd_checker_context *ct;
277- struct udev_device *block_dev;
278- struct udev_device *bus_dev;
279- struct udev *udev;
280- struct stat sb;
281- const char *block_name, *addr, *config_info, *features_str;
282- const char *image, *pool, *snap, *username;
283- uint64_t features = 0;
284- char sysfs_path[PATH_SIZE];
285- int ret;
286-
287- ct = malloc(sizeof(struct rbd_checker_context));
288- if (!ct)
289- return 1;
290- memset(ct, 0, sizeof(struct rbd_checker_context));
291- ct->holders = 1;
292- pthread_cond_init_mono(&ct->active);
293- pthread_mutex_init(&ct->lock, NULL);
294- pthread_spin_init(&ct->hldr_lock, PTHREAD_PROCESS_PRIVATE);
295- c->context = ct;
296-
297- /*
298- * The rbd block layer sysfs device is not linked to the rbd bus
299- * device that we interact with, so figure that out now.
300- */
301- if (fstat(c->fd, &sb) != 0)
302- goto free_ct;
303-
304- udev = udev_new();
305- if (!udev)
306- goto free_ct;
307-
308- block_dev = udev_device_new_from_devnum(udev, 'b', sb.st_rdev);
309- if (!block_dev)
310- goto free_udev;
311-
312- block_name = udev_device_get_sysname(block_dev);
313- ret = sscanf(block_name, "rbd%d", &ct->rbd_bus_id);
314-
315- udev_device_unref(block_dev);
316- if (ret != 1)
317- goto free_udev;
318-
319- snprintf(sysfs_path, sizeof(sysfs_path), "/sys/bus/rbd/devices/%d",
320- ct->rbd_bus_id);
321- bus_dev = udev_device_new_from_syspath(udev, sysfs_path);
322- if (!bus_dev)
323- goto free_udev;
324-
325- addr = udev_device_get_sysattr_value(bus_dev, "client_addr");
326- if (!addr) {
327- condlog(0, "rbd%d: Could not find client_addr in rbd sysfs. "
328- "Try updating kernel", ct->rbd_bus_id);
329- goto free_dev;
330- }
331-
332- ct->client_addr = strdup(addr);
333- if (!ct->client_addr)
334- goto free_dev;
335-
336- features_str = udev_device_get_sysattr_value(bus_dev, "features");
337- if (!features_str)
338- goto free_addr;
339- features = strtoll(features_str, NULL, 16);
340- if (!(features & RBD_FEATURE_EXCLUSIVE_LOCK)) {
341- condlog(3, "rbd%d: Exclusive lock not set.", ct->rbd_bus_id);
342- goto free_addr;
343- }
344-
345- config_info = udev_device_get_sysattr_value(bus_dev, "config_info");
346- if (!config_info)
347- goto free_addr;
348-
349- if (!strstr(config_info, "noshare")) {
350- condlog(3, "rbd%d: Only nonshared clients supported.",
351- ct->rbd_bus_id);
352- goto free_addr;
353- }
354-
355- if (strstr(config_info, "lock_on_read"))
356- ct->lock_on_read = 1;
357-
358- ct->config_info = strdup(config_info);
359- if (!ct->config_info)
360- goto free_addr;
361-
362- username = strstr(config_info, "name=");
363- if (username) {
364- char *end;
365- int len;
366-
367- username += 5;
368- end = strchr(username, ',');
369- if (!end)
370- goto free_info;
371- len = end - username;
372-
373- ct->username = malloc(len + 1);
374- if (!ct->username)
375- goto free_info;
376- strncpy(ct->username, username, len);
377- ct->username[len] = '\0';
378- }
379-
380- image = udev_device_get_sysattr_value(bus_dev, "name");
381- if (!image)
382- goto free_username;
383-
384- ct->image = strdup(image);
385- if (!ct->image)
386- goto free_username;
387-
388- pool = udev_device_get_sysattr_value(bus_dev, "pool");
389- if (!pool)
390- goto free_image;
391-
392- ct->pool = strdup(pool);
393- if (!ct->pool)
394- goto free_image;
395-
396- snap = udev_device_get_sysattr_value(bus_dev, "current_snap");
397- if (!snap)
398- goto free_pool;
399-
400- if (strcmp("-", snap)) {
401- ct->snap = strdup(snap);
402- if (!ct->snap)
403- goto free_pool;
404- }
405-
406- if (rados_create(&ct->cluster, NULL) < 0) {
407- condlog(0, "rbd%d: Could not create rados cluster",
408- ct->rbd_bus_id);
409- goto free_snap;
410- }
411-
412- if (rados_conf_read_file(ct->cluster, NULL) < 0) {
413- condlog(0, "rbd%d: Could not read rados conf", ct->rbd_bus_id);
414- goto shutdown_rados;
415- }
416-
417- ret = rados_connect(ct->cluster);
418- if (ret < 0) {
419- condlog(0, "rbd%d: Could not connect to rados cluster",
420- ct->rbd_bus_id);
421- goto shutdown_rados;
422- }
423-
424- udev_device_unref(bus_dev);
425- udev_unref(udev);
426-
427- condlog(3, "rbd%d checker init %s %s/%s@%s %s", ct->rbd_bus_id,
428- ct->client_addr, ct->pool, ct->image, ct->snap ? ct->snap : "-",
429- ct->username ? ct->username : "none");
430- return 0;
431-
432-shutdown_rados:
433- rados_shutdown(ct->cluster);
434-free_snap:
435- if (ct->snap)
436- free(ct->snap);
437-free_pool:
438- free(ct->pool);
439-free_image:
440- free(ct->image);
441-free_username:
442- if (ct->username)
443- free(ct->username);
444-free_info:
445- free(ct->config_info);
446-free_addr:
447- free(ct->client_addr);
448-free_dev:
449- udev_device_unref(bus_dev);
450-free_udev:
451- udev_unref(udev);
452-free_ct:
453- free(ct);
454- return 1;
455-}
456-
457-static void cleanup_context(struct rbd_checker_context *ct)
458-{
459- pthread_mutex_destroy(&ct->lock);
460- pthread_cond_destroy(&ct->active);
461- pthread_spin_destroy(&ct->hldr_lock);
462-
463- rados_shutdown(ct->cluster);
464-
465- if (ct->username)
466- free(ct->username);
467- if (ct->snap)
468- free(ct->snap);
469- free(ct->pool);
470- free(ct->image);
471- free(ct->config_info);
472- free(ct->client_addr);
473- free(ct);
474-}
475-
476-void libcheck_free(struct checker * c)
477-{
478- if (c->context) {
479- struct rbd_checker_context *ct = c->context;
480- int holders;
481- pthread_t thread;
482-
483- pthread_spin_lock(&ct->hldr_lock);
484- ct->holders--;
485- holders = ct->holders;
486- thread = ct->thread;
487- pthread_spin_unlock(&ct->hldr_lock);
488- if (holders)
489- pthread_cancel(thread);
490- else
491- cleanup_context(ct);
492- c->context = NULL;
493- }
494-}
495-
496-static int rbd_is_blacklisted(struct rbd_checker_context *ct, char *msg)
497-{
498- char *addr_tok, *start, *save;
499- const char *cmd[2];
500- char *blklist, *stat;
501- size_t blklist_len, stat_len;
502- int ret;
503- char *end;
504-
505- cmd[0] = "{\"prefix\": \"osd blacklist ls\"}";
506- cmd[1] = NULL;
507-
508- ret = rados_mon_command(ct->cluster, (const char **)cmd, 1, "", 0,
509- &blklist, &blklist_len, &stat, &stat_len);
510- if (ret < 0) {
511- RBD_MSG(msg, "checker failed: mon command failed %d", ret);
512- return ret;
513- }
514-
515- if (!blklist || !blklist_len)
516- goto free_bufs;
517-
518- /*
519- * parse list of addrs with the format
520- * ipv4:port/nonce date time\n
521- * or
522- * [ipv6]:port/nonce date time\n
523- */
524- ret = 0;
525- for (start = blklist; ; start = NULL) {
526- addr_tok = strtok_r(start, "\n", &save);
527- if (!addr_tok || !strlen(addr_tok))
528- break;
529-
530- end = strchr(addr_tok, ' ');
531- if (!end) {
532- RBD_MSG(msg, "checker failed: invalid blacklist %s",
533- addr_tok);
534- break;
535- }
536- *end = '\0';
537-
538- if (!strcmp(addr_tok, ct->client_addr)) {
539- ct->blacklisted = 1;
540- RBD_MSG(msg, "%s is blacklisted", ct->client_addr);
541- ret = 1;
542- break;
543- }
544- }
545-
546-free_bufs:
547- rados_buffer_free(blklist);
548- rados_buffer_free(stat);
549- return ret;
550-}
551-
552-static int rbd_check(struct rbd_checker_context *ct, char *msg)
553-{
554- if (ct->blacklisted || rbd_is_blacklisted(ct, msg) == 1)
555- return PATH_DOWN;
556-
557- RBD_MSG(msg, "checker reports path is up");
558- /*
559- * Path may have issues, but the ceph cluster is at least
560- * accepting IO, so we can attempt to do IO.
561- *
562- * TODO: in future versions, we can run other tests to
563- * verify OSDs and networks.
564- */
565- return PATH_UP;
566-}
567-
568-static int sysfs_write_rbd_bus(const char *which, const char *buf,
569- size_t buf_len)
570-{
571- char sysfs_path[PATH_SIZE];
572- int fd;
573- int r;
574-
575- /* we require newer kernels so single_major should always be there */
576- snprintf(sysfs_path, sizeof(sysfs_path),
577- "/sys/bus/rbd/%s_single_major", which);
578- fd = open(sysfs_path, O_WRONLY);
579- if (fd < 0)
580- return -errno;
581-
582- r = safe_write(fd, buf, buf_len);
583- close(fd);
584- return r;
585-}
586-
587-static int rbd_remap(struct rbd_checker_context *ct)
588-{
589- char *argv[11];
590- pid_t pid;
591- int ret = 0, i = 0;
592- int status;
593-
594- pid = fork();
595- switch (pid) {
596- case 0:
597- argv[i++] = "rbd";
598- argv[i++] = "map";
599- if (ct->lock_on_read)
600- argv[i++] = "-o noshare,lock_on_read";
601- else
602- argv[i++] = "-o noshare";
603- if (ct->username) {
604- argv[i++] = "--id";
605- argv[i++] = ct->username;
606- }
607- argv[i++] = "--pool";
608- argv[i++] = ct->pool;
609- if (ct->snap) {
610- argv[i++] = "--snap";
611- argv[i++] = ct->snap;
612- }
613- argv[i++] = ct->image;
614- argv[i] = NULL;
615-
616- ret = execvp(argv[0], argv);
617- condlog(0, "rbd%d: Error executing rbd: %s", ct->rbd_bus_id,
618- strerror(errno));
619- exit(-1);
620- case -1:
621- condlog(0, "rbd%d: fork failed: %s", ct->rbd_bus_id,
622- strerror(errno));
623- return -1;
624- default:
625- ret = -1;
626- wait(&status);
627- if (WIFEXITED(status)) {
628- status = WEXITSTATUS(status);
629- if (status == 0)
630- ret = 0;
631- else
632- condlog(0, "rbd%d: failed with %d",
633- ct->rbd_bus_id, status);
634- }
635- }
636-
637- return ret;
638-}
639-
640-static int sysfs_write_rbd_remove(const char *buf, int buf_len)
641-{
642- return sysfs_write_rbd_bus("remove", buf, buf_len);
643-}
644-
645-static int rbd_rm_blacklist(struct rbd_checker_context *ct)
646-{
647- const char *cmd[2];
648- char *stat, *cmd_str;
649- size_t stat_len;
650- int ret;
651-
652- ret = asprintf(&cmd_str, "{\"prefix\": \"osd blacklist\", \"blacklistop\": \"rm\", \"addr\": \"%s\"}",
653- ct->client_addr);
654- if (ret == -1)
655- return -ENOMEM;
656-
657- cmd[0] = cmd_str;
658- cmd[1] = NULL;
659-
660- ret = rados_mon_command(ct->cluster, (const char **)cmd, 1, "", 0,
661- NULL, NULL, &stat, &stat_len);
662- if (ret < 0) {
663- condlog(1, "rbd%d: repair failed to remove blacklist for %s %d",
664- ct->rbd_bus_id, ct->client_addr, ret);
665- goto free_cmd;
666- }
667-
668- condlog(1, "rbd%d: repair rm blacklist for %s",
669- ct->rbd_bus_id, ct->client_addr);
670- free(stat);
671-free_cmd:
672- free(cmd_str);
673- return ret;
674-}
675-
676-static int rbd_repair(struct rbd_checker_context *ct, char *msg)
677-{
678- char del[17];
679- int ret;
680-
681- if (!ct->blacklisted)
682- return PATH_UP;
683-
684- if (!ct->remapped) {
685- ret = rbd_remap(ct);
686- if (ret) {
687- RBD_MSG(msg, "repair failed to remap. Err %d", ret);
688- return PATH_DOWN;
689- }
690- }
691- ct->remapped = 1;
692-
693- snprintf(del, sizeof(del), "%d force", ct->rbd_bus_id);
694- ret = sysfs_write_rbd_remove(del, strlen(del) + 1);
695- if (ret) {
696- RBD_MSG(msg, "repair failed to clean up. Err %d", ret);
697- return PATH_DOWN;
698- }
699-
700- ret = rbd_rm_blacklist(ct);
701- if (ret) {
702- RBD_MSG(msg, "repair could not remove blacklist entry. Err %d",
703- ret);
704- return PATH_DOWN;
705- }
706-
707- ct->remapped = 0;
708- ct->blacklisted = 0;
709-
710- RBD_MSG(msg, "has been repaired");
711- return PATH_UP;
712-}
713-
714-#define rbd_thread_cleanup_push(ct) pthread_cleanup_push(cleanup_func, ct)
715-#define rbd_thread_cleanup_pop(ct) pthread_cleanup_pop(1)
716-
717-static void cleanup_func(void *data)
718-{
719- int holders;
720- struct rbd_checker_context *ct = data;
721- pthread_spin_lock(&ct->hldr_lock);
722- ct->holders--;
723- holders = ct->holders;
724- ct->thread = 0;
725- pthread_spin_unlock(&ct->hldr_lock);
726- if (!holders)
727- cleanup_context(ct);
728- rcu_unregister_thread();
729-}
730-
731-static void *rbd_thread(void *ctx)
732-{
733- struct rbd_checker_context *ct = ctx;
734- int state;
735-
736- /* This thread can be canceled, so setup clean up */
737- rbd_thread_cleanup_push(ct)
738- rcu_register_thread();
739- condlog(3, "rbd%d: thread starting up", ct->rbd_bus_id);
740-
741- ct->message[0] = '\0';
742-
743- /* checker start up */
744- pthread_mutex_lock(&ct->lock);
745- ct->state = PATH_PENDING;
746- pthread_mutex_unlock(&ct->lock);
747-
748- state = ct->fn(ct, ct->message);
749-
750- /* checker done */
751- pthread_mutex_lock(&ct->lock);
752- ct->state = state;
753- pthread_cond_signal(&ct->active);
754- pthread_mutex_unlock(&ct->lock);
755-
756- condlog(3, "rbd%d: thead finished, state %s", ct->rbd_bus_id,
757- checker_state_name(state));
758- rbd_thread_cleanup_pop(ct);
759- return ((void *)0);
760-}
761-
762-static void rbd_timeout(struct timespec *tsp)
763-{
764- clock_gettime(CLOCK_MONOTONIC, tsp);
765- tsp->tv_nsec += 1000 * 1000; /* 1 millisecond */
766- normalize_timespec(tsp);
767-}
768-
769-static int rbd_exec_fn(struct checker *c, thread_fn *fn)
770-{
771- struct rbd_checker_context *ct = c->context;
772- struct timespec tsp;
773- pthread_attr_t attr;
774- int rbd_status, r;
775-
776- if (c->sync)
777- return fn(ct, c->message);
778- /*
779- * Async mode
780- */
781- r = pthread_mutex_lock(&ct->lock);
782- if (r != 0) {
783- condlog(2, "rbd%d: mutex lock failed with %d", ct->rbd_bus_id,
784- r);
785- MSG(c, "rbd%d: thread failed to initialize", ct->rbd_bus_id);
786- return PATH_WILD;
787- }
788-
789- if (ct->running) {
790- /* Check if checker is still running */
791- if (ct->thread) {
792- condlog(3, "rbd%d: thread not finished",
793- ct->rbd_bus_id);
794- rbd_status = PATH_PENDING;
795- } else {
796- /* checker done */
797- ct->running = 0;
798- rbd_status = ct->state;
799- strncpy(c->message, ct->message, CHECKER_MSG_LEN);
800- c->message[CHECKER_MSG_LEN - 1] = '\0';
801- }
802- pthread_mutex_unlock(&ct->lock);
803- } else {
804- /* Start new checker */
805- ct->state = PATH_UNCHECKED;
806- ct->fn = fn;
807- pthread_spin_lock(&ct->hldr_lock);
808- ct->holders++;
809- pthread_spin_unlock(&ct->hldr_lock);
810- setup_thread_attr(&attr, 32 * 1024, 1);
811- r = pthread_create(&ct->thread, &attr, rbd_thread, ct);
812- if (r) {
813- pthread_mutex_unlock(&ct->lock);
814- ct->thread = 0;
815- ct->holders--;
816- condlog(3, "rbd%d failed to start rbd thread, using sync mode",
817- ct->rbd_bus_id);
818- return fn(ct, c->message);
819- }
820- pthread_attr_destroy(&attr);
821- rbd_timeout(&tsp);
822- r = pthread_cond_timedwait(&ct->active, &ct->lock, &tsp);
823- rbd_status = ct->state;
824- strncpy(c->message, ct->message,CHECKER_MSG_LEN);
825- c->message[CHECKER_MSG_LEN -1] = '\0';
826- pthread_mutex_unlock(&ct->lock);
827-
828- if (ct->thread &&
829- (rbd_status == PATH_PENDING || rbd_status == PATH_UNCHECKED)) {
830- condlog(3, "rbd%d: thread still running",
831- ct->rbd_bus_id);
832- ct->running = 1;
833- rbd_status = PATH_PENDING;
834- }
835- }
836-
837- return rbd_status;
838-}
839-
840-void libcheck_repair(struct checker * c)
841-{
842- struct rbd_checker_context *ct = c->context;
843-
844- if (!ct || !ct->blacklisted)
845- return;
846- rbd_exec_fn(c, rbd_repair);
847-}
848-
849-int libcheck_check(struct checker * c)
850-{
851- struct rbd_checker_context *ct = c->context;
852-
853- if (!ct)
854- return PATH_UNCHECKED;
855-
856- if (ct->blacklisted)
857- return PATH_DOWN;
858-
859- return rbd_exec_fn(c, rbd_check);
860-}
861diff --git a/libmultipath/checkers/rdac.c b/libmultipath/checkers/rdac.c
862index a643a4a..5104e4e 100644
863--- a/libmultipath/checkers/rdac.c
864+++ b/libmultipath/checkers/rdac.c
865@@ -139,11 +139,6 @@ void libcheck_free (struct checker * c)
866 return;
867 }
868
869-void libcheck_repair (struct checker * c)
870-{
871- return;
872-}
873-
874 static int
875 do_inq(int sg_fd, unsigned int pg_op, void *resp, int mx_resp_len,
876 unsigned int timeout)
877diff --git a/libmultipath/checkers/readsector0.c b/libmultipath/checkers/readsector0.c
878index 8fccb46..1c2a868 100644
879--- a/libmultipath/checkers/readsector0.c
880+++ b/libmultipath/checkers/readsector0.c
881@@ -23,11 +23,6 @@ void libcheck_free (struct checker * c)
882 return;
883 }
884
885-void libcheck_repair (struct checker * c)
886-{
887- return;
888-}
889-
890 int libcheck_check (struct checker * c)
891 {
892 unsigned char buf[4096];
893diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c
894index eb3348d..bf8486d 100644
895--- a/libmultipath/checkers/tur.c
896+++ b/libmultipath/checkers/tur.c
897@@ -112,11 +112,6 @@ void libcheck_free (struct checker * c)
898 return;
899 }
900
901-void libcheck_repair (struct checker * c)
902-{
903- return;
904-}
905-
906 #define TUR_MSG(fmt, args...) \
907 do { \
908 char msg[CHECKER_MSG_LEN]; \
909diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
910index 1ef1dfa..18ad0e2 100644
911--- a/libmultipath/discovery.c
912+++ b/libmultipath/discovery.c
913@@ -1246,21 +1246,6 @@ nvme_sysfs_pathinfo (struct path * pp, vector hwtable)
914 }
915
916 static int
917-rbd_sysfs_pathinfo (struct path * pp, vector hwtable)
918-{
919- sprintf(pp->vendor_id, "Ceph");
920- sprintf(pp->product_id, "RBD");
921-
922- condlog(3, "%s: vendor = %s product = %s", pp->dev, pp->vendor_id,
923- pp->product_id);
924- /*
925- * set the hwe configlet pointer
926- */
927- pp->hwe = find_hwe(hwtable, pp->vendor_id, pp->product_id, NULL);
928- return 0;
929-}
930-
931-static int
932 ccw_sysfs_pathinfo (struct path * pp, vector hwtable)
933 {
934 struct udev_device *parent;
935@@ -1486,8 +1471,6 @@ sysfs_pathinfo(struct path * pp, vector hwtable)
936 pp->bus = SYSFS_BUS_CCW;
937 if (!strncmp(pp->dev,"sd", 2))
938 pp->bus = SYSFS_BUS_SCSI;
939- if (!strncmp(pp->dev,"rbd", 3))
940- pp->bus = SYSFS_BUS_RBD;
941 if (!strncmp(pp->dev,"nvme", 4))
942 pp->bus = SYSFS_BUS_NVME;
943
944@@ -1502,9 +1485,6 @@ sysfs_pathinfo(struct path * pp, vector hwtable)
945 } else if (pp->bus == SYSFS_BUS_CCISS) {
946 if (cciss_sysfs_pathinfo(pp, hwtable))
947 return 1;
948- } else if (pp->bus == SYSFS_BUS_RBD) {
949- if (rbd_sysfs_pathinfo(pp, hwtable))
950- return 1;
951 } else if (pp->bus == SYSFS_BUS_NVME) {
952 if (nvme_sysfs_pathinfo(pp, hwtable))
953 return 1;
954@@ -1753,53 +1733,6 @@ get_udev_uid(struct path * pp, char *uid_attribute, struct udev_device *udev)
955 }
956
957 static int
958-get_rbd_uid(struct path * pp)
959-{
960- struct udev_device *rbd_bus_dev;
961- int ret, rbd_bus_id;
962- const char *pool, *image, *snap;
963- char sysfs_path[PATH_SIZE];
964- uint64_t snap_id, max_snap_id = -3;
965-
966- ret = sscanf(pp->dev, "rbd%d", &rbd_bus_id);
967- if (ret != 1)
968- return -EINVAL;
969-
970- snprintf(sysfs_path, sizeof(sysfs_path), "/sys/bus/rbd/devices/%d",
971- rbd_bus_id);
972- rbd_bus_dev = udev_device_new_from_syspath(udev, sysfs_path);
973- if (!rbd_bus_dev)
974- return -ENODEV;
975-
976- ret = -EINVAL;
977- pool = udev_device_get_sysattr_value(rbd_bus_dev, "pool_id");
978- if (!pool)
979- goto free_dev;
980-
981- image = udev_device_get_sysattr_value(rbd_bus_dev, "image_id");
982- if (!image)
983- goto free_dev;
984-
985- snap = udev_device_get_sysattr_value(rbd_bus_dev, "snap_id");
986- if (!snap)
987- goto free_dev;
988- snap_id = strtoull(snap, NULL, 19);
989- if (snap_id >= max_snap_id)
990- ret = snprintf(pp->wwid, WWID_SIZE, "%s-%s", pool, image);
991- else
992- ret = snprintf(pp->wwid, WWID_SIZE, "%s-%s-%s", pool,
993- image, snap);
994- if (ret >= WWID_SIZE) {
995- condlog(0, "%s: wwid overflow", pp->dev);
996- ret = -EOVERFLOW;
997- }
998-
999-free_dev:
1000- udev_device_unref(rbd_bus_dev);
1001- return ret;
1002-}
1003-
1004-static int
1005 get_vpd_uid(struct path * pp)
1006 {
1007 struct udev_device *parent = pp->udev;
1008@@ -1876,9 +1809,6 @@ get_uid (struct path * pp, int path_state, struct udev_device *udev)
1009 } else
1010 len = strlen(pp->wwid);
1011 origin = "callout";
1012- } else if (pp->bus == SYSFS_BUS_RBD) {
1013- len = get_rbd_uid(pp);
1014- origin = "sysfs";
1015 } else {
1016
1017 if (udev && pp->uid_attribute) {
1018diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
1019index 148f0ba..d529bae 100644
1020--- a/libmultipath/hwtable.c
1021+++ b/libmultipath/hwtable.c
1022@@ -1000,18 +1000,6 @@ static struct hwentry default_hw[] = {
1023 .prio_name = PRIO_ALUA,
1024 },
1025 /*
1026- * Red Hat
1027- *
1028- * Maintainer: Mike Christie
1029- * Mail: mchristi@redhat.com
1030- */
1031- {
1032- .vendor = "Ceph",
1033- .product = "RBD",
1034- .checker_name = RBD,
1035- .deferred_remove = DEFERRED_REMOVE_ON,
1036- },
1037- /*
1038 * Kove
1039 */
1040 {
1041diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
1042index 0c1f174..31f4585 100644
1043--- a/multipath/multipath.conf.5
1044+++ b/multipath/multipath.conf.5
1045@@ -482,9 +482,6 @@ Check the path state for HP/COMPAQ Smart Array(CCISS) controllers.
1046 .I none
1047 Do not check the device, fallback to use the values retrieved from sysfs
1048 .TP
1049-.I rbd
1050-Check if the path is in the Ceph blacklist and remap the path if it is.
1051-.TP
1052 The default is: \fBtur\fR
1053 .RE
1054 .
1055diff --git a/multipathd/main.c b/multipathd/main.c
1056index 0db88ee..d40c416 100644
1057--- a/multipathd/main.c
1058+++ b/multipathd/main.c
1059@@ -1783,15 +1783,6 @@ int update_path_groups(struct multipath *mpp, struct vectors *vecs, int refresh)
1060 return 0;
1061 }
1062
1063-void repair_path(struct path * pp)
1064-{
1065- if (pp->state != PATH_DOWN)
1066- return;
1067-
1068- checker_repair(&pp->checker);
1069- LOG_MSG(1, checker_message(&pp->checker));
1070-}
1071-
1072 /*
1073 * Returns '1' if the path has been checked, '-1' if it was blacklisted
1074 * and '0' otherwise
1075@@ -1972,7 +1963,6 @@ check_path (struct vectors * vecs, struct path * pp, int ticks)
1076 pp->mpp->failback_tick = 0;
1077
1078 pp->mpp->stat_path_failures++;
1079- repair_path(pp);
1080 return 1;
1081 }
1082
1083@@ -2071,7 +2061,6 @@ check_path (struct vectors * vecs, struct path * pp, int ticks)
1084 }
1085
1086 pp->state = newstate;
1087- repair_path(pp);
1088
1089 if (pp->mpp->wait_for_udev)
1090 return 1;
1091--
10922.7.4
1093