]> git.proxmox.com Git - zfsonlinux.git/blob - spl-patches/0002-deadlock-between-mm_sem-and-tx-assign-in-zfs_write-a.patch
Backport deadlock fix for issue ZOL#7939
[zfsonlinux.git] / spl-patches / 0002-deadlock-between-mm_sem-and-tx-assign-in-zfs_write-a.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: ilbsmart <wgqimut@gmail.com>
3 Date: Wed, 17 Oct 2018 02:11:24 +0800
4 Subject: [PATCH] deadlock between mm_sem and tx assign in zfs_write() and page
5 fault
6
7 The bug time sequence:
8 1. thread #1, `zfs_write` assign a txg "n".
9 2. In a same process, thread #2, mmap page fault (which means the
10 `mm_sem` is hold) occurred, `zfs_dirty_inode` open a txg failed,
11 and wait previous txg "n" completed.
12 3. thread #1 call `uiomove` to write, however page fault is occurred
13 in `uiomove`, which means it need `mm_sem`, but `mm_sem` is hold by
14 thread #2, so it stuck and can't complete, then txg "n" will
15 not complete.
16
17 So thread #1 and thread #2 are deadlocked.
18
19 Reviewed-by: Chunwei Chen <tuxoko@gmail.com>
20 Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
21 Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
22 Signed-off-by: Grady Wong <grady.w@xtaotech.com>
23 Closes #7939
24
25 (backported from: zfs-upstream 779a6c0bf6df76e0dd92c1ccf81f48512b835bb0)
26 Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
27 ---
28 include/sys/uio.h | 1 +
29 1 file changed, 1 insertion(+)
30
31 diff --git a/include/sys/uio.h b/include/sys/uio.h
32 index 764beb9..2895690 100644
33 --- a/include/sys/uio.h
34 +++ b/include/sys/uio.h
35 @@ -53,6 +53,7 @@ typedef struct uio {
36 int uio_iovcnt;
37 offset_t uio_loffset;
38 uio_seg_t uio_segflg;
39 + boolean_t uio_fault_disable;
40 uint16_t uio_fmode;
41 uint16_t uio_extflg;
42 offset_t uio_limit;