VOL_LOCK needed when traversing DiskPartitionList

VLockPartition sets VOL_LOCK, opens (perhaps creating) the lock file
for a partition, and flock's it.  VUnlockPartition, sets VOL_LOCK, and
closes the lock file fd.

VLockPartition is called from the salvager.  Nothing ever calls
VUnlockPartition.

VPFullUnlock is called every 30 seconds, does NOT set VOL_LOCK, and
happily closes any lock file fd it finds, breaking any lock set with
flock.

Other routines use the VOL_LOCK when traversing DiskPartitionList.

Change-Id: I683547f574b1f760e72014f5d44ce3987f07b5df
Reviewed-on: http://gerrit.openafs.org/1213
Reviewed-by: Dan Hyde <drh@umich.edu>
Tested-by: Dan Hyde <drh@umich.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Dan Hyde 2010-02-02 10:37:47 -05:00 committed by Derrick Brashear
parent 028240329c
commit 105481d334

View File

@ -134,7 +134,7 @@ static afs_int32 VolSetDate(struct rx_call *, afs_int32, afs_int32);
/* this call unlocks all of the partition locks we've set */ /* this call unlocks all of the partition locks we've set */
int int
VPFullUnlock(void) VPFullUnlock_r(void)
{ {
register struct DiskPartition64 *tp; register struct DiskPartition64 *tp;
for (tp = DiskPartitionList; tp; tp = tp->next) { for (tp = DiskPartitionList; tp; tp = tp->next) {
@ -146,6 +146,16 @@ VPFullUnlock(void)
return 0; return 0;
} }
int
VPFullUnlock(void)
{
int code;
VOL_LOCK;
code = VPFullUnlock_r();
VOL_UNLOCK;
return code;
}
/* get partition id from a name */ /* get partition id from a name */
afs_int32 afs_int32
PartitionID(char *aname) PartitionID(char *aname)