comment doesn't match code

Herb Lewis hlewis at panasas.com
Fri May 25 19:31:30 GMT 2007


Didn't look at the implementation :-)

So that also makes the

if(ret_flock == -1 ){

code that will never get executed.
Might be better to just leave the comment here and just

(void)SMB_VFS_KERNEL_FLOCK(fsp, fsp->fh->fd, share_access);

and remove the error check code

Jeremy Allison wrote:
> On Mon, May 21, 2007 at 10:42:01AM -0700, Herb Lewis wrote:
> 
>>in smbd/open.c in the function open_file_ntcreate we have the
>>following comment and code which contradict.
>>
>>        /* note that we ignore failure for the following. It is
>>           basically a hack for NFS, and NFS will never set one of
>>           these only read them. Nobody but Samba can ever set a deny
>>           mode and we have already checked our more authoritative
>>           locking database for permission to set this deny mode. If
>>           the kernel refuses the operations then the kernel is wrong.
>>           note that GPFS supports it as well - jmcd */
>>
>>        ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, fsp->fh->fd, share_access);
>>        if(ret_flock == -1 ){
>>
>>                TALLOC_FREE(lck);
>>                fd_close(conn, fsp);
>>                file_free(fsp);
>>
>>                return NT_STATUS_SHARING_VIOLATION;
>>        }
> 
> 
> But if you look at the implementation it goes...
> 
> static int vfswrap_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, int fd,
>                                 uint32 share_mode)
> {
>         START_PROFILE(syscall_kernel_flock);
>         kernel_flock(fd, share_mode);
>         END_PROFILE(syscall_kernel_flock);
>         return 0;
> }
> 
> always returns ok :-). Confusing comment - needs to be moved
> to modules/vfs_default.c I think.


More information about the samba-technical mailing list