From patchwork Wed Aug 24 13:18:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 9297727 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F2A8A60757 for ; Wed, 24 Aug 2016 13:21:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4EFC28FE6 for ; Wed, 24 Aug 2016 13:21:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9E8928FE9; Wed, 24 Aug 2016 13:21:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E7FB28FE6 for ; Wed, 24 Aug 2016 13:21:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755991AbcHXNVC (ORCPT ); Wed, 24 Aug 2016 09:21:02 -0400 Received: from mail-yw0-f196.google.com ([209.85.161.196]:36153 "EHLO mail-yw0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753890AbcHXNT6 (ORCPT ); Wed, 24 Aug 2016 09:19:58 -0400 Received: by mail-yw0-f196.google.com with SMTP id u134so786198ywg.3 for ; Wed, 24 Aug 2016 06:19:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=sET5GtW3/aRXixtBU8QMP7lIVvbTOzoglVp+yf1WoN0=; b=f5I0+CIJHV8YTzH4FfchAWVTWWM8qlr0upEpbTArX0j7DJpatOgvcm3d+OPajnDHyp 5xYxd0nVhJ3i75X2IeAMVxTB3ZKJHN8T7h02KGU105U5qzKVUErmETxSJF/Kr2bUTZ0f 5VT2HiOKEWJG1fH4wo+Fur4Au/lReyrbiui4B6LLkVfwsQoOZTLESp62Qi2P+x2TuWJS QI0mU4eMU8BIE1T2rzpaEupqn9JBsyjnN59UDvYWXveqFwKdY+OOT4FyoyoC93f1Cwgt an12o5Nnh+zfviUZrzR+41hNV17Om0Hbmq/RJxHQMWOBNfFmKkefIUA8WiH0L08KBPFs eOhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=sET5GtW3/aRXixtBU8QMP7lIVvbTOzoglVp+yf1WoN0=; b=A16HJGiu8pO7q3+s24bSIJ0mmFjfR98Is56ggHedBCrDAyEoj2urKgXWWXt5z9l+VF 8Q9qQCW++lQkPdYjQ1SoPPsww5vqooqnBhBdEwKsjnZz3QH+DvojfKOaiJt8jDoC0/jG 2UrI2L+6tGS4ZcZQu5O78kjydtvq/3tATTmKXA59YVUkZQNgA7JGh0E8PG5rwfCfoV9w uh6FtTkmRXpwJxquz6Zghvittz/FlXX2jS/lFKc7AFroL8r2TMN0Zonct8wM/JV5fFdr C+zwxfht63QFsc5DY73uoYjW7mL93cKQs5+fh5qMCL5O+/BBDb06q0J4psJi+F7t8RgC kS0g== X-Gm-Message-State: AE9vXwPbvBAxb608dA7emKw35sA9fjajLyt3JF8hMA+m4IaAA+g4fpBzZpyijwUpfYx9RQ== X-Received: by 10.129.161.85 with SMTP id y82mr2288956ywg.217.1472044745154; Wed, 24 Aug 2016 06:19:05 -0700 (PDT) Received: from dhcp-1-219.brq.redhat.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id e197sm5371294ywa.16.2016.08.24.06.19.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Aug 2016 06:19:04 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Subject: [PATCH 13/16] rbd: add 'cluster_fsid' sysfs rbd device attribute Date: Wed, 24 Aug 2016 15:18:37 +0200 Message-Id: <1472044720-29116-14-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1472044720-29116-1-git-send-email-idryomov@gmail.com> References: <1472044720-29116-1-git-send-email-idryomov@gmail.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Mike Christie Export the cluster fsid, so tools like udev and multipath-tools can use it for part of the uuid. Signed-off-by: Mike Christie Signed-off-by: Ilya Dryomov --- Documentation/ABI/testing/sysfs-bus-rbd | 4 ++++ drivers/block/rbd.c | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-rbd b/Documentation/ABI/testing/sysfs-bus-rbd index 273e27f2491f..9a655f3f4386 100644 --- a/Documentation/ABI/testing/sysfs-bus-rbd +++ b/Documentation/ABI/testing/sysfs-bus-rbd @@ -53,6 +53,10 @@ client_id The ceph unique client id that was assigned for this specific session. +cluster_fsid + + The ceph cluster UUID. (August 2016, since 4.9.) + features A hexadecimal encoding of the feature bits for this image. diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 69d76c3afcdd..c95104a80065 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -4612,6 +4612,14 @@ static ssize_t rbd_client_id_show(struct device *dev, ceph_client_gid(rbd_dev->rbd_client->client)); } +static ssize_t rbd_cluster_fsid_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); + + return sprintf(buf, "%pU\n", &rbd_dev->rbd_client->client->fsid); +} + static ssize_t rbd_pool_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -4715,6 +4723,7 @@ 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(cluster_fsid, S_IRUGO, rbd_cluster_fsid_show, NULL); static DEVICE_ATTR(pool, S_IRUGO, rbd_pool_show, NULL); static DEVICE_ATTR(pool_id, S_IRUGO, rbd_pool_id_show, NULL); static DEVICE_ATTR(name, S_IRUGO, rbd_name_show, NULL); @@ -4730,6 +4739,7 @@ static struct attribute *rbd_attrs[] = { &dev_attr_minor.attr, &dev_attr_client_addr.attr, &dev_attr_client_id.attr, + &dev_attr_cluster_fsid.attr, &dev_attr_pool.attr, &dev_attr_pool_id.attr, &dev_attr_name.attr,