mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
smbd: Introduce close_file_smb()
This does almost everything that close_file_free() does, but it leaves
the fsp around.
A normal close_file() now calls fsp_unbind_smb() twice. Functionally
this is not a problem, fsp_unbind_smb() is idempotent. The only
potential performance penalty might come from the loops in
remove_smb2_chained_fsp(), but those only are potentially large with
deeply queued smb2 requests. If that turns out to be a problem, we'll
cope with it later. The alternative would be to split up file_free()
into even more routines and make it more difficult to figure out which
of the "rundown/unbind/free" routines to call in any particular
situation.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14975
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit e91b59c4df
)
This commit is contained in:
parent
521178327e
commit
d44c45cbdb
@ -1475,15 +1475,14 @@ static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp,
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Close a files_struct.
|
||||
Rundown all SMB-related dependencies of a files struct
|
||||
****************************************************************************/
|
||||
|
||||
NTSTATUS close_file_free(struct smb_request *req,
|
||||
struct files_struct **_fsp,
|
||||
enum file_close_type close_type)
|
||||
NTSTATUS close_file_smb(struct smb_request *req,
|
||||
struct files_struct *fsp,
|
||||
enum file_close_type close_type)
|
||||
{
|
||||
NTSTATUS status;
|
||||
struct files_struct *fsp = *_fsp;
|
||||
|
||||
/*
|
||||
* This fsp can never be an internal dirfsp. They must
|
||||
@ -1541,9 +1540,22 @@ NTSTATUS close_file_free(struct smb_request *req,
|
||||
close_file_free(req, &fsp->base_fsp, close_type);
|
||||
}
|
||||
|
||||
file_free(req, fsp);
|
||||
fsp_unbind_smb(req, fsp);
|
||||
|
||||
*_fsp = NULL;
|
||||
return status;
|
||||
}
|
||||
|
||||
NTSTATUS close_file_free(struct smb_request *req,
|
||||
struct files_struct **_fsp,
|
||||
enum file_close_type close_type)
|
||||
{
|
||||
struct files_struct *fsp = *_fsp;
|
||||
NTSTATUS status;
|
||||
|
||||
status = close_file_smb(req, fsp, close_type);
|
||||
|
||||
file_free(req, fsp);
|
||||
*_fsp = NULL;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -130,6 +130,9 @@ bool smbd_smb1_brl_finish_by_mid(
|
||||
/* The following definitions come from smbd/close.c */
|
||||
|
||||
void set_close_write_time(struct files_struct *fsp, struct timespec ts);
|
||||
NTSTATUS close_file_smb(struct smb_request *req,
|
||||
struct files_struct *fsp,
|
||||
enum file_close_type close_type);
|
||||
NTSTATUS close_file_free(struct smb_request *req,
|
||||
struct files_struct **_fsp,
|
||||
enum file_close_type close_type);
|
||||
|
Loading…
Reference in New Issue
Block a user