mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 23:10:58 +00:00
vldb_check: cope with broken names and volids
Fix-up broken vlentry names and rw volid so entries can be looked
up in the vlserver and can be deleted with vos delentry if needed.
Reviewed-on: http://gerrit.openafs.org/9905
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit 7a89c4f944
)
Change-Id: I2cf2d711f6dee08b2d27429ff4d37290bc21b9a2
Reviewed-on: http://gerrit.openafs.org/10268
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
This commit is contained in:
parent
a33157bc62
commit
ad8b40dc80
@ -244,6 +244,8 @@ InvalidVolname(char *volname)
|
||||
slen = strlen(volname);
|
||||
if (slen >= VL_MAXNAMELEN)
|
||||
return 1;
|
||||
if (slen == 0)
|
||||
return 1;
|
||||
return (slen != strspn(volname, map));
|
||||
}
|
||||
|
||||
@ -1521,6 +1523,21 @@ WorkerBee(struct cmd_syndesc *as, void *arock)
|
||||
char newNameBuffer[10 + VL_MAXNAMELEN];
|
||||
char *oldname, *newname;
|
||||
|
||||
/* Fix broken names and numbers so entries can be inspected and deleted. */
|
||||
if (InvalidVolname(vlentry.name)) {
|
||||
char bogus[VL_MAXNAMELEN];
|
||||
memset(bogus, 0, sizeof(bogus));
|
||||
snprintf(bogus, sizeof(bogus)-1, ".bogus.%ld", record[i].addr);
|
||||
strcpy(vlentry.name, bogus);
|
||||
quiet_println("FIX: Record %ld invalid volume name set to '%s'\n", record[i].addr, bogus);
|
||||
}
|
||||
if (vlentry.volumeId[0] == 0) {
|
||||
afs_uint32 next_volid = header.vital_header.MaxVolumeId++;
|
||||
vlentry.volumeId[0] = next_volid;
|
||||
quiet_println("FIX: Record %ld invalid volume id set to %ld. New max volid is %ld\n",
|
||||
record[i].addr, next_volid, header.vital_header.MaxVolumeId);
|
||||
}
|
||||
|
||||
/*
|
||||
* Put the current hash table contexts into our 'next'
|
||||
* and our address into the hash table.
|
||||
|
Loading…
Reference in New Issue
Block a user