diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2016-08-18 18:38:43 +0200 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2016-08-24 23:49:16 +0200 |
commit | 005a07bf0a92e7f0e73fc9a6c9acc992c5dbd00c (patch) | |
tree | 4b8eb1b877b4d2c50934bef8e2df402d0893dcfc /drivers/block | |
parent | ca7909e8bbb4ddc549fa1e8afa695f147bb6358c (diff) | |
download | linux-005a07bf0a92e7f0e73fc9a6c9acc992c5dbd00c.tar.bz2 |
rbd: add 'client_addr' sysfs rbd device attribute
Export client addr/nonce, so userspace can check if a image is being
blacklisted.
Signed-off-by: Mike Christie <mchristi@redhat.com>
[idryomov@gmail.com: ceph_client_addr(), endianess fix]
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/rbd.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index fd1a9891b348..69d76c3afcdd 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -4592,6 +4592,17 @@ static ssize_t rbd_minor_show(struct device *dev, return sprintf(buf, "%d\n", rbd_dev->minor); } +static ssize_t rbd_client_addr_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); + struct ceph_entity_addr *client_addr = + ceph_client_addr(rbd_dev->rbd_client->client); + + return sprintf(buf, "%pISpc/%u\n", &client_addr->in_addr, + le32_to_cpu(client_addr->nonce)); +} + static ssize_t rbd_client_id_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -4702,6 +4713,7 @@ static DEVICE_ATTR(size, S_IRUGO, rbd_size_show, NULL); static DEVICE_ATTR(features, S_IRUGO, rbd_features_show, NULL); static DEVICE_ATTR(major, S_IRUGO, rbd_major_show, NULL); static DEVICE_ATTR(minor, S_IRUGO, rbd_minor_show, NULL); +static DEVICE_ATTR(client_addr, S_IRUGO, rbd_client_addr_show, NULL); static DEVICE_ATTR(client_id, S_IRUGO, rbd_client_id_show, NULL); static DEVICE_ATTR(pool, S_IRUGO, rbd_pool_show, NULL); static DEVICE_ATTR(pool_id, S_IRUGO, rbd_pool_id_show, NULL); @@ -4716,6 +4728,7 @@ static struct attribute *rbd_attrs[] = { &dev_attr_features.attr, &dev_attr_major.attr, &dev_attr_minor.attr, + &dev_attr_client_addr.attr, &dev_attr_client_id.attr, &dev_attr_pool.attr, &dev_attr_pool_id.attr, |