mirror of
https://github.com/samba-team/samba.git
synced 2025-03-20 22:50:26 +03:00
s3: smbd: Update file times right before closing the underlying fd
Next commits will update file_ntimes() to use handle-based SMB_VFS_FNTIMES(). Move the update_write_time_on_close() call immediately before closing the fd. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
ed287c35d7
commit
bccbc5bb1e
@ -807,6 +807,20 @@ static NTSTATUS close_normal_file(struct smb_request *req, files_struct *fsp,
|
||||
|
||||
locking_close_file(fsp, close_type);
|
||||
|
||||
/*
|
||||
* Ensure pending modtime is set before closing underlying fd.
|
||||
*/
|
||||
|
||||
tmp = update_write_time_on_close(fsp);
|
||||
if (NT_STATUS_EQUAL(tmp, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
|
||||
/*
|
||||
* Someone renamed the file or a parent directory containing
|
||||
* this file. We can't do anything about this, eat the error.
|
||||
*/
|
||||
tmp = NT_STATUS_OK;
|
||||
}
|
||||
status = ntstatus_keeperror(status, tmp);
|
||||
|
||||
tmp = fd_close(fsp);
|
||||
status = ntstatus_keeperror(status, tmp);
|
||||
|
||||
@ -816,21 +830,6 @@ static NTSTATUS close_normal_file(struct smb_request *req, files_struct *fsp,
|
||||
status = ntstatus_keeperror(status, tmp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Ensure pending modtime is set after close.
|
||||
*/
|
||||
|
||||
tmp = update_write_time_on_close(fsp);
|
||||
if (NT_STATUS_EQUAL(tmp, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
|
||||
/* Someone renamed the file or a parent directory containing
|
||||
* this file. We can't do anything about this, we don't have
|
||||
* an "update timestamp by fd" call in POSIX. Eat the error. */
|
||||
|
||||
tmp = NT_STATUS_OK;
|
||||
}
|
||||
|
||||
status = ntstatus_keeperror(status, tmp);
|
||||
|
||||
DEBUG(2,("%s closed file %s (numopen=%d) %s\n",
|
||||
conn->session_info->unix_info->unix_name, fsp_str_dbg(fsp),
|
||||
conn->num_files_open - 1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user