Implementing SMB_VFS_FCNTL in Samba

Anoop C S anoopcs at cryptolab.net
Sun Sep 29 02:56:39 UTC 2019


On Thu, 2019-09-26 at 00:09 +0530, Anoop C S via samba-technical wrote:
> On Mon, 2019-09-23 at 08:31 -0700, Jeremy Allison via samba-technical
> wrote:
> > On Mon, Sep 23, 2019 at 02:51:24PM +0530, Anoop C S wrote:
> > > Hi all,
> > > 
> > > I am attaching a patch as an attempt to implement
> > > SMB_VFS_FCNTL(for
> > > a
> > > background see https://bugzilla.samba.org/show_bug.cgi?id=14060).
> > > But I
> > > have the following question.
> > > 
> > > int fcntl(int fd, int cmd, ... /* arg */ );
> > > 
> > > As per man page, fcntl(2) system call can accept a third optional
> > > argument. If present it can be of type int, struct flock *,
> > > struct
> > > f_owner_ex * or uint64_t *. Our current SMB_VFS_LOCK and
> > > SMB_VFS_GETLOCK takes care of "Advisory record locking" and "Open
> > > file
> > > description locks" commands which requires third argument of type
> > > struct flock *. Other important fact here to notice is that in
> > > most
> > > cases the required third argument type is int. The patch I have
> > > prepared right now assumes third argument type to be int. 
> > > 
> > > So should we rename the call to something else(keeping third
> > > argument
> > > as int) or change the implementation to consider optional third
> > > argument as variable?
> > 
> > I think we need a varargs argument here like the real fcntl
> > definition.
> 
> Please find the attached patch in the above suggested direction. For
> now it is compile tested only. I will respond back afterwards with
> some basic testing results.

An unexpected crash(during runtime) had to be resolved and Gitlab CI
pipeline revealed some missing changes. Attaching the patch set(near-
to-final) which successfully completed the following pipeline:

https://gitlab.com/samba-team/devel/samba/pipelines/85180275

Few recent fcntl() cmd flags needs to be conditionally checked inside
vfs_default which should be the only missing here. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-s3-VFS-Add-SMB_VFS_FCNTL.patch
Type: text/x-patch
Size: 14341 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20190929/70d8f8c7/0001-s3-VFS-Add-SMB_VFS_FCNTL.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-s3-VFS-Use-SMB_VFS_FCNTL-to-set-fd-flags-in-open_fil.patch
Type: text/x-patch
Size: 2702 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20190929/70d8f8c7/0002-s3-VFS-Use-SMB_VFS_FCNTL-to-set-fd-flags-in-open_fil.bin>


More information about the samba-technical mailing list