diff options
author | Volker Lendecke <vl@samba.org> | 2019-07-25 11:52:21 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2019-08-19 23:14:39 +0000 |
commit | f8fe0116c1158d8fdf0401ca46e8f12b84c04738 (patch) | |
tree | 13968ac411ad7ab5ed3c6c08901a94141352113f | |
parent | 002c6d0efb7bb41c158fc9056a176c5cce72f393 (diff) | |
download | samba-f8fe0116c1158d8fdf0401ca46e8f12b84c04738.tar.gz |
smbd: Move resetting "oplock_request" to before delay_for_oplock()
It seems to make little sense to me to do the oplock break with one
setting and then later on grant_fsp_oplock_type with another
one. Survives tests, I can't think of any scenario where this (to me)
simplification would break anything
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | source3/smbd/open.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c index ceb117c924d..23f80925840 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -3236,6 +3236,23 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, open_access_mask |= FILE_WRITE_DATA; /* This will cause oplock breaks. */ } + if (file_existed) { + /* + * stat opens on existing files don't get oplocks. + * They can get leases. + * + * Note that we check for stat open on the *open_access_mask*, + * i.e. the access mask we actually used to do the open, + * not the one the client asked for (which is in + * fsp->access_mask). This is due to the fact that + * FILE_OVERWRITE and FILE_OVERWRITE_IF add in O_TRUNC, + * which adds FILE_WRITE_DATA to open_access_mask. + */ + if (is_stat_open(open_access_mask) && lease == NULL) { + oplock_request = NO_OPLOCK; + } + } + DEBUG(10, ("open_file_ntcreate: fname=%s, after mapping " "access_mask=0x%x\n", smb_fname_str_dbg(smb_fname), access_mask)); @@ -3596,23 +3613,6 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, fsp->access_mask = access_mask | FILE_READ_ATTRIBUTES; } - if (file_existed) { - /* - * stat opens on existing files don't get oplocks. - * They can get leases. - * - * Note that we check for stat open on the *open_access_mask*, - * i.e. the access mask we actually used to do the open, - * not the one the client asked for (which is in - * fsp->access_mask). This is due to the fact that - * FILE_OVERWRITE and FILE_OVERWRITE_IF add in O_TRUNC, - * which adds FILE_WRITE_DATA to open_access_mask. - */ - if (is_stat_open(open_access_mask) && lease == NULL) { - oplock_request = NO_OPLOCK; - } - } - if (new_file_created) { info = FILE_WAS_CREATED; } else { |