OpenAFS Master Repository branch, master, updated. openafs-devel-1_9_2-371-ga6d0e95

Gerrit Code Review gerrit@openafs.org
Thu, 6 Nov 2025 12:00:17 -0500


The following commit has been merged in the master branch:
commit a6d0e95399de8b68d43b5e1f31d8d37266269f1c
Author: Mark Vitale <mvitale@sinenomine.net>
Date:   Thu Jul 2 12:47:09 2020 -0400

    vol: Repair _VHandleVolumeHeader retry logic
    
    Commit 2cd1335257f0 "Abstract /vicepX header traversal" introduced
    routines VWalkVolumeHeaders() and _VHandleVolumeHeader(). In
    _VHandleVolumeHeader(), if 'locked' is 0 and we encounter an error, we
    are supposed to lock the partition, and retry reading the volume header.
    However, this retry logic is never actually run, due to a few bugs:
    
    First, VWalkVolumeHeaders() calls _VHandleVolumeHeader() with 'locked' set
    to -1 instead of 0. So even though the partition lock isn't held,
    _VHandleVolumeHeader() never retries reading the header, since 'locked'
    is nonzero.
    
    Another bug is a typo in _VHandleVolumeHeader(): '#ifdef
    AFSFS_DEMAND_ATTACH_FS' will never be true, since the relevant define is
    actually AFS_DEMAND_ATTACH_FS. So we never try to unlock the partition
    if 'locked' is set. This is actually fortunate, because the caller
    currently always mistakenly passes -1 for 'locked' even though the
    partition lock isn't held.
    
    Finally, the call to VPartHeaderUnlock() is missing its second argument
    'locktype'. This was never noticed because of the AFS_DEMAND_ATTACH_FS
    typo, and so this call is never currently compiled.
    
    To fix all of these: change VWalkVolumeHeaders() to call
    _VHandleVolumeHeader() with 'locked' set to 0, fix the
    AFS_DEMAND_ATTACH_FS typo, and call VPartHeaderUnlock() with WRITE_LOCK
    to match the VPartHeaderLock(WRITE_LOCK) call in VWalkVolumeHeaders().
    
    Change-Id: Ic998c0e32211bea9466af10ad3be20ef4f9221be
    Reviewed-on: https://gerrit.openafs.org/16581
    Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
    Tested-by: Andrew Deason <adeason@sinenomine.net>
    Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
    Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
    Reviewed-by: Andrew Deason <adeason@sinenomine.net>

 src/vol/vutil.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

-- 
OpenAFS Master Repository