git: a95b05950a2f - stable/13 - linux: remove locks around callout_drain in timerfd_close()

From: Edward Tomasz Napierala <trasz_at_FreeBSD.org>
Date: Thu, 17 Feb 2022 13:46:18 UTC
The branch stable/13 has been updated by trasz:

URL: https://cgit.FreeBSD.org/src/commit/?id=a95b05950a2f058a00b1c96a346825622fb976d9

commit a95b05950a2f058a00b1c96a346825622fb976d9
Author:     shu <ankohuu@outlook.com>
AuthorDate: 2021-02-03 19:10:58 +0000
Commit:     Edward Tomasz Napierala <trasz@FreeBSD.org>
CommitDate: 2022-02-13 23:09:31 +0000

    linux: remove locks around callout_drain in timerfd_close()
    
    The lock around callout_drain() is unnecessary and may cause
    deadlock when one closes a timer descriptor during timer execution.
    
    Reviewed By:    delphij
    Submitted By:   ankohuu_outlook.com (Shunchao Hu)
    Differential Revision: https://reviews.freebsd.org/D28148
    
    (cherry picked from commit 14c40d2c292deff44be5591add7fdad5f9b371aa)
---
 sys/compat/linux/linux_event.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sys/compat/linux/linux_event.c b/sys/compat/linux/linux_event.c
index 370bf4d6485f..991af1b539e4 100644
--- a/sys/compat/linux/linux_event.c
+++ b/sys/compat/linux/linux_event.c
@@ -670,9 +670,7 @@ timerfd_close(struct file *fp, struct thread *td)
 	timespecclear(&tfd->tfd_time.it_value);
 	timespecclear(&tfd->tfd_time.it_interval);
 
-	mtx_lock(&tfd->tfd_lock);
 	callout_drain(&tfd->tfd_callout);
-	mtx_unlock(&tfd->tfd_lock);
 
 	seldrain(&tfd->tfd_sel);
 	knlist_destroy(&tfd->tfd_sel.si_note);