From f59312c0aee1a5376b29262efc6e6ea71264305a Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Wed, 30 Nov 2011 17:08:57 -0600 Subject: [PATCH] DAFS: Ensure GetVolume errors on ERROR volumes In GetVolume, after we call VAttachVolumeByVp_r, there is no explicit check to see if vp is in VOL_STATE_ERROR state. Make sure we don't try to use such a volume, or blindly transition the volume away from that state. Change-Id: Ib2c975ac215eeff28b4ff5f5bb0a387298d7aab9 Reviewed-on: http://gerrit.openafs.org/6165 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/vol/volume.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/vol/volume.c b/src/vol/volume.c index 1069edc100..0a32c81a33 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -4085,9 +4085,17 @@ GetVolume(Error * ec, Error * client_ec, VolId volumeId, Volume * hint, vp = NULL; break; } -#endif -#ifdef AFS_DEMAND_ATTACH_FS + if (VIsErrorState(V_attachState(vp))) { + /* make sure we don't take a vp in VOL_STATE_ERROR state and use + * it, or transition it out of that state */ + if (!*ec) { + *ec = VNOVOL; + } + vp = NULL; + break; + } + /* * this test MUST happen after VAttachVolymeByVp, so vol_op_state is * not VolOpRunningUnknown (attach2 would have converted it to Online