Add a log entry to the volume server to help diagnose those pesky
'Invalid cross-link device' errors returned by vos, which occur when
a clone volume is located in a different partition than the parent
read-write volume, or when a read-only volume is on the incorrect
partition on the server.
With this change, a new log entry is added when the volume server
fails to create a clone or a read-write volume because a volume with
the target volume id already exists on a different partition. For a
clone volume, this would be a different partition than the
read-write volume. For a read-only volume, this would be a different
partition than indicated in the vldb.
Examples:
Volume foobar is on /vicepb, but foobar.backup is incorrectly on
partition /vicepa.
$ vos backup foobar
Failed to clone the volume
536870934
: Invalid cross-device link
VolserLog:
VCreateVolume: volume
536870936 for parent
536870934 found on /vicepa; unable to create volume on /vicepb.
1 Volser: Clone: Couldn't create new volume
536870936 for parent
536870934; clone aborted
...
The vldb indicates a read-only volume should be on /vicepa on a
remote site, but the actual volume is on /vicepb.
$ vos release xyzzy
Failed to create the ro volume: : Input/output error
The volume
536870921 could not be released to the following 1 sites:
mantis /vicepa
VOLSER: release could not be completed
...
VolserLog on mantis:
VCreateVolume: volume
536870922 for parent
536870921 found on /vicepb; unable to create volume on /vicepa.
...
Change-Id: Iaa471c46059d598a5095d59580e3b0b8ac6e1992
Reviewed-on: http://gerrit.openafs.org/10849
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: D Brashear <shadow@your-file-system.com>
if (*ec == VNOVOL || !strcmp(partition->name, part)) {
/* this case is ok */
} else {
- /* return EXDEV if it's a clone to an alternate partition
+ /* return EXDEV if it's a clone or read-only to an alternate partition
* otherwise assume it's a move */
if (vol.parentId != vol.id) {
+ Log("VCreateVolume: volume %" AFS_VOLID_FMT " for parent %" AFS_VOLID_FMT
+ " found on %s; unable to create volume on %s.\n",
+ afs_printable_VolumeId_lu(vol.id),
+ afs_printable_VolumeId_lu(vol.parentId), part, partition->name);
*ec = EXDEV;
return NULL;
}
VCreateVolume(&error, originalvp->partition->name, newId,
V_parentId(originalvp));
if (error) {
- Log("1 Volser: Clone: Couldn't create new volume; clone aborted\n");
+ Log("1 Volser: Clone: Couldn't create new volume %" AFS_VOLID_FMT " for parent %" AFS_VOLID_FMT "; clone aborted\n",
+ afs_printable_VolumeId_lu(newId), afs_printable_VolumeId_lu(V_parentId(originalvp)));
newvp = (Volume *) 0;
goto fail;
}