[Gluster-devel] GlusterFS API to manipulate open file descriptor - glfs_fcntl?

Niels de Vos ndevos at redhat.com
Tue Oct 15 10:36:20 UTC 2019

On Tue, Oct 15, 2019 at 12:20:54PM +0530, Anoop C S wrote:
> Hi all,
> This is to check and confirm whether we have an API(or an internal
> implementation which can be exposed as API) to perform operations on an
> open file descriptor as a wrapper around existing fcntl() system call.
> We do have specific APIs for locks(glfs_posix_lock) and file descriptor
> duplication(glfs_dup) which are important among those operations listed
> as per man fcntl(2).
> At present we have a requirement(very recent) from Samba to set file
> descriptor flags through its VFS layer which would need a corresponding
> mechanism inside GlusterFS. Due to its absence, VFS module for
> GlusterFS inside Samba will have to workaround with the hack of
> creating fake local file descriptors outside GlusterFS.
> Thoughts and suggestions are welcome.

The fcntl() operations are split when FUSE is used. There in direct
fcntl() call that FUSE passes on, instead it calls lock() and similar
interfaces. I think you refer to F_GETFD and F_SETFD commands for
fcntl(). For all I can see, these do not exist in FUSE, and have not
been added to gfapi either. Not sure if the single supported flag
FD_CLOEXEC can have a benefit on Gluster, as glfs_fini() is expected to
cleanup everything that gfapi allocates.

Can you explain your use-case a little more?

Also adding intergration at gluster.org so that other projects interested
in gfapi can follow and comment on the discussion.


More information about the Gluster-devel mailing list