s3:smbd/oplock: pass smbd_server_connection to onefs_init_kernel_oplocks()
[kai/samba.git] / source3 / smbd / oplock.c
index 067681e0f94ae86f698a67f6c37d6ead13bbb318..a414b72d3134fed4ed6aa44cad32f1b47ca7bd1b 100644 (file)
@@ -729,7 +729,13 @@ static void process_open_retry_message(struct messaging_context *msg_ctx,
                                       DATA_BLOB *data)
 {
        struct share_mode_entry msg;
-       struct smbd_server_connection *sconn;
+       struct smbd_server_connection *sconn =
+               talloc_get_type(private_data,
+               struct smbd_server_connection);
+
+       if (sconn == NULL) {
+               return;
+       }
 
        if (data->data == NULL) {
                DEBUG(0, ("Got NULL buffer\n"));
@@ -748,10 +754,7 @@ static void process_open_retry_message(struct messaging_context *msg_ctx,
                   server_id_str(talloc_tos(), &src), file_id_string_tos(&msg.id),
                   (unsigned long long)msg.op_mid));
 
-       sconn = msg_ctx_to_sconn(msg_ctx);
-       if (sconn != NULL) {
-               schedule_deferred_open_message_smb(sconn, msg.op_mid);
-       }
+       schedule_deferred_open_message_smb(sconn, msg.op_mid);
 }
 
 /****************************************************************************
@@ -945,17 +948,17 @@ bool init_oplocks(struct smbd_server_connection *sconn)
                           process_oplock_break_response);
        messaging_register(sconn->msg_ctx, sconn, MSG_SMB_KERNEL_BREAK,
                           process_kernel_oplock_break);
-       messaging_register(sconn->msg_ctx, NULL, MSG_SMB_OPEN_RETRY,
+       messaging_register(sconn->msg_ctx, sconn, MSG_SMB_OPEN_RETRY,
                           process_open_retry_message);
 
        if (lp_kernel_oplocks()) {
 #if HAVE_KERNEL_OPLOCKS_IRIX
-               koplocks = irix_init_kernel_oplocks(NULL);
+               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);
+               koplocks = onefs_init_kernel_oplocks(sconn);
 #endif
        }