smbd: Fix a panic
authorVolker Lendecke <vl@samba.org>
Tue, 21 May 2019 13:26:55 +0000 (15:26 +0200)
committerRalph Boehme <slow@samba.org>
Wed, 22 May 2019 20:09:29 +0000 (20:09 +0000)
commit30622ed876cffff305a9b03686edb48de987704f
tree1b6cf04cfbf139b9d5cdfb7f2cba9510cd89de53
parentfebb933fc7bcba56af845fde61615a9fcbd67b07
smbd: Fix a panic

Opening a file with a stale (smbd died) LEVEL_II oplock makes

vfs_set_filelen-> ... ->contend_level2_oplocks_begin_default

trigger the immediate leading to do_break_to_none. This goes through
because fsp->oplock_type is not initialized yet, thus 0. Also,
file_has_read_oplocks is still valid, because the smbd that has died
could not clean up the brlock.tdb entry.

Later in the code the exclusive oplock is granted, which is then found
by do_break_to_none, making it panic.

This patch just runs the direct FTRUNCATE instead of vfs_set_filelen.
This means the contend_level2_oplock code is skipped.

The relevant break (LEVEL_II to NONE) is now done in delay_for_oplock()
with the nice effect of removing a comment that was very confusing to
me.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13957
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed May 22 20:09:29 UTC 2019 on sn-devel-184
selftest/knownfail
source3/smbd/open.c