]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Get "req->request_time" early in create_file_default()
authorVolker Lendecke <vl@samba.org>
Fri, 2 Aug 2019 09:54:11 +0000 (11:54 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 7 Aug 2019 23:45:50 +0000 (23:45 +0000)
This is necessary for the following case:

We want to delete a file with an open stream that is not open with
FILE_SHARE_DELETE. In SMB1, we need to defer the sharing violation
reply (we don't do that right now, test to follow). However, when we
move that sharing violation delay to where it belongs, into the outer
layers, only very deep in the nested open_streams_for_delete smb1
sharing violation delay handling call we will hit the sharing
violation in the 1-second retry case. However, that
open_streams_for_delete itself is INTERNAL_OPEN_ONLY and thus not
deferred itself. This means that it will not overwrite
req->request_time at all.

Exec summary: We only have one request_time now, set it properly as
early as possible.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/open.c

index f477a4fed09d07f1336b760973f7a32d337f8989..b8b7ed025cca9948f4cb14269b3a04e81cc58863 100644 (file)
@@ -3030,15 +3030,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
 
        if (req) {
                struct deferred_open_record *open_rec;
-               struct timeval request_time;
-               if (get_deferred_open_message_state(req,
-                               &request_time,
-                               &open_rec)) {
-                       /* Remember the absolute time of the original
-                          request with this mid. We'll use it later to
-                          see if this has timed out. */
-
-                       req->request_time = request_time;
+               if (get_deferred_open_message_state(req, NULL, &open_rec)) {
 
                        /* If it was an async create retry, the file
                           didn't exist. */
@@ -5552,6 +5544,15 @@ NTSTATUS create_file_default(connection_struct *conn,
                  (unsigned int)root_dir_fid,
                  ea_list, sd, smb_fname_str_dbg(smb_fname));
 
+       if (req != NULL) {
+               /*
+                * Remember the absolute time of the original request
+                * with this mid. We'll use it later to see if this
+                * has timed out.
+                */
+               get_deferred_open_message_state(req, &req->request_time, NULL);
+       }
+
        /*
         * Calculate the filename from the root_dir_if if necessary.
         */