From: Andrew Deason Date: Tue, 20 Jul 2010 17:32:10 +0000 (-0500) Subject: bos: Do not assume DAFS just if DAFS bnode exists X-Git-Tag: openafs-devel-1_5_76~83 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=e46f10a0a0a930f318833a8a86b10c19744160c1;p=packages%2Fo%2Fopenafs.git bos: Do not assume DAFS just if DAFS bnode exists For salvaging purposes, we were assuming that if a DAFS bnode existed, we should perform a DAFS salvage. Since it is possible to have a disabled DAFS bnode alongside an enabled non-DAFS fs bnode, we should perform a regular non-DAFS salvage if the DAFS bnode is disabled. Do that. Change-Id: If4e6fa3b733e2e9684cd9942be56368d60bf6dee Reviewed-on: http://gerrit.openafs.org/2453 Tested-by: Andrew Deason Reviewed-by: Derrick Brashear --- diff --git a/src/bozo/bos.c b/src/bozo/bos.c index e8a82bd3c..2d156fc98 100644 --- a/src/bozo/bos.c +++ b/src/bozo/bos.c @@ -1413,6 +1413,36 @@ GetLogCmd(register struct cmd_syndesc *as, void *arock) return code; } +static int +IsDAFS(struct rx_connection *aconn) +{ + char buffer[BOZO_BSSIZE]; + char *tp; + struct bozo_status istatus; + afs_int32 code; + + tp = &buffer[0]; + + code = BOZO_GetInstanceInfo(aconn, "dafs", &tp, &istatus); + if (code) { + /* no dafs bnode; cannot be dafs */ + return 0; + } + if (istatus.goal) { + /* dafs bnode is running; we must be dafs */ + 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 */ + return 0; +} + static int SalvageCmd(struct cmd_syndesc *as, void *arock) { @@ -1438,7 +1468,7 @@ SalvageCmd(struct cmd_syndesc *as, void *arock) tp = &tname[0]; /* find out whether fileserver is running demand attach fs */ - if ((code = BOZO_GetInstanceParm(tconn, "dafs", 0, &tp) == 0)) { + if (IsDAFS(tconn)) { dafs = 1; serviceName = "dafs"; /* Find out whether fileserver is running MR-AFS (has a scanner instance) */