]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
afs: Move SetupVolume tv initialization after loop
authorAndrew Deason <adeason@sinenomine.net>
Fri, 8 Feb 2013 23:26:32 +0000 (17:26 -0600)
committerStephan Wiesand <stephan.wiesand@desy.de>
Tue, 20 Aug 2013 19:48:21 +0000 (12:48 -0700)
The fields in tv are not used by the loop looking for the given volume
on disk. If we wait until after that loop to initialize the fields in
tv, it is easier to handle errors encountered in the loop.

This should incur no functional change.

Reviewed-on: http://gerrit.openafs.org/9093
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit 8f95dc9eb92cb31f9d29eb87daac747f53b5a1cc)

Change-Id: I65f3b647017aebacf28026a648c75b2d279c768e
Reviewed-on: http://gerrit.openafs.org/9130
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/afs/afs_volume.c

index df0e64fd1e76a6d54651a355694e62b8687a4f75..2d9babbd2049882e236beee1da6d2d41e9d81bf1 100644 (file)
@@ -586,12 +586,8 @@ afs_SetupVolume(afs_int32 volid, char *aname, void *ve, struct cell *tcell,
            return NULL;
        }
        memset(tv, 0, sizeof(struct volume));
-       tv->cell = tcell->cellNum;
-       AFS_RWLOCK_INIT(&tv->lock, "volume lock");
-       tv->next = afs_volumes[i];      /* thread into list */
-       afs_volumes[i] = tv;
-       tv->volume = volid;
-       for (j = fvTable[FVHash(tv->cell, volid)]; j != 0; j = tf->next) {
+
+       for (j = fvTable[FVHash(tcell->cellNum, volid)]; j != 0; j = tf->next) {
            if (afs_FVIndex != j) {
                struct osi_file *tfile;
                tfile = osi_UFSOpen(&volumeInode);
@@ -604,9 +600,16 @@ afs_SetupVolume(afs_int32 volid, char *aname, void *ve, struct cell *tcell,
                afs_FVIndex = j;
            }
            tf = &staticFVolume;
-           if (tf->cell == tv->cell && tf->volume == volid)
+           if (tf->cell == tcell->cellNum && tf->volume == volid)
                break;
        }
+
+       tv->cell = tcell->cellNum;
+       AFS_RWLOCK_INIT(&tv->lock, "volume lock");
+       tv->next = afs_volumes[i];      /* thread into list */
+       afs_volumes[i] = tv;
+       tv->volume = volid;
+
        if (tf && (j != 0)) {
            tv->vtix = afs_FVIndex;
            tv->mtpoint = tf->mtpoint;