Demand-Attach: Remove dangerous trailing else
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Sun, 25 Apr 2010 19:14:02 +0000 (20:14 +0100)
committerDerrick Brashear <shadow@dementia.org>
Mon, 17 May 2010 12:37:22 +0000 (05:37 -0700)
commit44da0b32ee192017a080e26037e4f4b18e90717c
tree4670ae676ac534244f181c67e517b592b95f4fa3
parentcea3bf909ab4b0807ef9f7d93235b4daeb1290dc
Demand-Attach: Remove dangerous trailing else

Change 9aa09f5e634db8a8b2dedf3a749f2a90ef206e2f introduced a
dangerous trailing else into the VScheduleSalvage_r function:

 #ifdef A
    if (foo) {
      ...
    } else
 #endif
 #ifdef B
    if (bar) {
      ...
    }
 #endif
    something_else()

In a situation where we have A && !B, then something_else() ends up
only being run when foo is false. Given that something_else() is
VOL_LOCK, this will not end well.

In the real world, we hit this problen when we build the volume
package with SALVSYNC_BUILD_CLIENT and !FSYNC_BUILD_CLIENT - in
other words, whilst building the fileserver.

Change-Id: I97e07a6e730df8ac480d295b4cf30b0695ace511
Reviewed-on: http://gerrit.openafs.org/1832
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
src/vol/volume.c