Skip to contentSkip to conversation

nfsd/exportfs: changes handling of unresolvable entries

PATCH In review Henrique Martins 4 participants 7 messages Nov 4, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nfsd/exportfs: changes handling of unresolvable entries

In-reply-to: <[email protected]>
References: <[email protected]>
<[email protected]> <[email protected]>
Comments: In-reply-to Steve Dickson <[email protected]>
message dated "Tue, 04 Nov 2014 12:57:25 -0500."
X-Mailer: MH-E 8.5; nmh 1.6; XEmacs 21.5 (beta34)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
--------
--=-=-=
Content-Type: text/plain; charset=utf-8

Attaching patch to nfs/exportfs to allow nfsd to start when there are some, but not all, unresolvable entries in /etc/exports.

Nfs currently fails to start in my laptop which has work machines listed in exports that aren't resolvable when I'm not in the office, and home machines in exports that aren't resolvable when I'm not home.

Files changed:
- in client.c/client_lookup:
changes the (x)log level for unresolvable entries in /etc/exports from L_ERROR to L_WARNING,
- in hostname.c/host_addrinfo:
changes the (x)log level for unresolvable entries in /etc/exports from D_GENERAL to D_PARSE,
- in export.c/export_read:
counts the number of exported volume entries and generates a (x)log L_ERROR if no volumes are exported.

Built and tested on a Fedora 20 (fully updated) system.

---

--=-=-=
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: inline; filename=nfs-utils-1.3.0-exportfs.patch

support/export/client.c renamed from support/export/client.c.orig +1 -1
@@ -277,7 +277,7 @@
 	if (htype == MCL_FQDN && !canonical) {
 		ai = host_addrinfo(hname);
 		if (!ai) {
-			xlog(L_ERROR, "Failed to resolve %s", hname);
+			xlog(L_WARNING, "Failed to resolve %s", hname);
 			goto out;
 		}
 		hname = ai->ai_canonname;
support/export/hostname.c renamed from support/export/hostname.c.orig +2 -2
@@ -175,11 +175,11 @@
 	case 0:
 		return ai;
 	case EAI_SYSTEM:
-		xlog(D_GENERAL, "%s: failed to resolve %s: (%d) %m",
+		xlog(D_PARSE, "%s: failed to resolve %s: (%d) %m",
 				__func__, hostname, errno);
 		break;
 	default:
-		xlog(D_GENERAL, "%s: failed to resolve %s: %s",
+		xlog(D_PARSE, "%s: failed to resolve %s: %s",
 				__func__, hostname, gai_strerror(error));
 		break;
 	}
support/export/export.c renamed from support/export/export.c.orig +9 -2
@@ -76,15 +76,22 @@
 	struct exportent	*eep;
 	nfs_export		*exp;
 
+        int volumes = 0;
+
 	setexportent(fname, "r");
 	while ((eep = getexportent(0,1)) != NULL) {
 		exp = export_lookup(eep->e_hostname, eep->e_path, 0);
-		if (!exp)
-			export_create(eep, 0);
+		if (!exp) {
+			exp = export_create(eep, 0);
+                        if (exp)
+                        	volumes++;
+                }
 		else
 			warn_duplicated_exports(exp, eep);
 	}
 	endexportent();
+        if (volumes == 0)
+        	xlog(L_ERROR, "no or all unresolvable export entries");
 }
 
 /**

--=-=-=--

#1 lore raw

Hey Henrique,

Quoted 77 lines · Henrique Martins

In-reply-to: <[email protected]>
References: <[email protected]>
<[email protected]> <[email protected]>
Comments: In-reply-to Steve Dickson <[email protected]>
message dated "Tue, 04 Nov 2014 12:57:25 -0500."
X-Mailer: MH-E 8.5; nmh 1.6; XEmacs 21.5 (beta34)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
--------
--=-=-=
Content-Type: text/plain; charset=utf-8

Attaching patch to nfs/exportfs to allow nfsd to start when there are some, but not all, unresolvable entries in /etc/exports.

Nfs currently fails to start in my laptop which has work machines listed in exports that aren't resolvable when I'm not in the office, and home machines in exports that aren't resolvable when I'm not home.

Files changed:
- in client.c/client_lookup:
changes the (x)log level for unresolvable entries in /etc/exports from L_ERROR to L_WARNING,
- in hostname.c/host_addrinfo:
changes the (x)log level for unresolvable entries in /etc/exports from D_GENERAL to D_PARSE,
- in export.c/export_read:
counts the number of exported volume entries and generates a (x)log L_ERROR if no volumes are exported.

Built and tested on a Fedora 20 (fully updated) system.

---

--=-=-=
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: inline; filename=nfs-utils-1.3.0-exportfs.patch

support/export/client.c renamed from support/export/client.c.orig +1 -1
@@ -277,7 +277,7 @@
 	if (htype == MCL_FQDN && !canonical) {
 		ai = host_addrinfo(hname);
 		if (!ai) {
-			xlog(L_ERROR, "Failed to resolve %s", hname);
+			xlog(L_WARNING, "Failed to resolve %s", hname);
 			goto out;
 		}
 		hname = ai->ai_canonname;
support/export/hostname.c renamed from support/export/hostname.c.orig +2 -2
@@ -175,11 +175,11 @@
 	case 0:
 		return ai;
 	case EAI_SYSTEM:
-		xlog(D_GENERAL, "%s: failed to resolve %s: (%d) %m",
+		xlog(D_PARSE, "%s: failed to resolve %s: (%d) %m",
 				__func__, hostname, errno);
 		break;
 	default:
-		xlog(D_GENERAL, "%s: failed to resolve %s: %s",
+		xlog(D_PARSE, "%s: failed to resolve %s: %s",
 				__func__, hostname, gai_strerror(error));
 		break;
 	}
support/export/export.c renamed from support/export/export.c.orig +2 -0
@@ -76,15 +76,22 @@
 	struct exportent	*eep;
 	nfs_export		*exp;
 
+        int volumes = 0;
+

support/export/export.c line 88

Quoted 10 lines
support/export/export.c renamed from support/export/export.c.orig +5 -2
 	setexportent(fname, "r");
 	while ((eep = getexportent(0,1)) != NULL) {
 		exp = export_lookup(eep->e_hostname, eep->e_path, 0);
-		if (!exp)
-			export_create(eep, 0);
+		if (!exp) {
+			exp = export_create(eep, 0);
+                        if (exp)
+                        	volumes++;
+                }

I think you should be indenting your code with tabs instead of spaces to be consistent with the rest of this file.

Thanks,
Anna

Quoted 15 lines
support/export/export.c renamed from support/export/export.c.orig +2 -2
 		else
 			warn_duplicated_exports(exp, eep);
 	}
 	endexportent();
+        if (volumes == 0)
+        	xlog(L_ERROR, "no or all unresolvable export entries");
 }
 
 /**
 
--=-=-=--
--

To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

Hello,

Quoted 79 lines · Anna Schumaker

Hey Henrique,

Quoted 75 lines · Henrique Martins

In-reply-to: <[email protected]>
References: <[email protected]>
<[email protected]> <[email protected]>
Comments: In-reply-to Steve Dickson <[email protected]>
message dated "Tue, 04 Nov 2014 12:57:25 -0500."
X-Mailer: MH-E 8.5; nmh 1.6; XEmacs 21.5 (beta34)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
--------
--=-=-=
Content-Type: text/plain; charset=utf-8

Attaching patch to nfs/exportfs to allow nfsd to start when there are some, but not all, unresolvable entries in /etc/exports.

Nfs currently fails to start in my laptop which has work machines listed in exports that aren't resolvable when I'm not in the office, and home machines in exports that aren't resolvable when I'm not home.

Files changed:
- in client.c/client_lookup:
changes the (x)log level for unresolvable entries in /etc/exports from L_ERROR to L_WARNING,
- in hostname.c/host_addrinfo:
changes the (x)log level for unresolvable entries in /etc/exports from D_GENERAL to D_PARSE,
- in export.c/export_read:
counts the number of exported volume entries and generates a (x)log L_ERROR if no volumes are exported.

Built and tested on a Fedora 20 (fully updated) system.

---

--=-=-=
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: inline; filename=nfs-utils-1.3.0-exportfs.patch

support/export/client.c renamed from support/export/client.c.orig +1 -1
@@ -277,7 +277,7 @@
 	if (htype == MCL_FQDN && !canonical) {
 		ai = host_addrinfo(hname);
 		if (!ai) {
-			xlog(L_ERROR, "Failed to resolve %s", hname);
+			xlog(L_WARNING, "Failed to resolve %s", hname);
 			goto out;
 		}
 		hname = ai->ai_canonname;
support/export/hostname.c renamed from support/export/hostname.c.orig +2 -2
@@ -175,11 +175,11 @@
 	case 0:
 		return ai;
 	case EAI_SYSTEM:
-		xlog(D_GENERAL, "%s: failed to resolve %s: (%d) %m",
+		xlog(D_PARSE, "%s: failed to resolve %s: (%d) %m",
 				__func__, hostname, errno);
 		break;
 	default:
-		xlog(D_GENERAL, "%s: failed to resolve %s: %s",
+		xlog(D_PARSE, "%s: failed to resolve %s: %s",
 				__func__, hostname, gai_strerror(error));
 		break;
 	}
support/export/export.c renamed from support/export/export.c.orig +0 -0
@@ -76,15 +76,22 @@
 	struct exportent	*eep;
 	nfs_export		*exp;
 
Quoted 14 lines

support/export/export.c line 88

Quoted 12 lines
support/export/export.c renamed from support/export/export.c.orig +7 -2
+        int volumes = 0;
+
 	setexportent(fname, "r");
 	while ((eep = getexportent(0,1)) != NULL) {
 		exp = export_lookup(eep->e_hostname, eep->e_path, 0);
-		if (!exp)
-			export_create(eep, 0);
+		if (!exp) {
+			exp = export_create(eep, 0);
+                        if (exp)
+                        	volumes++;
+                }

I think you should be indenting your code with tabs instead of spaces to be consistent with the rest of this file.

Thanks for point this out.... but I'll take care of it when do the commit...

Quoted 25 lines

Thanks,
Anna

Quoted 12 lines
support/export/export.c renamed from support/export/export.c.orig +2 -2
 		else
 			warn_duplicated_exports(exp, eep);
 	}
 	endexportent();
+        if (volumes == 0)
+        	xlog(L_ERROR, "no or all unresolvable export entries");
 }
 
 /**
 
--=-=-=--
--
Quoted 3 lines

To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

anna> I think you should be indenting your code with tabs anna> instead of spaces to be consistent with the rest of anna> this file.

I do, but xemacs spaces out :-)

-- Henrique

#4 lore raw
Quoted 5 lines · Henrique Martins

anna> I think you should be indenting your code with tabs anna> instead of spaces to be consistent with the rest of anna> this file.

I do, but xemacs spaces out :-)

There has to be a way to fix that...

steved.

#5 lore raw

anna> I think you should be indenting your code with tabs annd> instead of spaces to be consistent with the rest of anna> this file.

me> I do, but xemacs spaces out :-)

steve> There has to be a way to fix that...

Off course there is. After all, I did configure emacs to behave that way, long long ago, in pre-linux days.

I just have to remember to match what some particular project does, and conventions do vary...

-- Henrique

#6 lore raw
In reply to Henrique Martins
Quoted 33 lines · Henrique Martins

In-reply-to: <[email protected]>
References: <[email protected]>
<[email protected]> <[email protected]>
Comments: In-reply-to Steve Dickson <[email protected]>
message dated "Tue, 04 Nov 2014 12:57:25 -0500."
X-Mailer: MH-E 8.5; nmh 1.6; XEmacs 21.5 (beta34)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
--------
--=-=-=
Content-Type: text/plain; charset=utf-8

Attaching patch to nfs/exportfs to allow nfsd to start when there are some, but not all, unresolvable entries in /etc/exports.

Nfs currently fails to start in my laptop which has work machines listed in exports that aren't resolvable when I'm not in the office, and home machines in exports that aren't resolvable when I'm not home.

Files changed:
- in client.c/client_lookup:
changes the (x)log level for unresolvable entries in /etc/exports from L_ERROR to L_WARNING,
- in hostname.c/host_addrinfo:
changes the (x)log level for unresolvable entries in /etc/exports from D_GENERAL to D_PARSE,
- in export.c/export_read:
counts the number of exported volume entries and generates a (x)log L_ERROR if no volumes are exported.

Quoted 3 lines

Built and tested on a Fedora 20 (fully updated) system.

Committed!

steved.

Quoted 63 lines

---

--=-=-=
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: inline; filename=nfs-utils-1.3.0-exportfs.patch

support/export/client.c renamed from support/export/client.c.orig +1 -1
@@ -277,7 +277,7 @@
 	if (htype == MCL_FQDN && !canonical) {
 		ai = host_addrinfo(hname);
 		if (!ai) {
-			xlog(L_ERROR, "Failed to resolve %s", hname);
+			xlog(L_WARNING, "Failed to resolve %s", hname);
 			goto out;
 		}
 		hname = ai->ai_canonname;
support/export/hostname.c renamed from support/export/hostname.c.orig +2 -2
@@ -175,11 +175,11 @@
 	case 0:
 		return ai;
 	case EAI_SYSTEM:
-		xlog(D_GENERAL, "%s: failed to resolve %s: (%d) %m",
+		xlog(D_PARSE, "%s: failed to resolve %s: (%d) %m",
 				__func__, hostname, errno);
 		break;
 	default:
-		xlog(D_GENERAL, "%s: failed to resolve %s: %s",
+		xlog(D_PARSE, "%s: failed to resolve %s: %s",
 				__func__, hostname, gai_strerror(error));
 		break;
 	}
support/export/export.c renamed from support/export/export.c.orig +9 -3
@@ -76,15 +76,22 @@
 	struct exportent	*eep;
 	nfs_export		*exp;
 
+        int volumes = 0;
+
 	setexportent(fname, "r");
 	while ((eep = getexportent(0,1)) != NULL) {
 		exp = export_lookup(eep->e_hostname, eep->e_path, 0);
-		if (!exp)
-			export_create(eep, 0);
+		if (!exp) {
+			exp = export_create(eep, 0);
+                        if (exp)
+                        	volumes++;
+                }
 		else
 			warn_duplicated_exports(exp, eep);
 	}
 	endexportent();
+        if (volumes == 0)
+        	xlog(L_ERROR, "no or all unresolvable export entries");
 }
 
 /**
 
--=-=-=--