vfs_getlock vs. vfs_lock(F_GETLK)

Jeremy Allison jra at samba.org
Thu Apr 5 19:29:13 GMT 2007


On Thu, Apr 05, 2007 at 12:26:41PM -0700, James Peach wrote:
> On Apr 5, 2007, at 10:13 AM, Jeremy Allison wrote:
> 
> >On Thu, Apr 05, 2007 at 10:11:37AM -0700, James Peach wrote:
> >>Hi Jeremy,
> >>
> >>Since there are separate SMB_VFS_LOCK and SMB_VFS_GETLOCK calls, is  
> >>it
> >>safe to assert that F_GETLK is an invalid type for the SMB_VFS_LOCK
> >>call?
> >
> >Hmmmm. Yeah, I think so. Need to look at the code to be
> >sure though...
> 
> Any problems with this patch (for SAMBA_3_0 only)?
> 
> Index: SAMBA_3_0/source/modules/vfs_default.c
> ===================================================================
> --- SAMBA_3_0/source/modules/vfs_default.c	(revision 22079)
> +++ SAMBA_3_0/source/modules/vfs_default.c	(working copy)
> @@ -781,6 +781,9 @@
>  {
>  	BOOL result;
> 
> +	/* SMB_VFS_GETLOCK should be used to query lock status. */
> +	SMB_ASSERT(op != SMB_F_GETLK);
> +
>  	START_PROFILE(syscall_fcntl_lock);
>  	result =  fcntl_lock(fd, op, offset, count, type);
>  	END_PROFILE(syscall_fcntl_lock);

No - that's fine (I checked the code).

Jeremy.


More information about the samba-technical mailing list