cvs commit: src/sys/vfs/ufs ffs_balloc.c

Matthew Dillon dillon at crater.dragonflybsd.org
Sun Aug 28 16:25:14 PDT 2005


dillon      2005/08/28 16:23:10 PDT

DragonFly src repository

  Modified files:
    sys/vfs/ufs          ffs_balloc.c 
  Log:
  Fix a deadlock in ffs_balloc().  This function was incorrectly obtaining a
  locked indirect buffer followed by a locked data block buffer, where as other
  procedures in the kernel generally held a locked data buffer and then
  called procedures which locked the indirect buffer.  Programs like rtorrent,
  which write data into the mmap'd files whos blocks had not yet been
  allocated, could easily deadlock the vnode.
  
  A typical deadlock would be: syncer calls putpages->ffs_write->balloc->getblk->
  allocbuf->(blocked on VM page with indirect block and data block locked), while
  at the same time some process takes a write fault which locks the VM page and
  then attempts to do a BMAP, blocking on the indirect block buffer.  Deadlock.
  
  The fix for ffs_balloc() is simply to obtain the data buffer prior to
  obtaining the indirect block(s).
  
  Reported-by: Mitja Horvat
  MFC: 1 week
  
  Revision  Changes    Path
  1.12      +88 -30    src/sys/vfs/ufs/ffs_balloc.c


http://www.dragonflybsd.org/cvsweb/src/sys/vfs/ufs/ffs_balloc.c.diff?r1=1.11&r2=1.12&f=u





More information about the Commits mailing list