s3:smbd/oplock: pass smbd_server_connection to linux_init_kernel_oplocks()
authorStefan Metzmacher <metze@samba.org>
Tue, 13 Dec 2011 12:38:41 +0000 (13:38 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 13 Dec 2011 19:31:09 +0000 (20:31 +0100)
metze

source3/smbd/oplock.c
source3/smbd/oplock_linux.c
source3/smbd/proto.h

index 7ae222c6acdecc6339ebf5ea1720aeb12a0983ee..fd02fbf60ae9c358706886732110c156abf1251a 100644 (file)
@@ -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);
index a455707deea842320e48f82e55c217e1b6fab737..f796e8c9b817be15d9dea98f20a0d29ea2b4bef1 100644 (file)
@@ -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,
index f36cd505fce540d8cbe21a14444a8dea7ac9f2a8..22eeae988ee285c1af1cd5a19b057fd7bf0fef15 100644 (file)
@@ -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  */