diff options
author | Jim McDonough <jmcd@samba.org> | 2006-11-09 20:29:31 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:15:43 -0500 |
commit | 4fe70bcee2ec8515f123d8c826631b54bbf793e7 (patch) | |
tree | 0fb5daec6104c03c3cd9f9d5521506564d2af6cd /source3/smbd | |
parent | e513fb27d61d31cdc1a0e723c5345a659cc2caf2 (diff) | |
download | samba-4fe70bcee2ec8515f123d8c826631b54bbf793e7.tar.gz samba-4fe70bcee2ec8515f123d8c826631b54bbf793e7.tar.bz2 samba-4fe70bcee2ec8515f123d8c826631b54bbf793e7.zip |
r19647: Add some GPFS support in a vfs mod. Also adds the kernel flock op to
the vfs layer, since gpfs supports it. Thanks to Volker, Christian,
Mathias, Chetan, and Peter.
(This used to be commit 0620658890fa9c68a9848538728023192319c81a)
Diffstat (limited to 'source3/smbd')
-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 |