Skip to contentSkip to conversation

F20 nfs-utils exportfs patch

PATCH Henrique Martins 2 participants 4 messages Sep 5, 2014 – Nov 5, 2014

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

Attaching path to exportfs that:
- 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 system.

-- Henrique

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

Re-sending this patch, at Steve Dickson's request.

-- Henrique

--------------------------------------------------------------

Attaching path to exportfs that:
- 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 system.

--------------------------------------------------------------

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");
 }
 
 /**
#2 lore raw

Re-posting with the patch inlined with comments.

Quoted 2 lines · Henrique Martins

Re-sending this patch, at Steve Dickson's request.

Thanks... but... :-)

There is no Signed-off-by: line as described in
https://www.kernel.org/doc/Documentation/SubmittingPatches

and there is no description section as the above document describes

Also, please in-line the patch in the email instead of attaching them... I just makes is easier to review.

Quoted 16 lines

-- Henrique

--------------------------------------------------------------

Attaching path to exportfs that:
- 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 4 lines

Built and tested on a Fedora 20 system.

--------------------------------------------------------------

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;
 	}

Just curious as to why these changes... What does D_PARSE do that D_GENERAL does not?

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");
 }
 
 /**

When testing the patch, I notice two "Failed to resolve" warning messages are logged for each export... Its not because of this patch but I wounder how that could be cleaned up a bit....

So please re-post with in correct patch format and we will be good to go!

steved.

#3 lore raw

Missed these comments in the middle of the patch ...

Quoted 2 lines

Just curious as to why these changes... What does D_PARSE do that D_GENERAL does not?

D_PARSE, and L_WARNING, don't cause xlog to return an error, D_GENERAL and L_ERROR do. An error from xlog which will cause nfsd to error out and not start.

I changed L_ERROR with L_WARNING, but there was no D_WARNING def or similar so I went with D_PARSE instead of adding that one.

Quoted 3 lines

When testing the patch, I notice two "Failed to resolve" warning messages are logged for each export... Its not because of this patch but I wounder how that could be cleaned up a bit....

Hopefully you solved that, otherwise I would have to hunt on which machine I generated those patches, if I didn't wipe out the rpmbuild environment yet..

-- Henrique