From patchwork Thu Jul 8 08:42:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venky Shankar X-Patchwork-Id: 471364 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66352C07E96 for ; Thu, 8 Jul 2021 08:43:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4A6A061CCA for ; Thu, 8 Jul 2021 08:43:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231262AbhGHIpk (ORCPT ); Thu, 8 Jul 2021 04:45:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:28203 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231272AbhGHIpk (ORCPT ); Thu, 8 Jul 2021 04:45:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625733778; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TG/V7Skx2KSYU7juA/oYagr74/10LpNd4e/c1AyKDU4=; b=hfslls0n7ON0ee8bI7Nuv6+rwQHmqSMz74R/5o1mIeE6rioixqGCDh2dnKFNC9vWmXsG6Q RBOskcEqyXW8FKZj7ujl05RzeCJ8WUFjvpYEHZj1rAbhk1LduKXsn5Fg1iI8rF1R/u7sRb MNLLf7fG/m8PLi+Y/NNSDAfEJ9b5TPI= Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-234-5-3wj62eN4OMGTRVRJYOCw-1; Thu, 08 Jul 2021 04:42:57 -0400 X-MC-Unique: 5-3wj62eN4OMGTRVRJYOCw-1 Received: by mail-pg1-f197.google.com with SMTP id d28-20020a634f1c0000b02902238495b6a7so3838550pgb.16 for ; Thu, 08 Jul 2021 01:42:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TG/V7Skx2KSYU7juA/oYagr74/10LpNd4e/c1AyKDU4=; b=bhGkUOt8EV3bkgsFLzRrT8nFShLakCftfc9Rt6Vo/Bcsar197DTughcjBo+16DWj9n 3jV+XKaSO1XiLq7n/uH4h+ga1WcsWSRM2SljvplxA4WR4gF/MV3Wgw1U1hMJuyDMV81w hkqJO44auMFlcUNY/+UCotWlFRHORiTxe/L1litU9Sijz6kqHZrZHXSoLLQwkokdTVpJ 8NXsMOD+2upe8gTDcc93QXAOs8xelMNt8ECq8KjDCgtKFkMOXTtZYIU8u6mMLU3JSb7o L9fYf2jPMlNMaEsacppQ4oTvq54Y4vYWCssekOKm/htGXqV9w3jdNHq2ySdoRsEUIQ66 pzqg== X-Gm-Message-State: AOAM5313X5hGnlM0QPg8UmJu9IgZNIrhEYlx7UDiqbZ4cf+lQFSRnXd9 da/UgeOqOLEyRIM2ko9pZdxVpFRfDyaFE5bWuPlW+YjlqVWl/jO8mN05YwOM7wC1eqwFWpp2LVC zp080spsD/rmILgxZD5JOKw== X-Received: by 2002:a63:5d5c:: with SMTP id o28mr30913151pgm.22.1625733776127; Thu, 08 Jul 2021 01:42:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwi8aIB9kZL/MJOLT+rZ0ygckNKxE3Vye7OOvfWnbysvN3+jFx2FuRiQGcjpRsETav3/aj/Nw== X-Received: by 2002:a63:5d5c:: with SMTP id o28mr30913137pgm.22.1625733775957; Thu, 08 Jul 2021 01:42:55 -0700 (PDT) Received: from h3ckers-pride.redhat.com ([49.207.223.150]) by smtp.gmail.com with ESMTPSA id r14sm2154588pgm.28.2021.07.08.01.42.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jul 2021 01:42:55 -0700 (PDT) From: Venky Shankar To: jlayton@redhat.com, idryomov@gmail.com, lhenriques@suse.de Cc: pdonnell@redhat.com, ceph-devel@vger.kernel.org, Venky Shankar Subject: [PATCH v3 1/5] ceph: generalize addr/ip parsing based on delimiter Date: Thu, 8 Jul 2021 14:12:43 +0530 Message-Id: <20210708084247.182953-2-vshankar@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210708084247.182953-1-vshankar@redhat.com> References: <20210708084247.182953-1-vshankar@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Signed-off-by: Venky Shankar --- drivers/block/rbd.c | 3 ++- fs/ceph/super.c | 3 ++- include/linux/ceph/libceph.h | 4 +++- include/linux/ceph/messenger.h | 2 +- net/ceph/ceph_common.c | 8 ++++---- net/ceph/messenger.c | 4 ++-- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index bbb88eb009e0..209a7a128ea3 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -6530,7 +6530,8 @@ static int rbd_add_parse_args(const char *buf, pctx.opts->exclusive = RBD_EXCLUSIVE_DEFAULT; pctx.opts->trim = RBD_TRIM_DEFAULT; - ret = ceph_parse_mon_ips(mon_addrs, mon_addrs_size, pctx.copts, NULL); + ret = ceph_parse_mon_ips(mon_addrs, mon_addrs_size, pctx.copts, NULL, + CEPH_ADDR_PARSE_DEFAULT_DELIM); if (ret) goto out_err; diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 9b1b7f4cfdd4..039775553a88 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -271,7 +271,8 @@ static int ceph_parse_source(struct fs_parameter *param, struct fs_context *fc) dout("server path '%s'\n", fsopt->server_path); ret = ceph_parse_mon_ips(param->string, dev_name_end - dev_name, - pctx->copts, fc->log.log); + pctx->copts, fc->log.log, + CEPH_ADDR_PARSE_DEFAULT_DELIM); if (ret) return ret; diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h index 409d8c29bc4f..e50dba429819 100644 --- a/include/linux/ceph/libceph.h +++ b/include/linux/ceph/libceph.h @@ -98,6 +98,8 @@ struct ceph_options { #define CEPH_AUTH_NAME_DEFAULT "guest" +#define CEPH_ADDR_PARSE_DEFAULT_DELIM ',' + /* mount state */ enum { CEPH_MOUNT_MOUNTING, @@ -301,7 +303,7 @@ struct fs_parameter; struct fc_log; struct ceph_options *ceph_alloc_options(void); int ceph_parse_mon_ips(const char *buf, size_t len, struct ceph_options *opt, - struct fc_log *l); + struct fc_log *l, char delimiter); int ceph_parse_param(struct fs_parameter *param, struct ceph_options *opt, struct fc_log *l); int ceph_print_client_options(struct seq_file *m, struct ceph_client *client, diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h index 0e6e9ad3c3bf..c9675ee33f51 100644 --- a/include/linux/ceph/messenger.h +++ b/include/linux/ceph/messenger.h @@ -532,7 +532,7 @@ extern const char *ceph_pr_addr(const struct ceph_entity_addr *addr); extern int ceph_parse_ips(const char *c, const char *end, struct ceph_entity_addr *addr, - int max_count, int *count); + int max_count, int *count, char delimiter); extern int ceph_msgr_init(void); extern void ceph_msgr_exit(void); diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c index 97d6ea763e32..0f74ceeddf48 100644 --- a/net/ceph/ceph_common.c +++ b/net/ceph/ceph_common.c @@ -422,14 +422,14 @@ static int get_secret(struct ceph_crypto_key *dst, const char *name, } int ceph_parse_mon_ips(const char *buf, size_t len, struct ceph_options *opt, - struct fc_log *l) + struct fc_log *l, char delimiter) { struct p_log log = {.prefix = "libceph", .log = l}; int ret; - /* ip1[:port1][,ip2[:port2]...] */ + /* ip1[:port1][ip2[:port2]...] */ ret = ceph_parse_ips(buf, buf + len, opt->mon_addr, CEPH_MAX_MON, - &opt->num_mon); + &opt->num_mon, delimiter); if (ret) { error_plog(&log, "Failed to parse monitor IPs: %d", ret); return ret; @@ -456,7 +456,7 @@ int ceph_parse_param(struct fs_parameter *param, struct ceph_options *opt, err = ceph_parse_ips(param->string, param->string + param->size, &opt->my_addr, - 1, NULL); + 1, NULL, CEPH_ADDR_PARSE_DEFAULT_DELIM); if (err) { error_plog(&log, "Failed to parse ip: %d", err); return err; diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 57d043b382ed..142fc70ea45d 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -1267,7 +1267,7 @@ static int ceph_parse_server_name(const char *name, size_t namelen, */ int ceph_parse_ips(const char *c, const char *end, struct ceph_entity_addr *addr, - int max_count, int *count) + int max_count, int *count, char delimiter) { int i, ret = -EINVAL; const char *p = c; @@ -1276,7 +1276,7 @@ int ceph_parse_ips(const char *c, const char *end, for (i = 0; i < max_count; i++) { const char *ipend; int port; - char delim = ','; + char delim = delimiter; if (*p == '[') { delim = ']'; From patchwork Thu Jul 8 08:42:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venky Shankar X-Patchwork-Id: 471913 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A693CC07E9C for ; Thu, 8 Jul 2021 08:43:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8D9EA61CDD for ; Thu, 8 Jul 2021 08:43:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231310AbhGHIpn (ORCPT ); Thu, 8 Jul 2021 04:45:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40881 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231345AbhGHIpm (ORCPT ); Thu, 8 Jul 2021 04:45:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625733780; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S4cU/xx0zjvXuWehqCcQBwCFvuxaw5ZEbgauSSASq8w=; b=JjJLQ8Sn3TPnPLiXi9LGk9SkyWWz46PFtSCXqq0havw/pNJG6K2mu21yPWSe2oOSMaehmk 2WThNTXFO5NlUgqcAkvQh3wQDDgnSAFwlF/ZX3DahO1VABk8RjmYrE4yFh4FuJvDEf7RNL Zs8AZZ9SZCWpzBDrjr/uEUSoLG5F/GU= Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-589-MEvZJHVHMrqP03_w4NIdtw-1; Thu, 08 Jul 2021 04:42:59 -0400 X-MC-Unique: MEvZJHVHMrqP03_w4NIdtw-1 Received: by mail-pg1-f197.google.com with SMTP id p2-20020a63e6420000b02902271082c631so3832835pgj.5 for ; Thu, 08 Jul 2021 01:42:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S4cU/xx0zjvXuWehqCcQBwCFvuxaw5ZEbgauSSASq8w=; b=dC4/a+uPVcbe+vfLItARuGtB2yPPmTKSu1VQtB26AB7oRHiofiadvrVMBgys5vCgH1 7k7F2+TZBrVm0wcak3PxS6PbBNqhdBnp+C03hNvNytpHmnqvdFxwUMkzPqTQeHykrhgR J2ZeIpJvRc1CrBi17h1NMed5QbJYGpHBam8eD6jT6o0ackeAsxQJUg+teCrZFI3dkgxp JsG2oTRv9wwnjT+T1Wlf4kRUJBPC0yxJUro5vOk/w+tII4RTBUmSGO6Qr2BkHURQn9+c a7YjPfe28lxoGxlSr+dTHaOr+RUBawQ7bxBh4XUXD5JUQB0kZzJJxlxe3RqanS/OIQWp jY0A== X-Gm-Message-State: AOAM532qxBmYeBf0xXLJtfIO9iTOIGVQts3rSKd5EjIMd8VCPxj9iJ+I m03XNrfrZQb+Aobw7Iq/4Vmm3XriLJvujqd2OYPoy91QZ1R+FzW0EYEYC27plIBwO1/0vwld9iQ HbCRdywBW2JLbNz3qseiQbg== X-Received: by 2002:a17:90a:d50f:: with SMTP id t15mr1223043pju.160.1625733778667; Thu, 08 Jul 2021 01:42:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxI+0SBwSpyIfxG3vsqTyLq1RGBvAIZ8Jg5jykD0iMp5keZVKvlu9C6MB6OCM6w92Y9jcEwA== X-Received: by 2002:a17:90a:d50f:: with SMTP id t15mr1223028pju.160.1625733778513; Thu, 08 Jul 2021 01:42:58 -0700 (PDT) Received: from h3ckers-pride.redhat.com ([49.207.223.150]) by smtp.gmail.com with ESMTPSA id r14sm2154588pgm.28.2021.07.08.01.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jul 2021 01:42:58 -0700 (PDT) From: Venky Shankar To: jlayton@redhat.com, idryomov@gmail.com, lhenriques@suse.de Cc: pdonnell@redhat.com, ceph-devel@vger.kernel.org, Venky Shankar Subject: [PATCH v3 2/5] ceph: rename parse_fsid() to ceph_parse_fsid() and export Date: Thu, 8 Jul 2021 14:12:44 +0530 Message-Id: <20210708084247.182953-3-vshankar@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210708084247.182953-1-vshankar@redhat.com> References: <20210708084247.182953-1-vshankar@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org ... as it is too generic. also, use __func__ when logging rather than hardcoding the function name. Signed-off-by: Venky Shankar --- include/linux/ceph/libceph.h | 1 + net/ceph/ceph_common.c | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h index e50dba429819..37ab639b5012 100644 --- a/include/linux/ceph/libceph.h +++ b/include/linux/ceph/libceph.h @@ -298,6 +298,7 @@ extern bool libceph_compatible(void *data); extern const char *ceph_msg_type_name(int type); extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid); extern void *ceph_kvmalloc(size_t size, gfp_t flags); +extern int ceph_parse_fsid(const char *str, struct ceph_fsid *fsid); struct fs_parameter; struct fc_log; diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c index 0f74ceeddf48..31cbe671121c 100644 --- a/net/ceph/ceph_common.c +++ b/net/ceph/ceph_common.c @@ -217,14 +217,14 @@ void *ceph_kvmalloc(size_t size, gfp_t flags) return p; } -static int parse_fsid(const char *str, struct ceph_fsid *fsid) +int ceph_parse_fsid(const char *str, struct ceph_fsid *fsid) { int i = 0; char tmp[3]; int err = -EINVAL; int d; - dout("parse_fsid '%s'\n", str); + dout("%s '%s'\n", __func__, str); tmp[2] = 0; while (*str && i < 16) { if (ispunct(*str)) { @@ -244,9 +244,10 @@ static int parse_fsid(const char *str, struct ceph_fsid *fsid) if (i == 16) err = 0; - dout("parse_fsid ret %d got fsid %pU\n", err, fsid); + dout("%s ret %d got fsid %pU\n", __func__, err, fsid); return err; } +EXPORT_SYMBOL(ceph_parse_fsid); /* * ceph options @@ -465,7 +466,7 @@ int ceph_parse_param(struct fs_parameter *param, struct ceph_options *opt, break; case Opt_fsid: - err = parse_fsid(param->string, &opt->fsid); + err = ceph_parse_fsid(param->string, &opt->fsid); if (err) { error_plog(&log, "Failed to parse fsid: %d", err); return err; From patchwork Thu Jul 8 08:42:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venky Shankar X-Patchwork-Id: 471363 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9FBAC07E96 for ; Thu, 8 Jul 2021 08:43:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BAB2661C3F for ; Thu, 8 Jul 2021 08:43:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231347AbhGHIpr (ORCPT ); Thu, 8 Jul 2021 04:45:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:43094 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231357AbhGHIpp (ORCPT ); Thu, 8 Jul 2021 04:45:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625733783; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Euqqmuka8yQC7QIVO7bCqiBLyzfYkc+2kG9wX1SOPgg=; b=bOB3jl7xFD5M1P23iNVntCFHQsrDPCCeyHqJ90avGqQFh7DcujFpaXaqHiOIZO57RBQnSg Y43g+rxZ6Wxgx1Jqc3gyC4beh32hN+BLwhDzn9Tg6VRM/dh4HgRqeJof6uOCpg/lqKNIUG rVWo3LwCwljrBlPMRlAZu+GQRswUF7s= Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-516--xfoB5cDNUGyzjNYGlnJKA-1; Thu, 08 Jul 2021 04:43:02 -0400 X-MC-Unique: -xfoB5cDNUGyzjNYGlnJKA-1 Received: by mail-pj1-f72.google.com with SMTP id om5-20020a17090b3a85b029016eb0b21f1dso3314098pjb.4 for ; Thu, 08 Jul 2021 01:43:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Euqqmuka8yQC7QIVO7bCqiBLyzfYkc+2kG9wX1SOPgg=; b=FtNve8zo6TXIFIwytss5N6xBcZ2ASupgSNzssF3GHII5AQMu07S5gdXqW59bQ2zJ7d 81n0lrFGEN+ckLnBlUFnJttURzbRzro620jT90isCZI6XCV6J3QsuDkjP7yx6NPLffOQ jT+vUGHBqzUEcTxYMDfBtHRadfiSbpgZObpm4lVLIHIksYvh5aMVekbaoqm2Wwt+O3Un CySC8NsuK2kPyHp46jh6eZX/NKOGgT6YKdntg9oA2s8LNUJXg77iheLCUmgOpGGzqm6I cykjGlyTun3Al4XqEsCN8p6OKWBOSk51mXmZzfwgDJsIaFVfzAJRD3fmcow0pC7o3RkZ Zfpw== X-Gm-Message-State: AOAM530ZPy17yeeJ0ZX8CxyxIK/AWdSMnfnIRA5t1p17p/uuHXu6fMln TX9U7kMYJGIVrM4x6qM1VXEDK4mGFcU0E029K7nXgsaczxUNQhmaa+fzWZEZXBmOaiyWaSOrlF7 MZxm+2GRu6cofVpa0GXrzUQ== X-Received: by 2002:a17:90a:5b10:: with SMTP id o16mr27256167pji.76.1625733781386; Thu, 08 Jul 2021 01:43:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4eE/+iRidFjL1STe+yAXVe98xvS6TtZagv20AFZaZEqYOnC0YE8ku09ej3Npo7SBB1lE+Cw== X-Received: by 2002:a17:90a:5b10:: with SMTP id o16mr27256151pji.76.1625733781169; Thu, 08 Jul 2021 01:43:01 -0700 (PDT) Received: from h3ckers-pride.redhat.com ([49.207.223.150]) by smtp.gmail.com with ESMTPSA id r14sm2154588pgm.28.2021.07.08.01.42.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jul 2021 01:43:00 -0700 (PDT) From: Venky Shankar To: jlayton@redhat.com, idryomov@gmail.com, lhenriques@suse.de Cc: pdonnell@redhat.com, ceph-devel@vger.kernel.org, Venky Shankar Subject: [PATCH v3 3/5] ceph: new device mount syntax Date: Thu, 8 Jul 2021 14:12:45 +0530 Message-Id: <20210708084247.182953-4-vshankar@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210708084247.182953-1-vshankar@redhat.com> References: <20210708084247.182953-1-vshankar@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Old mount device syntax (source) has the following problems: - mounts to the same cluster but with different fsnames and/or creds have identical device string which can confuse xfstests. - Userspace mount helper tool resolves monitor addresses and fill in mon addrs automatically, but that means the device shown in /proc/mounts is different than what was used for mounting. New device syntax is as follows: cephuser@fsid.mycephfs2=/path Note, there is no "monitor address" in the device string. That gets passed in as mount option. This keeps the device string same when monitor addresses change (on remounts). Also note that the userspace mount helper tool is backward compatible. I.e., the mount helper will fallback to using old syntax after trying to mount with the new syntax. Signed-off-by: Venky Shankar --- fs/ceph/super.c | 143 ++++++++++++++++++++++++++++++++++++++++++++---- fs/ceph/super.h | 3 + 2 files changed, 136 insertions(+), 10 deletions(-) diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 039775553a88..5bb998da191e 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -145,6 +145,7 @@ enum { Opt_mds_namespace, Opt_recover_session, Opt_source, + Opt_mon_addr, /* string args above */ Opt_dirstat, Opt_rbytes, @@ -196,6 +197,7 @@ static const struct fs_parameter_spec ceph_mount_parameters[] = { fsparam_u32 ("rsize", Opt_rsize), fsparam_string ("snapdirname", Opt_snapdirname), fsparam_string ("source", Opt_source), + fsparam_string ("mon_addr", Opt_mon_addr), fsparam_u32 ("wsize", Opt_wsize), fsparam_flag_no ("wsync", Opt_wsync), {} @@ -227,9 +229,93 @@ static void canonicalize_path(char *path) } /* - * Parse the source parameter. Distinguish the server list from the path. + * Check if the mds namespace in ceph_mount_options matches + * the passed in namespace string. First time match (when + * ->mds_namespace is NULL) is treated specially, since + * ->mds_namespace needs to be initialized by the caller. + */ +static int namespace_equals(struct ceph_mount_options *fsopt, + const char *namespace, size_t len) +{ + return !(fsopt->mds_namespace && + (strlen(fsopt->mds_namespace) != len || + strncmp(fsopt->mds_namespace, namespace, len))); +} + +static int ceph_parse_old_source(const char *dev_name, const char *dev_name_end, + struct fs_context *fc) +{ + int r; + struct ceph_parse_opts_ctx *pctx = fc->fs_private; + struct ceph_mount_options *fsopt = pctx->opts; + + if (*dev_name_end != ':') + return invalfc(fc, "separator ':' missing in source"); + + r = ceph_parse_mon_ips(dev_name, dev_name_end - dev_name, + pctx->copts, fc->log.log, + CEPH_ADDR_PARSE_DEFAULT_DELIM); + if (r) + return r; + + fsopt->new_dev_syntax = false; + return 0; +} + +static int ceph_parse_new_source(const char *dev_name, const char *dev_name_end, + struct fs_context *fc) +{ + size_t len; + struct ceph_fsid fsid; + struct ceph_parse_opts_ctx *pctx = fc->fs_private; + struct ceph_mount_options *fsopt = pctx->opts; + char *fsid_start, *fs_name_start; + + if (*dev_name_end != '=') { + dout("separator '=' missing in source"); + return -EINVAL; + } + + fsid_start = strchr(dev_name, '@'); + if (!fsid_start) + return invalfc(fc, "missing cluster fsid"); + ++fsid_start; /* start of cluster fsid */ + + fs_name_start = strchr(fsid_start, '.'); + if (!fs_name_start) + return invalfc(fc, "missing file system name"); + + if (ceph_parse_fsid(fsid_start, &fsid)) + return invalfc(fc, "Invalid FSID"); + + ++fs_name_start; /* start of file system name */ + len = dev_name_end - fs_name_start; + + if (!namespace_equals(fsopt, fs_name_start, len)) + return invalfc(fc, "Mismatching mds_namespace"); + kfree(fsopt->mds_namespace); + fsopt->mds_namespace = kstrndup(fs_name_start, len, GFP_KERNEL); + if (!fsopt->mds_namespace) + return -ENOMEM; + dout("file system (mds namespace) '%s'\n", fsopt->mds_namespace); + + fsopt->new_dev_syntax = true; + return 0; +} + +/* + * Parse the source parameter for new device format. Distinguish the device + * spec from the path. Try parsing new device format and fallback to old + * format if needed. + * + * New device syntax will looks like: + * =/ + * where + * is name@fsid.fsname + * is optional, but if present must begin with '/' + * (monitor addresses are passed via mount option) * - * The source will look like: + * Old device syntax is: * [,...]:[] * where * is [:] @@ -262,25 +348,46 @@ static int ceph_parse_source(struct fs_parameter *param, struct fs_context *fc) dev_name_end = dev_name + strlen(dev_name); } - dev_name_end--; /* back up to ':' separator */ + dev_name_end--; /* back up to separator */ if (dev_name_end < dev_name || *dev_name_end != ':') - return invalfc(fc, "No path or : separator in source"); + return invalfc(fc, "Path missing in source"); dout("device name '%.*s'\n", (int)(dev_name_end - dev_name), dev_name); if (fsopt->server_path) dout("server path '%s'\n", fsopt->server_path); - ret = ceph_parse_mon_ips(param->string, dev_name_end - dev_name, - pctx->copts, fc->log.log, - CEPH_ADDR_PARSE_DEFAULT_DELIM); - if (ret) - return ret; + dout("trying new device syntax"); + ret = ceph_parse_new_source(dev_name, dev_name_end, fc); + if (ret) { + if (ret != -EINVAL) + return ret; + dout("trying old device syntax"); + ret = ceph_parse_old_source(dev_name, dev_name_end, fc); + if (ret) + return ret; + } fc->source = param->string; param->string = NULL; return 0; } +#define CEPH_MON_ADDR_MNTOPT_DELIM '/' +static int ceph_parse_mon_addr(struct fs_parameter *param, + struct fs_context *fc) +{ + struct ceph_parse_opts_ctx *pctx = fc->fs_private; + struct ceph_mount_options *fsopt = pctx->opts; + + kfree(fsopt->mon_addr); + fsopt->mon_addr = param->string; + param->string = NULL; + + return ceph_parse_mon_ips(fsopt->mon_addr, strlen(fsopt->mon_addr), + pctx->copts, fc->log.log, + CEPH_MON_ADDR_MNTOPT_DELIM); +} + static int ceph_parse_mount_param(struct fs_context *fc, struct fs_parameter *param) { @@ -306,6 +413,8 @@ static int ceph_parse_mount_param(struct fs_context *fc, param->string = NULL; break; case Opt_mds_namespace: + if (!namespace_equals(fsopt, param->string, strlen(param->string))) + return invalfc(fc, "Mismatching mds_namespace"); kfree(fsopt->mds_namespace); fsopt->mds_namespace = param->string; param->string = NULL; @@ -323,6 +432,8 @@ static int ceph_parse_mount_param(struct fs_context *fc, if (fc->source) return invalfc(fc, "Multiple sources specified"); return ceph_parse_source(param, fc); + case Opt_mon_addr: + return ceph_parse_mon_addr(param, fc); case Opt_wsize: if (result.uint_32 < PAGE_SIZE || result.uint_32 > CEPH_MAX_WRITE_SIZE) @@ -474,6 +585,7 @@ static void destroy_mount_options(struct ceph_mount_options *args) kfree(args->mds_namespace); kfree(args->server_path); kfree(args->fscache_uniq); + kfree(args->mon_addr); kfree(args); } @@ -517,6 +629,10 @@ static int compare_mount_options(struct ceph_mount_options *new_fsopt, if (ret) return ret; + ret = strcmp_null(fsopt1->mon_addr, fsopt2->mon_addr); + if (ret) + return ret; + return ceph_compare_options(new_opt, fsc->client); } @@ -572,9 +688,13 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root) if ((fsopt->flags & CEPH_MOUNT_OPT_NOCOPYFROM) == 0) seq_puts(m, ",copyfrom"); - if (fsopt->mds_namespace) + /* dump mds_namespace when old device syntax is in use */ + if (fsopt->mds_namespace && !fsopt->new_dev_syntax) seq_show_option(m, "mds_namespace", fsopt->mds_namespace); + if (fsopt->mon_addr) + seq_printf(m, ",mon_addr=%s", fsopt->mon_addr); + if (fsopt->flags & CEPH_MOUNT_OPT_CLEANRECOVER) seq_show_option(m, "recover_session", "clean"); @@ -1049,6 +1169,7 @@ static int ceph_setup_bdi(struct super_block *sb, struct ceph_fs_client *fsc) static int ceph_get_tree(struct fs_context *fc) { struct ceph_parse_opts_ctx *pctx = fc->fs_private; + struct ceph_mount_options *fsopt = pctx->opts; struct super_block *sb; struct ceph_fs_client *fsc; struct dentry *res; @@ -1060,6 +1181,8 @@ static int ceph_get_tree(struct fs_context *fc) if (!fc->source) return invalfc(fc, "No source"); + if (fsopt->new_dev_syntax && !fsopt->mon_addr) + return invalfc(fc, "No monitor address"); /* create client (which we may/may not use) */ fsc = create_fs_client(pctx->opts, pctx->copts); diff --git a/fs/ceph/super.h b/fs/ceph/super.h index c48bb30c8d70..8f71184b7c85 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -87,6 +87,8 @@ struct ceph_mount_options { unsigned int max_readdir; /* max readdir result (entries) */ unsigned int max_readdir_bytes; /* max readdir result (bytes) */ + bool new_dev_syntax; + /* * everything above this point can be memcmp'd; everything below * is handled in compare_mount_options() @@ -96,6 +98,7 @@ struct ceph_mount_options { char *mds_namespace; /* default NULL */ char *server_path; /* default NULL (means "/") */ char *fscache_uniq; /* default NULL */ + char *mon_addr; }; struct ceph_fs_client { From patchwork Thu Jul 8 08:42:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venky Shankar X-Patchwork-Id: 471912 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6330C07E9E for ; Thu, 8 Jul 2021 08:43:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8CEE561C3F for ; Thu, 8 Jul 2021 08:43:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231342AbhGHIpt (ORCPT ); Thu, 8 Jul 2021 04:45:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45760 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231355AbhGHIps (ORCPT ); Thu, 8 Jul 2021 04:45:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625733786; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p0nvQWZ1o/sDGjWheB2cwL9+k65hUTx5BPnlMy+GzJY=; b=GlbICNwBt/g5322CZv5PlMfDKxmkStBMvRvBVv4t4Piu/Zs2vJkBmF6HzTGZ49ifsAfUfa rSdY9AuP9pcTkrymv+UBMZhkc5dGkHpwelP/h0HSqvTF6fLwG7yuwWOEQMdA+J/eoIzY4q xbmTZCty3wuqGGcmyvzjO7fdGxjWGsE= Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-231-PeH8Ioz8OSudG__4x75lwQ-1; Thu, 08 Jul 2021 04:43:05 -0400 X-MC-Unique: PeH8Ioz8OSudG__4x75lwQ-1 Received: by mail-pl1-f198.google.com with SMTP id z10-20020a170903018ab02901108a797206so1684405plg.16 for ; Thu, 08 Jul 2021 01:43:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p0nvQWZ1o/sDGjWheB2cwL9+k65hUTx5BPnlMy+GzJY=; b=qUY37EJUwdHlGN1JITTp35+BzW5KWp8w8agP0xQr9pSd/BXKM51/0sBHmBnZkU6VRI NfqeTZ0NQbIISmIeA/Li5ph6QLlKzFSH1jBO+VMKwdnhcMogHpwkFjRrzve7HYowOTUu IDB5zGRzcNz4gyi4NbLVuUViJ5D+MLEn+50X/Um8Ab4hvIn5DpbK1iBju10kKaTICN9i mrk3TImLj6VfnwvSCyPmNmmrMlV/WJXPhHbOuUTD3DJ6QPItKytbDle4S2SuPw2PVGIy f3r0Tvm3y4UxAVdgTcnxUg4GQZsh9FOULkBRKkXgnQEycuqReJojH+QcxtRn1Dq8Xc+L LnKA== X-Gm-Message-State: AOAM530YIWWF3QX5bOL90Xd6oUdco+oI+30jsbK0cPRKoSwguZ6d8c9L giGxuIBgSTa+X3SMcFOSIP4EQrQQ4PjcgL7upPGFB+sxxV+1IbkWg0BYUwBaPtvO0gK7eF1JkpH RDgwBLEp1Fxmjqe6T1mYJtw== X-Received: by 2002:a63:4002:: with SMTP id n2mr30420184pga.124.1625733784034; Thu, 08 Jul 2021 01:43:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+0BTZEQPemDZ+FbtCeP+FDc3HE5RYedJLtRmbz8Alz5xkBvY18Mw1kegWgMzwq/7f9zYEZw== X-Received: by 2002:a63:4002:: with SMTP id n2mr30420166pga.124.1625733783899; Thu, 08 Jul 2021 01:43:03 -0700 (PDT) Received: from h3ckers-pride.redhat.com ([49.207.223.150]) by smtp.gmail.com with ESMTPSA id r14sm2154588pgm.28.2021.07.08.01.43.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jul 2021 01:43:03 -0700 (PDT) From: Venky Shankar To: jlayton@redhat.com, idryomov@gmail.com, lhenriques@suse.de Cc: pdonnell@redhat.com, ceph-devel@vger.kernel.org, Venky Shankar Subject: [PATCH v3 4/5] ceph: record updated mon_addr on remount Date: Thu, 8 Jul 2021 14:12:46 +0530 Message-Id: <20210708084247.182953-5-vshankar@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210708084247.182953-1-vshankar@redhat.com> References: <20210708084247.182953-1-vshankar@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Note that the new monitors are just shown in /proc/mounts. Ceph does not (re)connect to new monitors yet. Signed-off-by: Venky Shankar --- fs/ceph/super.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 5bb998da191e..083b0b4b0f25 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -1268,6 +1268,12 @@ static int ceph_reconfigure_fc(struct fs_context *fc) else ceph_clear_mount_opt(fsc, ASYNC_DIROPS); + if (strcmp(fsc->mount_options->mon_addr, fsopt->mon_addr)) { + kfree(fsc->mount_options->mon_addr); + fsc->mount_options->mon_addr = fsopt->mon_addr; + fsopt->mon_addr = NULL; + } + sync_filesystem(fc->root->d_sb); return 0; } From patchwork Thu Jul 8 08:42:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venky Shankar X-Patchwork-Id: 471362 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 720D4C07E99 for ; Thu, 8 Jul 2021 08:43:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5CB0C61CCA for ; Thu, 8 Jul 2021 08:43:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231394AbhGHIpv (ORCPT ); Thu, 8 Jul 2021 04:45:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:22256 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231384AbhGHIpu (ORCPT ); Thu, 8 Jul 2021 04:45:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625733788; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5z87lSglp1R+XOAVM/WPJyePD3cVLLHAqajJ2nmRuNY=; b=R+bj66X1GTsDzVMJtXSG5WU6DIUhWx9RoUpFW7Ca+LSVvGf1hbaCvqOGbcMQkaOE1FqaXY PqvxntuGDXs5tbqa+hosPgRADnLMfzN30xtuU4sPsQDk9oXAi3NoxByIwQxD1XrDk7az6O AtX3JVHPsENH0MJpI9dKMwZzMDZ4It4= Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-573-ULh2wJfXO1GN4hpuvTeu7g-1; Thu, 08 Jul 2021 04:43:07 -0400 X-MC-Unique: ULh2wJfXO1GN4hpuvTeu7g-1 Received: by mail-pj1-f71.google.com with SMTP id p22-20020a17090a9316b029016a0aced749so68997pjo.9 for ; Thu, 08 Jul 2021 01:43:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5z87lSglp1R+XOAVM/WPJyePD3cVLLHAqajJ2nmRuNY=; b=FHRKMCKZ4cW29wuL97vT1Rv1a1C1gHx6AZPkjbK9BYqjtjxnTLjSnk1bAuiBdtYEAA qZUbE4yLt7pElw9lnf4pJAZIz80zOAfxsVDMHp99r1elik7BveOoJCtQfaDU+qUKF9gQ kwHY//4TlpsXR3ntiHzVDM1clT2ue6rAnL14kgUEjj75gIkvxMoXxkFWfdBWKignXmUf Pc5/Hfo3l6UWJKByKAlwf6vuBZtGoXhLJ9pvosjl9grgTSZAmRZ1qyY1/rVpFCoqBFTV LN5mUomiHv+qpdWeevixhZ4xe5R5pdDMow3D0HFwLResBnD4cGZTTaCP/yJaRS6G6X/9 6eAg== X-Gm-Message-State: AOAM532ljnGkjVpf4ekTOJUdcy3JgoOMOFv0Mx5W80HMRk+zu3aPvPa0 6Hze7XLWCzr5dRwLhgqoHaUTbQApe2S0utIR4/UkOTsiv+veTedxpHg2nFIzsi3TwJAKlgfrEuM A3H+THBLdixC9CoXlgvFC4Q== X-Received: by 2002:a17:90a:df0b:: with SMTP id gp11mr1662904pjb.35.1625733786647; Thu, 08 Jul 2021 01:43:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5EWLwGHvJhcaRF8F4x2qA3gC7QDDsKvRGng0YHnuh8iqE7Fvqm65uamzt4idgHUnvaxd1dQ== X-Received: by 2002:a17:90a:df0b:: with SMTP id gp11mr1662894pjb.35.1625733786471; Thu, 08 Jul 2021 01:43:06 -0700 (PDT) Received: from h3ckers-pride.redhat.com ([49.207.223.150]) by smtp.gmail.com with ESMTPSA id r14sm2154588pgm.28.2021.07.08.01.43.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jul 2021 01:43:06 -0700 (PDT) From: Venky Shankar To: jlayton@redhat.com, idryomov@gmail.com, lhenriques@suse.de Cc: pdonnell@redhat.com, ceph-devel@vger.kernel.org, Venky Shankar Subject: [PATCH v3 5/5] doc: document new CephFS mount device syntax Date: Thu, 8 Jul 2021 14:12:47 +0530 Message-Id: <20210708084247.182953-6-vshankar@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210708084247.182953-1-vshankar@redhat.com> References: <20210708084247.182953-1-vshankar@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Signed-off-by: Venky Shankar --- Documentation/filesystems/ceph.rst | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/Documentation/filesystems/ceph.rst b/Documentation/filesystems/ceph.rst index 7d2ef4e27273..4942e018db85 100644 --- a/Documentation/filesystems/ceph.rst +++ b/Documentation/filesystems/ceph.rst @@ -82,7 +82,7 @@ Mount Syntax The basic mount syntax is:: - # mount -t ceph monip[:port][,monip2[:port]...]:/[subdir] mnt + # mount -t ceph user@fsid.fs_name=/[subdir] mnt -o mon_addr=monip1[:port][/monip2[:port]] You only need to specify a single monitor, as the client will get the full list when it connects. (However, if the monitor you specify @@ -90,16 +90,35 @@ happens to be down, the mount won't succeed.) The port can be left off if the monitor is using the default. So if the monitor is at 1.2.3.4:: - # mount -t ceph 1.2.3.4:/ /mnt/ceph + # mount -t ceph cephuser@07fe3187-00d9-42a3-814b-72a4d5e7d5be.cephfs=/ /mnt/ceph -o mon_addr=1.2.3.4 is sufficient. If /sbin/mount.ceph is installed, a hostname can be -used instead of an IP address. +used instead of an IP address and the cluster FSID can be left out +(as the mount helper will fill it in by reading the ceph configuration +file):: + # mount -t ceph cephuser@cephfs=/ /mnt/ceph -o mon_addr=mon-addr +Multiple monitor addresses can be passed by separating each address with a slash (`/`):: + + # mount -t ceph cephuser@cephfs=/ /mnt/ceph -o mon_addr=192.168.1.100/192.168.1.101 + +When using the mount helper, monitor address can be read from ceph +configuration file if available. Note that, the cluster FSID (passed as part +of the device string) is validated by checking it with the FSID reported by +the monitor. Mount Options ============= + mon_addr=ip_address[:port][/ip_address[:port]] + Monitor address to the cluster. This is used to bootstrap the + connection to the cluster. Once connection is established, the + monitor addresses in the monitor map are followed. + + fsid=cluster-id + FSID of the cluster (from `ceph fsid` command). + ip=A.B.C.D[:N] Specify the IP and/or port the client should bind to locally. There is normally not much reason to do this. If the IP is not