summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-12-13 13:38:41 +0100
committerStefan Metzmacher <metze@samba.org>2011-12-13 20:31:09 +0100
commit641a2dea812faf628146145e3d04e411e7d19485 (patch)
tree5aa86eb216b047694f4fff3f61a189eb01eb4f6a
parent47e21bcc43a362696c775bf5467e3bf711a99c77 (diff)
downloadsamba-641a2dea812faf628146145e3d04e411e7d19485.tar.gz
samba-641a2dea812faf628146145e3d04e411e7d19485.tar.bz2
samba-641a2dea812faf628146145e3d04e411e7d19485.zip
s3:smbd/oplock: pass smbd_server_connection to linux_init_kernel_oplocks()
metze
-rw-r--r--source3/smbd/oplock.c2
-rw-r--r--source3/smbd/oplock_linux.c17
-rw-r--r--source3/smbd/proto.h2
3 files changed, 14 insertions, 7 deletions
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 7ae222c6ac..fd02fbf60a 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -955,7 +955,7 @@ bool init_oplocks(struct smbd_server_connection *sconn)
#if HAVE_KERNEL_OPLOCKS_IRIX
koplocks = irix_init_kernel_oplocks(sconn);
#elif HAVE_KERNEL_OPLOCKS_LINUX
- koplocks = linux_init_kernel_oplocks(NULL);
+ koplocks = linux_init_kernel_oplocks(sconn);
#elif HAVE_ONEFS
#error Isilon, please check if the NULL context is okay here. Thanks!
koplocks = onefs_init_kernel_oplocks(NULL);
diff --git a/source3/smbd/oplock_linux.c b/source3/smbd/oplock_linux.c
index a455707dee..f796e8c9b8 100644
--- a/source3/smbd/oplock_linux.c
+++ b/source3/smbd/oplock_linux.c
@@ -95,16 +95,22 @@ static void linux_oplock_signal_handler(struct tevent_context *ev_ctx,
int signum, int count,
void *_info, void *private_data)
{
+ struct kernel_oplocks *ctx =
+ talloc_get_type_abort(private_data,
+ struct kernel_oplocks);
+ struct smbd_server_connection *sconn =
+ talloc_get_type_abort(ctx->private_data,
+ struct smbd_server_connection);
siginfo_t *info = (siginfo_t *)_info;
int fd = info->si_fd;
files_struct *fsp;
- fsp = file_find_fd(smbd_server_conn, fd);
+ fsp = file_find_fd(sconn, fd);
if (fsp == NULL) {
DEBUG(0,("linux_oplock_signal_handler: failed to find fsp for file fd=%d (file was closed ?)\n", fd ));
return;
}
- break_kernel_oplock(fsp->conn->sconn->msg_ctx, fsp);
+ break_kernel_oplock(sconn->msg_ctx, fsp);
}
/****************************************************************************
@@ -192,7 +198,7 @@ static const struct kernel_oplocks_ops linux_koplocks = {
.contend_level2_oplocks_end = NULL,
};
-struct kernel_oplocks *linux_init_kernel_oplocks(TALLOC_CTX *mem_ctx)
+struct kernel_oplocks *linux_init_kernel_oplocks(struct smbd_server_connection *sconn)
{
struct kernel_oplocks *ctx;
struct tevent_signal *se;
@@ -202,15 +208,16 @@ struct kernel_oplocks *linux_init_kernel_oplocks(TALLOC_CTX *mem_ctx)
return NULL;
}
- ctx = talloc_zero(mem_ctx, struct kernel_oplocks);
+ ctx = talloc_zero(sconn, struct kernel_oplocks);
if (!ctx) {
DEBUG(0,("Linux Kernel oplocks talloc_Zero failed\n"));
return NULL;
}
ctx->ops = &linux_koplocks;
+ ctx->private_data = sconn;
- se = tevent_add_signal(server_event_context(),
+ se = tevent_add_signal(sconn->ev_ctx,
ctx,
RT_SIGNAL_LEASE, SA_SIGINFO,
linux_oplock_signal_handler,
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index f36cd505fc..22eeae988e 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -680,7 +680,7 @@ struct kernel_oplocks *irix_init_kernel_oplocks(struct smbd_server_connection *s
void linux_set_lease_capability(void);
int linux_set_lease_sighandler(int fd);
int linux_setlease(int fd, int leasetype);
-struct kernel_oplocks *linux_init_kernel_oplocks(TALLOC_CTX *mem_ctx) ;
+struct kernel_oplocks *linux_init_kernel_oplocks(struct smbd_server_connection *sconn);
/* The following definitions come from smbd/oplock_onefs.c */