/*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
- *
+ *
* This software has been released under the terms of the IBM Public
* License. For details, see the LICENSE file in the top-level source
* directory or online at http://www.openafs.org/dl/license10.html
#include <afsconfig.h>
#include <afs/param.h>
-
-#include <sys/types.h>
-#include <stdio.h>
-#ifdef AFS_NT40_ENV
-#include <winsock2.h>
-#include <time.h>
-#else
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <sys/time.h>
-#endif
-#include <errno.h>
-#ifdef AFS_PTHREAD_ENV
-#include <assert.h>
-#else /* AFS_PTHREAD_ENV */
-#include <afs/assert.h>
-#endif /* AFS_PTHREAD_ENV */
-#include <signal.h>
-#include <string.h>
+#include <roken.h>
#include <rx/xdr.h>
#include <afs/afsint.h>
-#include "nfs.h"
#include <afs/errors.h>
+#include <afs/afssyscalls.h>
+
+#include "nfs.h"
#include "daemon_com.h"
#include "fssync.h"
#include "lwp.h"
#include "lock.h"
-#include <afs/afssyscalls.h>
#include "ihandle.h"
#include "vnode.h"
#include "volume.h"
#include "partition.h"
+#include "common.h"
#ifdef FSSYNC_BUILD_CLIENT
-/*@printflike@*/ extern void Log(const char *format, ...);
-
extern int LogLevel;
-static SYNC_client_state fssync_state =
+static SYNC_client_state fssync_state =
{ -1, /* file descriptor */
FSSYNC_ENDPOINT_DECL, /* server endpoint */
FSYNC_PROTO_VERSION, /* protocol version */
#ifdef AFS_PTHREAD_ENV
static pthread_mutex_t vol_fsync_mutex;
static volatile int vol_fsync_mutex_init = 0;
-#define VFSYNC_LOCK \
- assert(pthread_mutex_lock(&vol_fsync_mutex) == 0)
-#define VFSYNC_UNLOCK \
- assert(pthread_mutex_unlock(&vol_fsync_mutex) == 0)
+#define VFSYNC_LOCK MUTEX_ENTER(&vol_fsync_mutex)
+#define VFSYNC_UNLOCK MUTEX_EXIT(&vol_fsync_mutex)
#else
#define VFSYNC_LOCK
#define VFSYNC_UNLOCK
#ifdef AFS_PTHREAD_ENV
/* this is safe since it gets called with VOL_LOCK held, or before we go multithreaded */
if (!vol_fsync_mutex_init) {
- assert(pthread_mutex_init(&vol_fsync_mutex, NULL) == 0);
+ MUTEX_INIT(&vol_fsync_mutex, "vol fsync", MUTEX_DEFAULT, 0);
vol_fsync_mutex_init = 1;
}
#endif
break;
case SYNC_COM_ERROR:
case SYNC_BAD_COMMAND:
- Log("FSYNC_askfs: fatal FSSYNC protocol error; volume management functionality disabled until next fileserver restart\n");
+ Log("FSYNC_askfs: internal FSSYNC protocol error %d\n", code);
break;
case SYNC_DENIED:
Log("FSYNC_askfs: FSSYNC request denied for reason=%d\n", res->hdr.reason);
}
afs_int32
-FSYNC_VolOp(VolumeId volume, char * partition,
+FSYNC_VolOp(VolumeId volume, char * partition,
int command, int reason,
SYNC_response * res)
{
return SYNC_DENIED;
}
- if (res.hdr.reason == FSYNC_UNKNOWN_VOLID) {
- /* if the fileserver does not know about this volume, there's no
- * way it could have attached it, so we're fine */
+ if (res.hdr.reason == FSYNC_UNKNOWN_VOLID ||
+ res.hdr.reason == FSYNC_WRONG_PART) {
+ /* if the fileserver does not know about this volume on this
+ * partition, there's no way it could have attached it, so we're
+ * fine */
return SYNC_OK;
}