summaryrefslogtreecommitdiffstats
path: root/source/smbd/oplock_linux.c
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-01-05 11:35:29 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:06:01 -0500
commit2253b17a1a88555291b59d52c826c81c2b8f7e7f (patch)
treef06be530d10a18f9653bf26df9fab80d68898422 /source/smbd/oplock_linux.c
parentf78c7f8abea4cb598eca78fa3beacee8a3caee20 (diff)
downloadsamba-2253b17a1a88555291b59d52c826c81c2b8f7e7f.tar.gz
samba-2253b17a1a88555291b59d52c826c81c2b8f7e7f.tar.xz
samba-2253b17a1a88555291b59d52c826c81c2b8f7e7f.zip
r12721: GPFS 2.4 on Linux will contain some windows semantics, ie share modes and
oplocks across the cluster. Adapt Samba to it. The gpfs API is called via libgpfs.so. This code is written with dlopen(), so that you can compile on a system with gpfs installed and later on run on systems without gpfs available. So to actually make Samba call gpfs share mode calls you need to compile with gpfs.h and libgpfs.so around and set 'gpfs share = yes' on the shares you export from GPFS. Volker
Diffstat (limited to 'source/smbd/oplock_linux.c')
-rw-r--r--source/smbd/oplock_linux.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/source/smbd/oplock_linux.c b/source/smbd/oplock_linux.c
index ab0c08f7fcc..0285bfce97a 100644
--- a/source/smbd/oplock_linux.c
+++ b/source/smbd/oplock_linux.c
@@ -101,11 +101,11 @@ static void set_capability(unsigned capability)
}
/****************************************************************************
- Call SETLEASE. If we get EACCES then we try setting up the right capability and
- try again
+ Call SETLEASE. If we get EACCES then we try setting up the right capability
+ and try again
****************************************************************************/
-static int linux_setlease(int fd, int leasetype)
+static int linux_setlease(int snum, int fd, int leasetype)
{
int ret;
@@ -114,7 +114,17 @@ static int linux_setlease(int fd, int leasetype)
return -1;
}
- ret = fcntl(fd, F_SETLEASE, leasetype);
+ if (lp_gpfs_share(snum)) {
+ ret = set_gpfs_lease(fd, leasetype);
+ } else {
+ ret = fcntl(fd, F_SETLEASE, leasetype);
+ }
+
+ if ((ret < 0) && (errno == ENOSYS)) {
+ /* This must have come from GPFS not being available */
+ ret = fcntl(fd, F_SETLEASE, leasetype);
+ }
+
if (ret == -1 && errno == EACCES) {
set_capability(CAP_LEASE);
ret = fcntl(fd, F_SETLEASE, leasetype);
@@ -154,7 +164,7 @@ static files_struct *linux_oplock_receive_message(fd_set *fds)
static BOOL linux_set_kernel_oplock(files_struct *fsp, int oplock_type)
{
- if (linux_setlease(fsp->fh->fd, F_WRLCK) == -1) {
+ if (linux_setlease(SNUM(fsp->conn), fsp->fh->fd, F_WRLCK) == -1) {
DEBUG(3,("linux_set_kernel_oplock: Refused oplock on file %s, fd = %d, dev = %x, \
inode = %.0f. (%s)\n",
fsp->fsp_name, fsp->fh->fd,
@@ -188,7 +198,7 @@ oplock state of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev,
/*
* Remove the kernel oplock on this file.
*/
- if (linux_setlease(fsp->fh->fd, F_UNLCK) == -1) {
+ if (linux_setlease(SNUM(fsp->conn), fsp->fh->fd, F_UNLCK) == -1) {
if (DEBUGLVL(0)) {
dbgtext("linux_release_kernel_oplock: Error when removing kernel oplock on file " );
dbgtext("%s, dev = %x, inode = %.0f, file_id = %lu. Error was %s\n",