diff options
Diffstat (limited to 'source3/smbd/open.c')
-rw-r--r-- | source3/smbd/open.c | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 4e91cdfd2a..1899a6fce7 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -783,28 +783,6 @@ static void defer_open(struct share_mode_lock *lck, srv_defer_sign_response(mid); } -/**************************************************************************** - Set a kernel flock on a file for NFS interoperability. - This requires a patch to Linux. -****************************************************************************/ - -static void kernel_flock(files_struct *fsp, uint32 share_mode) -{ -#if HAVE_KERNEL_SHARE_MODES - int kernel_mode = 0; - if (share_mode == FILE_SHARE_WRITE) { - kernel_mode = LOCK_MAND|LOCK_WRITE; - } else if (share_mode == FILE_SHARE_READ) { - kernel_mode = LOCK_MAND|LOCK_READ; - } else if (share_mode == FILE_SHARE_NONE) { - kernel_mode = LOCK_MAND; - } - if (kernel_mode) { - flock(fsp->fh->fd, kernel_mode); - } -#endif - ; -} /**************************************************************************** On overwrite open ensure that the attributes match. @@ -1126,6 +1104,8 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, struct share_mode_lock *lck = NULL; uint32 open_access_mask = access_mask; NTSTATUS status; + int ret_flock; + if (conn->printer) { /* @@ -1644,9 +1624,18 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, 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 */ + 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 ){ - kernel_flock(fsp, share_access); + talloc_free(lck); + fd_close(conn, fsp); + file_free(fsp); + + return NT_STATUS_SHARING_VIOLATION; + } /* * At this point onwards, we can guarentee that the share entry |