Bug 13330 - VFS module for GlusterFS fails to compile with too few arguments
Summary: VFS module for GlusterFS fails to compile with too few arguments
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: VFS Modules (show other bugs)
Version: 4.8.0
Hardware: x64 Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Anoop C S
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-14 12:42 UTC by Anoop C S
Modified: 2019-11-08 11:33 UTC (History)
2 users (show)

See Also:


Attachments
test-patch (3.86 KB, patch)
2018-04-04 14:05 UTC, Anoop C S
no flags Details
final patch (2.93 KB, patch)
2019-01-23 10:44 UTC, Anoop C S
no flags Details
patch from master for v4.8, v4.9 and v4.10 (3.21 KB, patch)
2019-02-04 13:24 UTC, Guenther Deschner
jra: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anoop C S 2018-03-14 12:42:22 UTC
Following errors are seen when Samba's VFS module for GlusterFS is compiled against glusterfs api:

../source3/modules/vfs_glusterfs.c: In function ‘vfs_gluster_pread’:
../source3/modules/vfs_glusterfs.c:605:9: error: too few arguments to function ‘glfs_pread’
  return glfs_pread(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), data, n, offset, 0);
         ^~~~~~~~~~
In file included from ../source3/modules/vfs_glusterfs.c:41:0:
/usr/local/include/glusterfs/api/glfs.h:538:9: note: declared here
 ssize_t glfs_pread (glfs_fd_t *fd, void *buf, size_t count, off_t offset,
         ^~~~~~~~~~
../source3/modules/vfs_glusterfs.c: In function ‘vfs_gluster_pread_send’:
../source3/modules/vfs_glusterfs.c:814:31: warning: passing argument 6 of ‘glfs_pread_async’ from incompatible pointer type [-Wincompatible-pointer-types]
     fsp), data, n, offset, 0, aio_glusterfs_done,
                               ^~~~~~~~~~~~~~~~~~
In file included from ../source3/modules/vfs_glusterfs.c:41:0:
/usr/local/include/glusterfs/api/glfs.h:545:5: note: expected ‘glfs_io_cbk {aka void (*)(struct glfs_fd *, long int,  struct stat *, struct stat *, void *)}’ but argument is of type ‘void (*)(glfs_fd_t *, ssize_t,  void *) {aka void (*)(struct glfs_fd *, long int,  void *)}’
 int glfs_pread_async (glfs_fd_t *fd, void *buf, size_t count, off_t offset,
     ^~~~~~~~~~~~~~~~
../source3/modules/vfs_glusterfs.c: In function ‘vfs_gluster_pwrite_send’:
../source3/modules/vfs_glusterfs.c:850:31: warning: passing argument 6 of ‘glfs_pwrite_async’ from incompatible pointer type [-Wincompatible-pointer-types]
     fsp), data, n, offset, 0, aio_glusterfs_done,
                               ^~~~~~~~~~~~~~~~~~
In file included from ../source3/modules/vfs_glusterfs.c:41:0:
/usr/local/include/glusterfs/api/glfs.h:548:5: note: expected ‘glfs_io_cbk {aka void (*)(struct glfs_fd *, long int,  struct stat *, struct stat *, void *)}’ but argument is of type ‘void (*)(glfs_fd_t *, ssize_t,  void *) {aka void (*)(struct glfs_fd *, long int,  void *)}’
 int glfs_pwrite_async (glfs_fd_t *fd, const void *buf, int count, off_t offset,
     ^~~~~~~~~~~~~~~~~
../source3/modules/vfs_glusterfs.c: In function ‘vfs_gluster_pwrite’:
../source3/modules/vfs_glusterfs.c:900:9: error: too few arguments to function ‘glfs_pwrite’
  return glfs_pwrite(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), data, n, offset, 0);
         ^~~~~~~~~~~
In file included from ../source3/modules/vfs_glusterfs.c:41:0:
/usr/local/include/glusterfs/api/glfs.h:541:9: note: declared here
 ssize_t glfs_pwrite (glfs_fd_t *fd, const void *buf, size_t count,
         ^~~~~~~~~~~
../source3/modules/vfs_glusterfs.c: In function ‘vfs_gluster_fsync’:
../source3/modules/vfs_glusterfs.c:937:9: error: too few arguments to function ‘glfs_fsync’
  return glfs_fsync(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp));
         ^~~~~~~~~~
In file included from ../source3/modules/vfs_glusterfs.c:41:0:
/usr/local/include/glusterfs/api/glfs.h:590:5: note: declared here
 int glfs_fsync (glfs_fd_t *fd, struct stat *prestat,
     ^~~~~~~~~~
../source3/modules/vfs_glusterfs.c: In function ‘vfs_gluster_fsync_send’:
../source3/modules/vfs_glusterfs.c:964:11: warning: passing argument 2 of ‘glfs_fsync_async’ from incompatible pointer type [-Wincompatible-pointer-types]
     fsp), aio_glusterfs_done, state);
           ^~~~~~~~~~~~~~~~~~
In file included from ../source3/modules/vfs_glusterfs.c:41:0:
/usr/local/include/glusterfs/api/glfs.h:593:5: note: expected ‘glfs_io_cbk {aka void (*)(struct glfs_fd *, long int,  struct stat *, struct stat *, void *)}’ but argument is of type ‘void (*)(glfs_fd_t *, ssize_t,  void *) {aka void (*)(struct glfs_fd *, long int,  void *)}’
 int glfs_fsync_async (glfs_fd_t *fd, glfs_io_cbk fn, void *data) __THROW
     ^~~~~~~~~~~~~~~~
../source3/modules/vfs_glusterfs.c: In function ‘vfs_gluster_ftruncate’:
../source3/modules/vfs_glusterfs.c:1147:9: error: too few arguments to function ‘glfs_ftruncate’
  return glfs_ftruncate(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), offset);
         ^~~~~~~~~~~~~~
In file included from ../source3/modules/vfs_glusterfs.c:41:0:
/usr/local/include/glusterfs/api/glfs.h:576:5: note: declared here
 int glfs_ftruncate (glfs_fd_t *fd, off_t length, struct stat *prestat,
     ^~~~~~~~~~~~~~
Waf: Leaving directory `/root/samba.git/bin'
Build failed:  -> task failed (err #1): 
	{task: cc vfs_glusterfs.c -> vfs_glusterfs_89.o}
make: *** [Makefile:8: all] Error 1

source code HEAD
----------------
GlusterFS master @ a96c7e748fccfa796a712b6aac92206212915cdc
Samba master @ 7f625f9b27b229f74a88dfe6d86fadd060c47160

Additional note:
See below for recent commits from GlusterFS which changed signature for some APIs used in vfs_glusterfs:

http://git.gluster.org/cgit/glusterfs.git/commit/?id=d01f7244e9d9f7e3ef84e0ba7b48ef1b1b09d809

http://git.gluster.org/cgit/glusterfs.git/commit/?id=09943beb499617212f2985ca8ea9ecd1ed1b470e

http://git.gluster.org/cgit/glusterfs.git/commit/?id=248152767b0599986bbb6bb35fc27197f6be6964

http://git.gluster.org/cgit/glusterfs.git/commit/?id=384562b294e9a7847403961e878a4daa0fff33eb
Comment 1 Anoop C S 2018-04-04 14:02:29 UTC
(In reply to Anoop C S from comment #0)
The signature changes from GlusterFS API are incomplete as of now. Waiting for those changes to stabilize for the upcoming major version..

For the time being the attached patch works.
Comment 2 Anoop C S 2018-04-04 14:05:04 UTC
Created attachment 14102 [details]
test-patch
Comment 3 Guenther Deschner 2019-01-17 17:49:48 UTC
Anoop, is this change still relevant?
Comment 4 Anoop C S 2019-01-18 02:54:08 UTC
(In reply to Guenther Deschner from comment #3)
Yes it is. I hope this api change has been stabilized recently and will be available with glusterfs v6 onwards. I will confirm and update here.
Comment 5 Anoop C S 2019-01-22 15:05:57 UTC
(In reply to Anoop C S from comment #4)
I got a confirmation that API signatures are finalized with v6. I will shortly attach the final patch.
Comment 6 Anoop C S 2019-01-23 10:44:42 UTC
Created attachment 14792 [details]
final patch
Comment 7 Guenther Deschner 2019-02-04 13:24:28 UTC
Created attachment 14823 [details]
patch from master for v4.8, v4.9 and v4.10
Comment 8 Jeremy Allison 2019-02-05 07:19:32 UTC
Comment on attachment 14823 [details]
patch from master for v4.8, v4.9 and v4.10

LGTM.
Comment 9 Jeremy Allison 2019-02-05 07:20:18 UTC
Re-assigning to Karolin for inclusion in 4.10.rcNext, 4.9.next, 4.8.next.
Comment 10 Karolin Seeger 2019-02-05 14:24:05 UTC
(In reply to Jeremy Allison from comment #9)
Pushed to autobuild-v4-{10,9,8}-test.
Comment 11 Karolin Seeger 2019-02-08 09:28:16 UTC
(In reply to Karolin Seeger from comment #10)
Pushed to all branches.
Closing out bug report.

Thanks!
Comment 12 Ralph Böhme 2019-11-08 11:06:45 UTC
Anoop, in https://bugzilla.samba.org/show_bug.cgi?id=13330#c5 you state that the API changes were in version 6, but the patch that went into master and the release branches adds a check for version 7.6+.

Looking at the Gluster sources, the glfs functions in question (fsync, read ...) were indeed changed with version 6:

https://github.com/gluster/glusterfs/blob/release-6/api/src/glfs.h

Can you please clarify?
Comment 13 Ralph Böhme 2019-11-08 11:33:48 UTC
Ah, ok, I think I understand it now. configure.ac has a comment on the glfs API modversion string:

<https://github.com/gluster/glusterfs/blob/release-6/configure.ac#L1550>

It seems glfs API modversion != symbol version mapfile, which is what initially confused me as fsync was at version6 in the map file:

https://github.com/gluster/glusterfs/blob/master/api/src/gfapi.map

Sorry for the noise! :)