]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
vol: Fix VCreateVolume special inode cleanup
authorAndrew Deason <adeason@sinenomine.net>
Wed, 11 Jan 2012 15:00:35 +0000 (10:00 -0500)
committerDerrick Brashear <shadow@dementix.org>
Mon, 16 Jan 2012 05:16:59 +0000 (21:16 -0800)
In order to dec the relevant special inodes, we need to know the
parent vol id in addition to the vol id itself. Use the appropriate
volume IDs when IH_DEC'ing special inodes after we fail to create the
volume, so we don't leave behind special inodes.

(cherry picked from commit 627cfb1d4e7b32b4342c59b162a36ba9beb8a066)
Reviewed-on: http://gerrit.openafs.org/6529
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Change-Id: I9f40f170cd6a0fffe2e17fc199af99e087066902
Reviewed-on: http://gerrit.openafs.org/6550
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
src/vol/vutil.c

index 6f7f7ce137d67c6d289d2647360388a69fbdfbce..acda92a319428bfa4eb0d1d6d737b03d077404cb 100644 (file)
@@ -91,7 +91,7 @@
 
 #ifdef FSSYNC_BUILD_CLIENT
 static void
-RemoveInodes(Device dev, VolumeId vid)
+RemoveInodes(Device dev, VolumeId parent, VolumeId vid)
 {
     int i;
     IHandle_t *handle;
@@ -99,11 +99,16 @@ RemoveInodes(Device dev, VolumeId vid)
     /* This relies on the fact that IDEC only needs the device and NT only
      * needs the dev and vid to decrement volume special files.
      */
-    IH_INIT(handle, dev, vid, -1);
+    IH_INIT(handle, dev, parent, -1);
     for (i = 0; i < nFILES; i++) {
        Inode inode = *stuff[i].inode;
-       if (VALID_INO(inode))
-           IH_DEC(handle, inode, vid);
+       if (VALID_INO(inode)) {
+           if (stuff[i].inodeType == VI_LINKTABLE) {
+               IH_DEC(handle, inode, parent);
+           } else {
+               IH_DEC(handle, inode, vid);
+           }
+       }
     }
     IH_RELEASE(handle);
 }
@@ -256,7 +261,7 @@ VCreateVolume_r(Error * ec, char *partname, VolId volumeId, VolId parentId)
          bad:
            if (handle)
                IH_RELEASE(handle);
-           RemoveInodes(device, vol.id);
+           RemoveInodes(device, vol.parentId, vol.id);
            if (!*ec) {
                *ec = VNOVOL;
            }