[PATCH] Fix bug #13121 - Non-smbd processes using kernel oplocks can hang smbd
Ralph Böhme
slow at samba.org
Thu Nov 30 22:01:44 UTC 2017
On Thu, Nov 30, 2017 at 12:29:46PM -0800, Jeremy Allison wrote:
> OK, there *is* a race condition in the test. It's
> the following. The child process gets the kernel
> lease and then notifies the parent process to continue
> by writing a byte up a pipe. It then sets the alarm
> and calls pause() to wait for the parent process to
> contact the smbd and get it to trigger the break request
> using an open call.
>
> It is possible for the parent to run and trigger the break
> request after the child has written to the pipe, but *before*
> the child calls pause(). We then miss the signal notifying
> the child to break the lease.
>
> The fix for this is below. We need to set the sigmask
> on the child to prohibit receiving RT_SIGNAL_LEASE and SIGALRM,
> then wait for the lease break or alarm signal by calling
> sigsuspend(), not pause().
ahhhhh, this smelled so much like a race condition, I just couldn't spot it
yesterday at night. Glad you nailed it!
> When I add this patch the test becomes 100% reliable
> (not flakey) on the Catalyst cloud.
>
> Thanks a *LOT* Andrew for setting this up and allowing
> access - I don't think I would have found this without
> it !
>
> Please review and push if happy.
happy, pushed. :)
-slow
--
Ralph Boehme, Samba Team https://samba.org/
Samba Developer, SerNet GmbH https://sernet.de/en/samba/
More information about the samba-technical
mailing list