diff options
author | Volker Lendecke <vl@samba.org> | 2013-09-11 16:07:33 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2013-10-15 01:52:29 +0200 |
commit | fcafaf6022832835fc8fa76a4c33056605dc53e4 (patch) | |
tree | b9da13ff8580780efff786c9eff37b599b6fa9bb /source3/smbd/open.c | |
parent | eb50c18c4a2d0caa3b8d21b2e1b536adc8dc0276 (diff) | |
download | samba-fcafaf6022832835fc8fa76a4c33056605dc53e4.tar.gz samba-fcafaf6022832835fc8fa76a4c33056605dc53e4.tar.bz2 samba-fcafaf6022832835fc8fa76a4c33056605dc53e4.zip |
smbd: Remove FAKE_LEVEL_II_OPLOCK
FAKE_LEVEL_II_OPLOCK was an indicator to break level2 oplock holders
on write. This information is now being held in brlock.tdb, which makes
the FAKE_LEVEL_II_OPLOCK type unnecessary.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/smbd/open.c')
-rw-r--r-- | source3/smbd/open.c | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c index f6df03595f..93b69d5afd 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1052,14 +1052,6 @@ static void validate_my_share_entries(struct smbd_server_connection *sconn, "share entry with an open file\n"); } - if ((share_entry->op_type == NO_OPLOCK) && - (fsp->oplock_type == FAKE_LEVEL_II_OPLOCK)) - { - /* Someone has already written to it, but I haven't yet - * noticed */ - return; - } - if (((uint16)fsp->oplock_type) != share_entry->op_type) { goto panic; } @@ -1408,24 +1400,10 @@ static void grant_fsp_oplock_type(files_struct *fsp, * what was found in the existing share modes. */ - if (got_a_none_oplock) { - fsp->oplock_type = NO_OPLOCK; - } else if (got_level2_oplock) { - if (fsp->oplock_type == NO_OPLOCK || - fsp->oplock_type == FAKE_LEVEL_II_OPLOCK) { - /* Store a level2 oplock, but don't tell the client */ - fsp->oplock_type = FAKE_LEVEL_II_OPLOCK; - } else { + if (got_level2_oplock || got_a_none_oplock) { + if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) { fsp->oplock_type = LEVEL_II_OPLOCK; } - } else { - /* All share_mode_entries are placeholders or deferred. - * Silently upgrade to fake levelII if the client didn't - * ask for an oplock. */ - if (fsp->oplock_type == NO_OPLOCK) { - /* Store a level2 oplock, but don't tell the client */ - fsp->oplock_type = FAKE_LEVEL_II_OPLOCK; - } } /* @@ -1433,7 +1411,20 @@ static void grant_fsp_oplock_type(files_struct *fsp, * or if we've turned them off. */ if (fsp->oplock_type == LEVEL_II_OPLOCK && !allow_level2) { - fsp->oplock_type = FAKE_LEVEL_II_OPLOCK; + fsp->oplock_type = NO_OPLOCK; + } + + if (fsp->oplock_type == LEVEL_II_OPLOCK && !got_level2_oplock) { + /* + * We're the first level2 oplock. Indicate that in brlock.tdb. + */ + struct byte_range_lock *brl; + + brl = brl_get_locks(talloc_tos(), fsp); + if (brl != NULL) { + brl_set_have_read_oplocks(brl, true); + TALLOC_FREE(brl); + } } DEBUG(10,("grant_fsp_oplock_type: oplock type 0x%x on file %s\n", |