From: Volker Lendecke Date: Fri, 2 Aug 2019 09:54:11 +0000 (+0200) Subject: smbd: Get "req->request_time" early in create_file_default() X-Git-Tag: tdb-1.4.2~246 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=305ea37c81c2eeafb0ae259d4bd319af183a4611;p=thirdparty%2Fsamba.git smbd: Get "req->request_time" early in create_file_default() 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 Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index f477a4fed09..b8b7ed025cc 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -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. */