struct destServer *destination, afs_int32,
struct restoreCookie *cookie);
static afs_int32 VolDump(struct rx_call *, afs_int32, afs_int32, afs_int32);
-static afs_int32 VolRestore(struct rx_call *, afs_int32, afs_int32,
- struct restoreCookie *);
+static afs_int32 VolRestore(struct rx_call *, afs_int32, struct restoreCookie *);
static afs_int32 VolEndTrans(struct rx_call *, afs_int32, afs_int32 *);
static afs_int32 VolSetForwarding(struct rx_call *, afs_int32, afs_int32);
static afs_int32 VolGetStatus(struct rx_call *, afs_int32,
return code;
}
-afs_int32
+static afs_int32
VolPartitionInfo(struct rx_call *acid, char *pname, struct diskPartition64
*partition)
{
{
afs_int32 code;
- code = VolRestore(acid, atrans, aflags, cookie);
+ code = VolRestore(acid, atrans, cookie);
osi_auditU(acid, VS_RestoreEvent, code, AUD_LONG, atrans, AUD_END);
return code;
}
static afs_int32
-VolRestore(struct rx_call *acid, afs_int32 atrans, afs_int32 aflags,
- struct restoreCookie *cookie)
+VolRestore(struct rx_call *acid, afs_int32 atrans, struct restoreCookie *cookie)
{
struct volser_trans *tt;
afs_int32 code, tcode;
DFlushVolume(V_parentId(tt->volume)); /* Ensure dir buffers get dropped */
- code = RestoreVolume(acid, tt->volume, (aflags & 1), cookie); /* last is incrementalp */
+ code = RestoreVolume(acid, tt->volume, cookie);
FSYNC_VolOp(tt->volid, NULL, FSYNC_VOL_BREAKCBKS, 0l, NULL);
TClearRxCall(tt);
tcode = TRELE(tt);
case VOL_INFO_LIST_SINGLE:
Log("1 Volser: GetVolInfo: Volume %" AFS_VOLID_FMT " (%s:%s) will be destroyed on next salvage\n",
afs_printable_VolumeId_lu(volumeId), pname, volname);
+ goto drop;
default:
goto drop;
{
transDebugInfo *pntr;
afs_int32 allocSize = 50;
+ afs_int32 code = 0;
struct volser_trans *tt, *nt, *allTrans;
if (!afsconf_CheckRestrictedQuery(tdir, acid, restrictedQueryLevel))
allocSize = (allocSize * 3) / 2;
pntr = realloc(transInfo->transDebugEntries_val,
allocSize * sizeof(transDebugInfo));
+ if (pntr == NULL) {
+ code = ENOMEM;
+ goto done;
+ }
transInfo->transDebugEntries_val = pntr;
pntr =
transInfo->transDebugEntries_val +
done:
VTRANS_UNLOCK;
- return 0;
+ return code;
}
afs_int32
#endif
ttc = NewTrans(volumeId, partId);
if (!ttc) {
- return VOLSERVOLBUSY;
+ ret = VOLSERVOLBUSY;
+ goto done;
}
+ ret = FSYNC_VolOp(volumeId, pname, FSYNC_VOL_NEEDVOLUME, V_VOLUPD,
+ NULL);
+ if (ret != SYNC_OK) {
+ Log("SAFSVolConvertROtoRWvolume: Error %ld trying to check out "
+ "vol %lu part %s.\n", afs_printable_int32_ld(ret),
+ afs_printable_uint32_lu(volumeId), pname);
+ ret = VOLSERFAILEDOP;
+ goto done;
+ }
#ifdef AFS_NAMEI_ENV
ret = namei_ConvertROtoRWvolume(pname, volumeId);
#else
ret = inode_ConvertROtoRWvolume(pname, volumeId);
#endif
+ if (ret != 0) {
+ Log("SAFSVolConvertROtoRWvolume: Error %ld trying to convert "
+ "RO vol %lu to RW. The volume may be in an inconsistent or "
+ "partially converted state; if the volume seems unusable, "
+ "you can try salvaging it or restoring from another RO "
+ "copy.\n", afs_printable_int32_ld(ret),
+ afs_printable_uint32_lu(volumeId));
+ /*
+ * the volume may or may not be usable at this point; let the
+ * fileserver try to attach and decide.
+ */
+ FSYNC_VolOp(volumeId, pname, FSYNC_VOL_ON, 0, NULL);
+ }
break;
}
}
-
+ done:
if (ttc)
DeleteTrans(ttc, 1);