OpenAFS Master Repository branch, master, updated. BP-openafs-stable-1_8_x-51-g5e09a69

Gerrit Code Review
Sun, 4 Feb 2018 09:15:34 -0500

The following commit has been merged in the master branch:
commit 5e09a694ec2c0cd20f5dee500eff6bc3dd04c097
Author: Mark Vitale <>
Date:   Tue Jun 30 01:54:21 2015 -0400

    SOLARIS: Avoid vcache locks when flushing pages for RO vnodes
    We have multiple code paths that hold the following locks at the same
        - avc->lock for a vcache
        - The page lock for a page in 'avc'
    In order to avoid deadlocks, we need a consistent ordering for obtaining
    these two locks. The code in afs_putpage() currently obtains avc->lock
    before the page lock (Obtain*Lock is called before pvn_vplist_dirty).
    The code in afs_getpages() also obtains avc->lock before the page lock,
    but it does so in a loop for all requested pages (via pvn_getpages()).
    On the second iteration of that loop, it obtains avc->lock, and the page
    from the first iteration of the loop is still locked. Thus, it obtains a
    page lock before locking avc->lock in some cases.
    Since we have two code paths that obtain those two locks in a different
    order, a deadlock can occur. Fixing this properly requires changing at
    least one of those code paths, so the locks are taken in a consistent
    order. However, doing so is complex and will be done in a separate
    future commit.
    For this commit, we can avoid the deadlock for RO volumes by simply
    avoiding taking avc->lock in afs_putpages() at all while the pages are
    locked. Normally, we lock avc->lock because pvn_vplist_dirty() will call
    afs_putapage() for each dirty page (and afs_putapage() requires
    avc->lock held). But for RO volumes, we will have no dirty pages
    (because RO volumes cannot be written to from a client), and so
    afs_putapage() will never be called.
    So to avoid this deadlock issue for RO volumes, avoid taking avc->lock
    across the pvn_vplist_dirty() call in afs_putpage(). We now pass a dummy
    pageout callback function to pvn_vplist_dirty() instead, which should
    never be called, and which panics if it ever is.
    We still need to hold avc->lock a few other times during afs_putpage()
    for other minor reasons, but none of these hold page locks at the same
    time, so the deadlock issue is still avoided.
    [mmeffie: comments, and fix missing write lock, fix lock releases]
    [adeason: revised commit message]
    Change-Id: Iec11101147220828f319dae4027e7ab1f08483a6
    Tested-by: BuildBot <>
    Reviewed-by: Andrew Deason <>
    Reviewed-by: Benjamin Kaduk <>

 src/afs/SOLARIS/osi_vnodeops.c |   64 +++++++++++++++++++++++++++++++---------
 1 files changed, 50 insertions(+), 14 deletions(-)

OpenAFS Master Repository