* possibly by putting the vp back on the VLRU. */
code = SYNC_OK;
+ } else if (V_attachState(vp) == VOL_STATE_DELETED) {
+ VDeregisterVolOp_r(vp);
+ res->hdr.reason = FSYNC_UNKNOWN_VOLID;
+
} else {
code = SYNC_DENIED;
res->hdr.reason = FSYNC_BAD_STATE;
}
if (!foundSVN) {
- /* singleVolumeNumber generally should always be in the constructed
- * volumeSummary, but just in case it's not... */
- AskOnline(salvinfo, singleVolumeNumber);
+ /* If singleVolumeNumber is not in our volumeSummary, it means that
+ * at least one other volume in the VG is on the partition, but the
+ * RW volume is not. We've already AskOffline'd it by now, though,
+ * so make sure we don't still have the volume checked out. */
+ AskDelete(salvinfo, singleVolumeNumber);
}
for (j = 0; j < salvinfo->nVolumes; j++) {
AskDelete(struct SalvInfo *salvinfo, VolumeId volumeId)
{
afs_int32 code, i;
+ SYNC_response res;
for (i = 0; i < 3; i++) {
+ memset(&res, 0, sizeof(res));
code = FSYNC_VolOp(volumeId, salvinfo->fileSysPartition->name,
- FSYNC_VOL_DONE, FSYNC_SALVAGE, NULL);
+ FSYNC_VOL_DONE, FSYNC_SALVAGE, &res);
if (code == SYNC_OK) {
break;
#endif
}
break;
+ } else if (code == SYNC_FAILED &&
+ (res.hdr.reason == FSYNC_UNKNOWN_VOLID ||
+ res.hdr.reason == FSYNC_WRONG_PART)) {
+ /* volume is already effectively 'deleted' */
+ break;
} else if (i < 2) {
/* try it again */
Log("AskOnline: request for fileserver to delete volume failed; trying again...\n");