1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-09 08:58:35 +03:00

s3:smbd/oplock: pass smbd_server_connection to linux_init_kernel_oplocks()

metze
This commit is contained in:
Stefan Metzmacher 2011-12-13 13:38:41 +01:00
parent 47e21bcc43
commit 641a2dea81
3 changed files with 14 additions and 7 deletions

View 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);

View 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,

View 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 */