From: Andrew Deason Date: Wed, 7 Oct 2009 17:14:11 +0000 (-0500) Subject: Make namei convertROtoRW'd volumes usable X-Git-Tag: openafs-stable-1_4_12pre1~123 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=10441428634e6f474457a1fbf38ea693279d1ad1;p=packages%2Fo%2Fopenafs.git Make namei convertROtoRW'd volumes usable Right now, if you convertROtoRW a volume on namei, the converted volume appears to need a salvage before it is usable, and the header of the old (now empty) RO volume is kept around. Fix this: -- Set inUse = 0 on the converted volume, so the fileserver will be able to attach the volume when we give it back -- Unlink the RO header file, instead of trying to unlink the VI_VOLINFO file twice -- Log the actual error code (errno) in the error message for the last unlink Reviewed-on: http://gerrit.openafs.org/591 Tested-by: Derrick Brashear Reviewed-by: Derrick Brashear (cherry picked from commit 906403c6d770026fd9da606ea468e47ee911f896) Reviewed-on: http://gerrit.openafs.org/613 --- diff --git a/src/vol/namei_ops.c b/src/vol/namei_ops.c index f9f3aff9f..0529eba61 100644 --- a/src/vol/namei_ops.c +++ b/src/vol/namei_ops.c @@ -1509,6 +1509,7 @@ convertVolumeInfo(fdr, fdw, vid) vd.id = vd.parentId; vd.type = RWVOL; vd.dontSalvage = 0; + vd.inUse = 0; vd.uniquifier += 5000; /* just in case there are still file copies from * the old RW volume around */ p = strrchr(vd.name, '.'); @@ -1734,8 +1735,10 @@ namei_ConvertROtoRWvolume(char *pname, afs_int32 volumeId) return EIO; } close(fd); + (void)afs_snprintf(headername, sizeof headername, VFORMAT, afs_printable_uint32_lu(volumeId)); + (void)afs_snprintf(oldpath, sizeof oldpath, "%s/%s", pname, headername); if (unlink(oldpath) < 0) { - Log("1 namei_ConvertROtoRWvolume: Couldn't unlink RO header, error = %d\n", error); + Log("1 namei_ConvertROtoRWvolume: Couldn't unlink RO header, error = %d\n", errno); } FSYNC_askfs(volumeId, pname, FSYNC_DONE, 0); FSYNC_askfs(h.id, pname, FSYNC_ON, 0);