git: kernel - Change bundirty() location in I/O sequence

Matthew Dillon dillon at crater.dragonflybsd.org
Wed May 20 22:24:05 PDT 2015


commit ffd3e597d368aae907e57dfbdaf3ea429482905f
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Wed May 20 22:18:41 2015 -0700

    kernel - Change bundirty() location in I/O sequence
    
    * When doing a write BIO, do not bundirty() the buffer prior to issuing
      the vn_strategy().  Instead, bundirty() the buffer when the I/O
      is complete, primarily in bpdone().
    
      The I/O's data buffer is protected during the operation by vfs_busy_pages(),
      so related VM pages cannot be modified while the write is running.  And,
      of course, the buffer itself is locked exclusively for the duration of the
      opeartion.  Thus this change should NOT introduce any redirtying races.
    
    * This change ensures that vp->v_rbdirty_tree remains non-empty until all
      related write I/Os have completed, removing a race condition for code
      which checks vp->v_rbdirty_tree to determine e.g. if a file requires
      synchronization or not.
    
      This race could cause problems because the system buffer flusher might
      be in the midst of flushing a buffer just as a filesystem decides to
      sync and starts checking vp->v_rbdirty_tree.
    
    * This should theoretically fix a long-standing but difficult-to-reproduce
      bug in HAMMER1 where a backend flush occurs at an inopportune time.

Summary of changes:
 sys/kern/vfs_bio.c     | 58 +++++++++++++++++++++++++++++++++++++++-----------
 sys/kern/vfs_cluster.c | 17 +++++++++++++--
 sys/kern/vfs_subr.c    |  2 ++
 sys/kern/vfs_sync.c    | 19 +++++++++++------
 4 files changed, 75 insertions(+), 21 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/ffd3e597d368aae907e57dfbdaf3ea429482905f


-- 
DragonFly BSD source repository



More information about the Commits mailing list