Skip to content

Commit

Permalink
deadlock between mm_sem and tx assign in zfs_write() and page fault
Browse files Browse the repository at this point in the history
(This is the ported SPL portion of this patch)

The bug time sequence:
1. thread openzfs#1, `zfs_write` assign a txg "n".
2. In a same process, thread openzfs#2, mmap page fault (which means the
`mm_sem` is hold) occurred, `zfs_dirty_inode` open a txg failed,
and wait previous txg "n" completed.
3. thread openzfs#1 call `uiomove` to write, however page fault is occurred
in `uiomove`, which means it need `mm_sem`, but `mm_sem` is hold by
thread openzfs#2, so it stuck and can't complete,  then txg "n" will
not complete.

So thread openzfs#1 and thread openzfs#2 are deadlocked.

Reviewed-by: Chunwei Chen <tuxoko@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: Grady Wong <grady.w@xtaotech.com>
Closes #7939
  • Loading branch information
tonyhutter committed Jan 18, 2019
1 parent fdd2abe commit 647cca7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions include/sys/uio.h
Expand Up @@ -53,6 +53,7 @@ typedef struct uio {
int uio_iovcnt;
offset_t uio_loffset;
uio_seg_t uio_segflg;
boolean_t uio_fault_disable;
uint16_t uio_fmode;
uint16_t uio_extflg;
offset_t uio_limit;
Expand Down

0 comments on commit 647cca7

Please sign in to comment.