From 0593374e2de0da391ea793e45ca08d6c971d8f86 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Wed, 21 Jan 2009 21:27:42 +0000 Subject: [PATCH] disconnected-pioctl-error-recovery-20090121 LICENSE IPL10 FIXES 124174 make reconnection possible by doing error recovery --- src/afs/afs_pioctl.c | 4 +++- src/afs/afs_prototypes.h | 2 +- src/afs/afs_server.c | 21 ++++++++++++++++++--- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index 2e469d384..4453dd2c0 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -4685,12 +4685,14 @@ DECL_PIOCTL(PDiscon) ObtainWriteLock(&afs_discon_lock, 998); afs_in_sync = 1; + afs_MarkAllServersUp(); code = afs_ResyncDisconFiles(areq, *acred); afs_in_sync = 0; if (code && !force) { printf("Files not synchronized properly, still in discon state. \n" "Please retry or use \"force\".\n"); + mode = 0; } else { if (force) { afs_DisconDiscardAll(*acred); @@ -4711,7 +4713,7 @@ DECL_PIOCTL(PDiscon) memcpy(aout, &mode, sizeof(afs_int32)); *aoutSize = sizeof(afs_int32); - return 0; + return code; #else return EINVAL; #endif diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index 2b5d1d4b6..07587711e 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -830,7 +830,7 @@ void afsi_SetServerIPRank(struct srvAddr *sa, struct in_ifaddr *ifa); extern int afs_HaveCallBacksFrom(struct server *aserver); extern void shutdown_server(void); extern void afs_RemoveAllConns(void); - +extern void afs_MarkAllServersUp(void); /* afs_osidnlc.c */ extern int osi_dnlc_enter(struct vcache *adp, char *aname, struct vcache *avc, diff --git a/src/afs/afs_server.c b/src/afs/afs_server.c index b2ed3efcb..463812935 100644 --- a/src/afs/afs_server.c +++ b/src/afs/afs_server.c @@ -1852,8 +1852,6 @@ void afs_ActivateServer(struct srvAddr *sap) { } } -#ifdef AFS_DISCON_ENV - void afs_RemoveAllConns() { int i; @@ -1891,7 +1889,24 @@ void afs_RemoveAllConns() } -#endif /* AFS_DISCON_ENV */ +void afs_MarkAllServersUp() +{ + int i; + struct server *ts; + struct srvAddr *sa; + + ObtainWriteLock(&afs_xserver, 721); + ObtainWriteLock(&afs_xsrvAddr, 722); + for (i = 0; i< NSERVERS; i++) { + for (ts = afs_servers[i]; ts; ts = ts->next) { + for (sa = ts->addr; sa; sa = sa->next_sa) { + afs_MarkServerUpOrDown(sa, 0); + } + } + } + ReleaseWriteLock(&afs_xsrvAddr); + ReleaseWriteLock(&afs_xserver); +} void shutdown_server() { -- 2.39.5