Fix the overwriting of errno before use in a DEBUG statement and use the return value...
[samba.git] / source3 / smbd / oplock_onefs.c
index d7e36087350b740794b763653e9dbd02490dad21..615747e92cb5c640b34ce556c58205c4a27f6644 100644 (file)
@@ -47,6 +47,7 @@ enum onefs_callback_state {
 
 struct onefs_callback_record {
        struct onefs_callback_record *prev, *next;
+       struct smbd_server_connection *sconn;
        uint64_t id;
        enum onefs_callback_state state;
        union {
@@ -198,7 +199,8 @@ void destroy_onefs_callback_record(uint64_t id)
  *   2. OPEN_FILE: Once ifs_createfile completes, the callback record is
  *   transitioned to this state via onefs_set_oplock_callback.
  */
-uint64_t onefs_oplock_wait_record(uint64_t mid)
+uint64_t onefs_oplock_wait_record(struct smbd_server_connection *sconn,
+                                 uint64_t mid)
 {
        struct onefs_callback_record *result;
        static uint64_t id_generator = 0;
@@ -216,6 +218,7 @@ uint64_t onefs_oplock_wait_record(uint64_t mid)
                id_generator += 1;
        }
 
+       result->sconn = sconn;
        result->id = id_generator;
 
        result->state = ONEFS_WAITING_FOR_OPLOCK;
@@ -306,7 +309,7 @@ static void oplock_break_to_none_handler(uint64_t id)
 
        init_share_mode_entry(&sme, cb, FORCE_OPLOCK_BREAK_TO_NONE);
        share_mode_entry_to_message(msg, &sme);
-       messaging_send_buf(smbd_messaging_context(),
+       messaging_send_buf(cb->sconn->msg_ctx,
                           sme.pid,
                           MSG_SMB_ASYNC_LEVEL2_BREAK,
                           (uint8_t *)msg,
@@ -343,7 +346,7 @@ static void oplock_break_to_level_two_handler(uint64_t id)
 
        init_share_mode_entry(&sme, cb, LEVEL_II_OPLOCK);
        share_mode_entry_to_message(msg, &sme);
-       messaging_send_buf(smbd_messaging_context(),
+       messaging_send_buf(cb->sconn->msg_ctx,
                          sme.pid,
                          MSG_SMB_BREAK_REQUEST,
                          (uint8_t *)msg,