[Gluster-devel] [PATCH] NetBSD patches, second round

Emmanuel Dreyfus manu at netbsd.org
Tue Jul 5 09:12:26 UTC 2011


Hello

Thank you everyone for integrating my patches for NetBSD support. 
Attached is a second round of patches.

* af.patch
Makes sure glusterfsd listen on the same address family as glusterd does. 

* netbsd-buildfix.patch 
Adds an #include to fix the build (missing sigemptyset/sigaddset)

* netbsd-extattr.patch
Make sure .attribute extended attribute backing store for NetBSD's UFS1 
filesystem  is not distributed in glusterfs volume (that hurts!)

* o_directory.patch 
On some systems, O_DIRECTORY is unused and we #define it as 0, hence 
((flags & O_DIRECTORY) == O_DIRECTORY) always evaluate to true. Use 
(flags & O_DIRECTORY) instead.

Every diff is against todays' git. 

-- 
Emmanuel Dreyfus
manu at netbsd.org
-------------- next part --------------
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index c06b193..b371274 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -91,6 +91,50 @@ glusterd_unset_lock_owner (uuid_t owner)
         return 0;
 }
 
+static const char *
+glusterd_listener_family_name(void)
+{
+	xlator_t	 	*this = NULL;
+	glusterd_conf_t		*conf = NULL;
+	rpcsvc_listener_t	*listener = NULL;
+	struct sockaddr_storage ss;
+
+	this = THIS;
+	GF_ASSERT (this);
+	conf = this->private;
+	GF_ASSERT (conf);   
+	GF_ASSERT (conf->rpc);
+	
+	list_for_each_entry (listener, &conf->rpc->listeners, list)
+		break; /* grab first one */
+
+	GF_ASSERT (listener->trans);
+
+	if (rpc_transport_get_myaddr(listener->trans, NULL, 0, 
+				     &ss, sizeof(ss)) != 0) {
+		gf_log ("glusterd", GF_LOG_ERROR,
+			"rpc_transport_get_myname failed: %s",
+			strerror(errno));
+		return NULL;
+	}
+
+	switch (ss.ss_family) {
+		case AF_INET:
+			return "inet";
+			break;
+		case AF_INET6:
+			return "inet6";
+			break;
+		default:
+			gf_log ("glusterd", GF_LOG_ERROR,
+				"unknown address family %d",
+				ss.ss_family);
+			break;
+	}
+	       
+	return NULL;
+}
+
 gf_boolean_t
 glusterd_is_loopback_localhost (const struct sockaddr *sa, char *hostname)
 {
@@ -1032,6 +1076,7 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t  *volinfo,
         FILE                    *file = NULL;
         gf_boolean_t            is_locked = _gf_false;
         char                    socketpath[PATH_MAX] = {0};
+	const char		*family_name;
 
         GF_ASSERT (volinfo);
         GF_ASSERT (brickinfo);
@@ -1135,6 +1180,14 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t  *volinfo,
         runner_argprintf (&runner, "%s-server.listen-port=%d",
                           volinfo->volname, port);
 
+	if ((family_name = glusterd_listener_family_name()) != NULL) {
+		runner_add_arg (&runner, "--xlator-option");
+		runner_argprintf (&runner,
+				  "%s-server.transport.address-family=%s",
+			  	  volinfo->volname, family_name);
+	}
+
+
         runner_log (&runner, "", GF_LOG_DEBUG, "Starting GlusterFS");
         ret = runner_run (&runner);
 
-------------- next part --------------
diff --git a/libglusterfs/src/run.c b/libglusterfs/src/run.c
index 4160120..fceb7c7 100644
--- a/libglusterfs/src/run.c
+++ b/libglusterfs/src/run.c
@@ -30,6 +30,7 @@
 #include <fcntl.h>
 #include <dirent.h>
 #include <assert.h>
+#include <signal.h>
 #include <sys/wait.h>
 
 #ifdef RUN_STANDALONE
-------------- next part --------------
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 95926bb..7ad2c11 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -4116,6 +4116,19 @@ posix_do_readdir (call_frame_t *frame, xlator_t *this,
                 if ((!strcmp(real_path, base_path))
                     && (!strcmp(entry->d_name, GF_REPLICATE_TRASH_DIR)))
                         continue;
+#ifdef __NetBSD__
+		/*
+		 * NetBSD with UFS1 backend uses backing files for
+		 * extended attributes. They can be found in a
+		 * .attribute file located at the root of the filesystem
+		 * We hide it to glusterfs clients, since chaos will occur 
+		 * when the cluster/dht xlator decides to distribute
+		 * exended attribute backing file accross storage servers.
+		 */ 
+                if ((!strcmp(real_path, base_path))
+                    && (!strcmp(entry->d_name, ".attribute")))
+                        continue;
+#endif /* __NetBSD__ */
 
                 if ((!strcmp (real_path, base_path))
                     && (!strncmp (GF_HIDDEN_PATH, entry->d_name,
-------------- next part --------------
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c
index d19fa2c..da87a60 100644
--- a/xlators/performance/quick-read/src/quick-read.c
+++ b/xlators/performance/quick-read/src/quick-read.c
@@ -729,7 +729,7 @@ qr_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
         }
         UNLOCK (&table->lock);
 
-        if (content_cached && ((flags & O_DIRECTORY) == O_DIRECTORY)) {
+        if (content_cached && (flags & O_DIRECTORY)) {
                 op_ret = -1;
                 op_errno = ENOTDIR;
                 gf_log (this->name, GF_LOG_WARNING,


More information about the Gluster-devel mailing list