mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-30 18:56:23 +03:00
deadlock between mm_sem and tx assign in zfs_write() and page fault
The bug time sequence: 1. thread #1, `zfs_write` assign a txg "n". 2. In a same process, thread #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 #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 #2, so it stuck and can't complete, then txg "n" will not complete. So thread #1 and thread #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
This commit is contained in:
@@ -53,12 +53,14 @@ if ! is_mp; then
|
||||
fi
|
||||
|
||||
log_must chmod 777 $TESTDIR
|
||||
mmapwrite $TESTDIR/test-write-file &
|
||||
mmapwrite $TESTDIR/normal_write_file $TESTDIR/map_write_file &
|
||||
PID_MMAPWRITE=$!
|
||||
log_note "mmapwrite $TESTDIR/test-write-file pid: $PID_MMAPWRITE"
|
||||
log_note "mmapwrite $TESTDIR/normal_write_file $TESTDIR/map_write_file"\
|
||||
"pid: $PID_MMAPWRITE"
|
||||
log_must sleep 30
|
||||
|
||||
log_must kill -9 $PID_MMAPWRITE
|
||||
log_must ls -l $TESTDIR/test-write-file
|
||||
log_must ls -l $TESTDIR/normal_write_file
|
||||
log_must ls -l $TESTDIR/map_write_file
|
||||
|
||||
log_pass "write(2) a mmap(2)'ing file succeeded."
|
||||
|
||||
Reference in New Issue
Block a user