Dec old special inodes in inode convertROtoRW
authorAndrew Deason <adeason@sinenomine.net>
Mon, 26 Oct 2009 19:04:48 +0000 (14:04 -0500)
committerDerrick Brashear <shadow|account-1000005@unknown>
Mon, 26 Oct 2009 20:00:58 +0000 (13:00 -0700)
The convertROtoRW code for the inode fileserver makes copies of the
volume's special inodes, but leaves the old (RO) inodes around. If the
RO is created again, this will result in duplicate special inodes for
the same volume, which freaks out the salvager (and possibly other
things).

So IH_DEC the old RO special inodes after converting, so they go away.

Change-Id: Ifefa2cb69c5b2960b81dbee9d54e5ea8401b240e
Reviewed-on: http://gerrit.openafs.org/735
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/vol/listinodes.c

index 9cbaaa2..54ff779 100644 (file)
@@ -1531,6 +1531,14 @@ inode_ConvertROtoRWvolume(char *pname, afs_uint32 volumeId)
                
            FDH_CLOSE(fdP);
            FDH_CLOSE(fdP2);
+
+           /* Unlink the old special inode; otherwise we will get duplicate
+            * special inodes if we recreate the RO again */
+           if (IH_DEC(ih, specinos[j].inodeNumber, volumeId) == -1) {
+               Log("IH_DEC failed: %x, %s, %u errno %d\n", ih,
+                   PrintInode(NULL, specinos[j].inodeNumber), volumeId, errno);
+           }
+
            IH_RELEASE(ih);
            IH_RELEASE(ih2);
        }