bos: do not assume fs just if dafs bnode is stopped 82/14382/2
authorMark Vitale <mvitale@sinenomine.net>
Tue, 6 Oct 2020 04:02:53 +0000 (00:02 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Mon, 26 Oct 2020 03:22:02 +0000 (23:22 -0400)
If dafs is configured but stopped, 'bos salvage <fs> <vicep>
-forceDAFS' will fail with:

  bos: failed to get instance info for 'fs' (no such entity)
  bos: shutting down 'fs'.
  bos: can't stop 'fs' (no such entity)

This is due to incomplete logic in IsDAFS, introduced with commit
e46f10a0a0a930f318833a8a86b10c19744160c1 'bos: Do not assume DAFS just
if DAFS bnode exists'

Add logic to IsDAFS to work correctly when dafs is configured but
stopped.

Change-Id: I50f8209180536d25e68c0ad6fb826202d8f27ce7
Reviewed-on: https://gerrit.openafs.org/14382
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/bozo/bos.c

index 7bcd20a..251568a 100644 (file)
@@ -1295,13 +1295,22 @@ IsDAFS(struct rx_connection *aconn)
        return 1;
     }
 
-    /* At this point, either we have neither a dafs nor fs bnode running, or
-     * we have an fs bnode running but the dafs bnode is stopped.
-     *
-     * If an fs bnode is running, we are obviously not DAFS. If an fs bnode
-     * is not running and a dafs bnode is not running... it's not certain if
-     * we are DAFS or not DAFS. Just return 0 in that case; it shouldn't much
-     * matter what we return, anyway */
+    /* dafs bnode exists but is not running; keep checking */
+    code = BOZO_GetInstanceInfo(aconn, "fs", &tp, &istatus);
+    if (code) {
+       /* no fs bnode; must be dafs */
+       return 1;
+    }
+    if (istatus.goal) {
+       /* fs bnode is running; we are not dafs at the moment */
+       return 0;
+    }
+
+    /*
+     * At this point, we have both dafs and fs bnodes, but neither is running.
+     * Therefore, it's not possible to say if we are DAFS or not DAFS.  Just
+     * return 0 in that case; it shouldn't much matter what we return, anyway.
+     */
     return 0;
 }