DAFS: Avoid useless attach2 error message
authorAndrew Deason <adeason@sinenomine.net>
Mon, 13 May 2013 20:33:42 +0000 (15:33 -0500)
committerDerrick Brashear <shadow@your-file-system.com>
Tue, 21 May 2013 21:27:58 +0000 (14:27 -0700)
Since commit 53230846a202a50f6c3a61b38d62ccba8876f89d, attach2 logs an
error when we force a volume to an error state due to attachment
errors. This is to ensure that we never end up with a volume in an
error state without logging a message about it.

However, while this is useful for the fileserver, for non-fileserver
programs this situation is very common for VNOVOL errors and does not
represent an actual problem. For the fileserver, nonexistent volumes
should be caught before we hit attach2 (in e.g. GetVolume when we
can't find a volume structure), so errors here can be significant and
should be rare. But for e.g. the volserver, when we try to use a given
volume id, we just try to attach it directly, so if the volume doesn't
exist, we will hit this code path.

This can happen pretty often for the volserver, since many volume
operations try to determine if a volume already exists by trying to
attach it. In those cases, this error message is pretty much useless
noise. So, get rid of it if we are non-fileserver, and the error we
got is VNOVOL. It is not as important for non-fileserver that we put a
volume in an error state, since volume states are much more transient
for non-fileserver programs, since the volume structs don't stay
around very long.

Change-Id: Ie2c221af2b55af70d725f0f52dacbb7fd8788349
Reviewed-on: http://gerrit.openafs.org/9907
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

src/vol/volume.c

index 39a3aa1..d6c2d38 100644 (file)
@@ -3518,7 +3518,13 @@ unlocked_error:
 locked_error:
 #ifdef AFS_DEMAND_ATTACH_FS
     if (!VIsErrorState(V_attachState(vp))) {
-       if (VIsErrorState(error_state)) {
+       if (programType != fileServer && *ec == VNOVOL) {
+           /* do not log anything in this case; it is common for
+            * non-fileserver programs to fail here with VNOVOL, since that
+            * is what happens when they simply try to use a volume, but that
+            * volume doesn't exist. */
+
+       } else if (VIsErrorState(error_state)) {
            Log("attach2: forcing vol %" AFS_VOLID_FMT " to error state (state %u flags 0x%x ec %d)\n",
                afs_printable_VolumeId_lu(vp->hashid), V_attachState(vp),
                V_attachFlags(vp), *ec);