From 3669fd56d39075104fc683cd0627e044ac3d32d5 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. Reviewed-on: http://gerrit.openafs.org/6165 Tested-by: BuildBot Reviewed-by: Derrick Brashear (cherry picked from commit f59312c0aee1a5376b29262efc6e6ea71264305a) Change-Id: Ibdd5cb5c475409918cdad1e73e2d7ed4ef57bd13 Reviewed-on: http://gerrit.openafs.org/6321 Reviewed-by: Derrick Brashear Tested-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 2415fb9074..0697e92bbb 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -4016,9 +4016,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