git: kernel - Fix deadlock assertion panic with mmap/read combos

看板DFBSD_commit作者時間15年前 (2011/01/20 06:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
commit 283b944850fbb3421a77ef06aa121d066f5c8cad Author: Matthew Dillon <dillon@apollo.backplane.com> Date: Wed Jan 19 14:11:10 2011 -0800 kernel - Fix deadlock assertion panic with mmap/read combos * Normally the uiomove() is called with the buffer locked. When uiomove()ing into mmap'd memory this can cause a lock recursion and panic, or a deadlock. * Fix the problem by adding bqhold() and bqdrop() and adjusting the use of the b_refs field to prevent the buffer from being invalidated, allowing VFS VOP_READ operations to release the buffer prior to the uiomove() into user memory. * Adjust brelse() and getnewbuf() to do the right thing. Note that there are two cases where b_refs can transition from 0->1. The VFS release/uiomove case will only transition b_refs while the buffer is locked while findblk() will transition b_refs at any time (while holding the spin lock). We only care about retaining the VM pages in the transition-during-locked case. * Original problem reproducable with grep -r --mmap SomeString /usr/pkgsrc Reported-by: YONETANI Tomokazu <qhwt.dfly@les.ath.cx> Summary of changes: sys/kern/vfs_bio.c | 92 ++++++++++++++++++++++++++++------------- sys/sys/buf.h | 7 ++- sys/vfs/hammer/hammer_vnops.c | 16 ++++++- 3 files changed, 80 insertions(+), 35 deletions(-) http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/283b944850fbb3421a77ef06aa121d066f5c8cad -- DragonFly BSD source repository
文章代碼(AID): #1DDsPeqZ (DFBSD_commit)