linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: mark.doffman@codethink.co.uk
To: ceph-devel@vger.kernel.org
Cc: Mark Doffman <mark.doffman@codethink.co.uk>,
	sage@inktank.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org,
	rob.taylor@codethink.co.uk
Subject: [PATCH 3/4] cephroot: Add DHCP option 17 configuration to ceph root fs.
Date: Wed, 20 Nov 2013 20:13:43 -0600	[thread overview]
Message-ID: <1385000024-23463-4-git-send-email-mark.doffman@codethink.co.uk> (raw)
In-Reply-To: <1385000024-23463-1-git-send-email-mark.doffman@codethink.co.uk>

From: Mark Doffman <mark.doffman@codethink.co.uk>

When not configured via kernel parameters add to cephroot
the ability to configure server address, path and options
from DHCP option 17.

Signed-off-by: Mark Doffman <mark.doffman@codethink.co.uk>
Reviewed-by: Ian Molton <ian.molton@codethink.co.uk>
---
 Documentation/filesystems/ceph/cephroot.txt |  4 ++++
 fs/ceph/root.c                              | 12 +++++++-----
 net/ipv4/ipconfig.c                         | 10 ++++++++--
 3 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/Documentation/filesystems/ceph/cephroot.txt b/Documentation/filesystems/ceph/cephroot.txt
index ae0f5bb..4f12573 100644
--- a/Documentation/filesystems/ceph/cephroot.txt
+++ b/Documentation/filesystems/ceph/cephroot.txt
@@ -49,6 +49,9 @@ This is necessary to enable the pseudo-Ceph-device. Note that it's not a
 real device but just a synonym to tell the kernel to use Ceph instead of
 a real device.
 
+If cephroot is not specified, it is expected that that a valid mount will be
+found via DHCP option 17, Root Path [1]
+
 cephroot=<monaddr>:/[<subdir>],<ceph-opts>
 
   <monaddr>     Monitor address. Each takes the form host[:port]. If the port
@@ -64,6 +67,7 @@ cephroot=<monaddr>:/[<subdir>],<ceph-opts>
 4.) References
     ----------
 
+[1] http://tools.ietf.org/html/rfc2132
 
 5.) Credits
     -------
diff --git a/fs/ceph/root.c b/fs/ceph/root.c
index bff67fb..24b8dcf 100644
--- a/fs/ceph/root.c
+++ b/fs/ceph/root.c
@@ -37,9 +37,6 @@ static char ceph_root_options[256] __initdata;
 /* server:path string passed to mount */
 static char ceph_root_device[MAXPATHLEN + 1] __initdata;
 
-/* Address of CEPH server */
-static __be32 root_ceph_server_addr = htonl(INADDR_NONE);
-
 /*
  * Parse out root export path and mount options from
  * passed-in string @incoming.
@@ -97,7 +94,7 @@ static int __init ceph_root_setup(char *line)
 	 * Note: root_nfs_parse_addr() removes the server-ip from
 	 * ceph_root_params, if it exists.
 	 */
-	root_ceph_server_addr = root_nfs_parse_addr(ceph_root_params);
+	root_server_addr = root_nfs_parse_addr(ceph_root_params);
 
 	return 1;
 }
@@ -120,7 +117,7 @@ int __init ceph_root_data(char **root_device, char **root_data)
 	int len;
 	int ret = -E2BIG;
 
-	servaddr = root_ceph_server_addr;
+	servaddr = root_server_addr;
 	if (servaddr == htonl(INADDR_NONE))
 		return -ENOENT;
 
@@ -128,6 +125,11 @@ int __init ceph_root_data(char **root_device, char **root_data)
 	if (tmp == NULL)
 		return -ENOMEM;
 
+	if (root_server_path[0] != '\0') {
+		if (root_ceph_parse_options(root_server_path, tmp, tmplen))
+			goto out;
+	}
+
 	if (ceph_root_params[0] != '\0') {
 		if (root_ceph_parse_options(ceph_root_params, tmp, tmplen))
 			goto out;
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index efa1138..765eea4 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -1435,10 +1435,10 @@ static int __init ip_auto_config(void)
 	 * missing values.
 	 */
 	if (ic_myaddr == NONE ||
-#ifdef CONFIG_ROOT_NFS
+#if defined(CONFIG_ROOT_NFS) || defined(CONFIG_ROOT_CEPH)
 	    (root_server_addr == NONE &&
 	     ic_servaddr == NONE &&
-	     ROOT_DEV == Root_NFS) ||
+	     (ROOT_DEV == Root_NFS || ROOT_DEV == Root_CEPH)) ||
 #endif
 	    ic_first_dev->next) {
 #ifdef IPCONFIG_DYNAMIC
@@ -1465,6 +1465,12 @@ static int __init ip_auto_config(void)
 				goto try_try_again;
 			}
 #endif
+#ifdef CONFIG_ROOT_CEPH
+			if (ROOT_DEV ==  Root_CEPH) {
+				pr_err("IP-Config: Retrying forever (CEPH root)...\n");
+				goto try_try_again;
+			}
+#endif
 
 			if (--retries) {
 				pr_err("IP-Config: Reopening network devices...\n");
-- 
1.8.4


  parent reply	other threads:[~2013-11-21  2:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-21  2:13 [PATCH 0/4] Add ceph root filesystem functionality and documentation mark.doffman
2013-11-21  2:13 ` [PATCH 1/4] init: Add a new root device option, the Ceph file system mark.doffman
2013-12-07  6:10   ` Sage Weil
2013-11-21  2:13 ` [PATCH 2/4] Documentation: Document the cephroot functionality mark.doffman
2013-12-07  5:57   ` Sage Weil
2014-01-15 17:22     ` Mark Doffman
2013-11-21  2:13 ` mark.doffman [this message]
2013-11-21  2:13 ` [PATCH 4/4] Reuse root_nfs_parse_addr() for NFS and CEPH mark.doffman
2013-11-21 20:19 ` [PATCH 0/4] Add ceph root filesystem functionality and documentation David Dillow
2013-11-22 16:53   ` Mark Doffman
2014-01-15 17:26 ` [PATCH v2 0/2] " mark.doffman
2014-01-15 17:26 ` [PATCH v2 1/2] init: Add a new root device option, the Ceph file system mark.doffman
2014-01-15 17:26 ` [PATCH v2 2/2] Documentation: Document the cephroot functionality mark.doffman
2014-01-15 18:00   ` Randy Dunlap

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=1385000024-23463-4-git-send-email-mark.doffman@codethink.co.uk \
    --to=mark.doffman@codethink.co.uk \
    --cc=ceph-devel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rob.taylor@codethink.co.uk \
    --cc=sage@inktank.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).