From: Mike Christie <mchristi@redhat.com>
To: dm-devel@redhat.com, christophe.varoqui@opensvc.com
Cc: Mike Christie <mchristi@redhat.com>
Subject: [PATCH 3/4] rbd: check for exclusive lock enabled
Date: Wed, 31 Aug 2016 16:44:29 -0500 [thread overview]
Message-ID: <1472679870-25654-4-git-send-email-mchristi@redhat.com> (raw)
In-Reply-To: <1472679870-25654-1-git-send-email-mchristi@redhat.com>
Only attach the checker if the rbd image has the exclusive lock
enabled.
Signed-off-by: Mike Christie <mchristi@redhat.com>
---
libmultipath/checkers/rbd.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/libmultipath/checkers/rbd.c b/libmultipath/checkers/rbd.c
index 6542bdb..175c4a6 100644
--- a/libmultipath/checkers/rbd.c
+++ b/libmultipath/checkers/rbd.c
@@ -33,6 +33,8 @@ typedef int (thread_fn)(struct rbd_checker_context *ct, char *msg);
#define RBD_MSG(msg, fmt, args...) snprintf(msg, CHECKER_MSG_LEN, fmt, ##args);
+#define RBD_FEATURE_EXCLUSIVE_LOCK (1 << 2)
+
struct rbd_checker_context {
int rbd_bus_id;
char *client_addr;
@@ -65,8 +67,9 @@ int libcheck_init(struct checker * c)
struct udev_device *bus_dev;
struct udev *udev;
struct stat sb;
- const char *block_name, *addr, *config_info;
+ const char *block_name, *addr, *config_info, *features_str;
const char *image, *pool, *snap, *username;
+ uint64_t features = 0;
char sysfs_path[PATH_SIZE];
int ret;
@@ -119,6 +122,15 @@ int libcheck_init(struct checker * c)
if (!ct->client_addr)
goto free_dev;
+ features_str = udev_device_get_sysattr_value(bus_dev, "features");
+ if (!features_str)
+ goto free_addr;
+ features = strtoll(features_str, NULL, 16);
+ if (!(features & RBD_FEATURE_EXCLUSIVE_LOCK)) {
+ condlog(3, "Exclusive lock not set.");
+ goto free_addr;
+ }
+
config_info = udev_device_get_sysattr_value(bus_dev, "config_info");
if (!config_info)
goto free_addr;
--
2.7.2
next prev parent reply other threads:[~2016-08-31 21:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-31 21:44 [PATCH 0/4] multipath-tools rbd checker fixes Mike Christie
2016-08-31 21:44 ` [PATCH 1/4] rbd: fix sync repair support Mike Christie
2016-08-31 21:44 ` [PATCH 2/4] rbd: check for nonshared clients Mike Christie
2016-08-31 21:44 ` Mike Christie [this message]
2016-08-31 21:44 ` [PATCH 4/4] rbd: fixup log messages Mike Christie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1472679870-25654-4-git-send-email-mchristi@redhat.com \
--to=mchristi@redhat.com \
--cc=christophe.varoqui@opensvc.com \
--cc=dm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).