]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Make namei convertROtoRW'd volumes usable
authorAndrew Deason <adeason@sinenomine.net>
Wed, 7 Oct 2009 17:14:11 +0000 (12:14 -0500)
committerDerrick Brashear <shadow|account-1000005@unknown>
Thu, 8 Oct 2009 20:23:00 +0000 (13:23 -0700)
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 <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 906403c6d770026fd9da606ea468e47ee911f896)
Reviewed-on: http://gerrit.openafs.org/613

src/vol/namei_ops.c

index f9f3aff9fd7bdf33df894faf91ac426b96af5c2f..0529eba6190a74dcfc6a403eb9e7108cf6ffbb12 100644 (file)
@@ -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);