AIX GPFS patches for 3.4.0
William Jojo
w.jojo at hvcc.edu
Mon Jul 13 20:30:12 MDT 2009
These patches were originally by Miguel Sanders. They've been modified slightly and tested with up to 3.3.6 by Yannick Bergeron (yaberger). We believe these are ready to come back upstream. These coupled with gpfs.base, ctdb and tdb2 should also complete the support for clustered-samba on AIX.
These diffs for gpfs.c and vfs_gpfs.c are against 3.4.
<snip>
--- source3/modules/gpfs.c.orig 2009-07-10 10:29:15.000000000 -0400
+++ source3/modules/gpfs.c 2009-07-10 12:39:13.000000000 -0400
@@ -39,6 +39,16 @@
bool set_gpfs_sharemode(files_struct *fsp, uint32 access_mask,
uint32 share_access)
{
+#ifdef AIX
+ /*
+ gpfs_set_share call is not implemented in AIX.
+ It should be noted that the GPFS shared object shr.o in library libgpfs.a does contain an entrypoint though.
+ However, calling that function results in a core dump (illegal opcode). This will be fixed in a future GPFS release
+ in which the function will return ENOSYS instead of dumping core.
+ */
+ errno = ENOSYS;
+ return True;
+#else
unsigned int allow = GPFS_SHARE_NONE;
unsigned int deny = GPFS_DENY_NONE;
int result;
@@ -86,10 +96,18 @@
}
return (result == 0);
+#endif
}
int set_gpfs_lease(int fd, int leasetype)
{
+#ifdef AIX
+ /*
+ gpfs_set_lease call is not implemented in AIX.
+ */
+ errno = ENOSYS;
+ return -1;
+#else
int gpfs_type = GPFS_LEASE_NONE;
if (!gpfs_leases) {
@@ -115,6 +133,7 @@
*/
linux_set_lease_capability();
return gpfs_set_lease_fn(fd, gpfs_type);
+#endif
}
int smbd_gpfs_getacl(char *pathname, int flags, void *acl)
@@ -140,6 +159,16 @@
int smbd_gpfs_get_realfilename_path(char *pathname, char *filenamep,
int *buflen)
{
+#ifdef AIX
+ /*
+ gpfs_get_realfilename call is not implemented in AIX.
+ It should be noted that the GPFS shared object shr.o in library libgpfs.a does contain an entrypoint though.
+ However, calling that function results in a core dump (illegal opcode). This will be fixed in a future GPFS release
+ in which the function will return ENOSYS instead of dumping core.
+ */
+ errno = ENOSYS;
+ return -1;
+#else
if ((!gpfs_getrealfilename)
|| (gpfs_get_realfilename_path_fn == NULL)) {
errno = ENOSYS;
@@ -147,6 +176,7 @@
}
return gpfs_get_realfilename_path_fn(pathname, filenamep, buflen);
+#endif
}
static bool init_gpfs_function_lib(void *plibhandle_pointer,
@@ -160,10 +190,17 @@
DEBUG(10, ("trying to load name %s from %s\n",
fn_name, libname));
+#ifdef AIX
+ if (*libhandle_pointer == NULL) {
+ *libhandle_pointer = dlopen(libname, RTLD_LAZY|RTLD_MEMBER);
+ did_open_here = true;
+ }
+#else
if (*libhandle_pointer == NULL) {
*libhandle_pointer = dlopen(libname, RTLD_LAZY);
did_open_here = true;
}
+#endif
if (*libhandle_pointer == NULL) {
DEBUG(10, ("Could not open lib %s\n", libname));
return false;
@@ -186,8 +223,16 @@
static bool init_gpfs_function(void *fn_pointer, const char *fn_name)
{
static void *libgpfs_handle = NULL;
+#ifndef AIX
static void *libgpfs_gpl_handle = NULL;
+#endif
+#ifdef AIX
+ if (init_gpfs_function_lib(&libgpfs_handle, "libgpfs.a(shr.o)",
+ fn_pointer, fn_name)) {
+ return true;
+ }
+#else
if (init_gpfs_function_lib(&libgpfs_handle, "libgpfs.so",
fn_pointer, fn_name)) {
return true;
@@ -196,6 +241,7 @@
fn_pointer, fn_name)) {
return true;
}
+#endif
return false;
}
</snip>
<snip>
--- source3/modules/vfs_gpfs.c.orig 2009-07-10 10:29:11.000000000 -0400
+++ source3/modules/vfs_gpfs.c 2009-07-10 11:39:10.000000000 -0400
@@ -63,13 +63,16 @@
{
int ret;
+#ifndef AIX
START_PROFILE(syscall_linux_setlease);
if ( linux_set_lease_sighandler(fsp->fh->fd) == -1)
return -1;
+#endif
ret = set_gpfs_lease(fsp->fh->fd,leasetype);
+#ifndef AIX
if ( ret < 0 ) {
/* This must have come from GPFS not being available */
/* or some other error, hence call the default */
@@ -77,6 +80,7 @@
}
END_PROFILE(syscall_linux_setlease);
+#endif
return ret;
}
</snip>
Thanks to Miguel for the original work and to Yannick for testing.
Cheers,
Bill
More information about the samba-technical
mailing list