2 * Copyright 2006, Sine Nomine Associates and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
12 * fileserver state serialization
15 #include <afsconfig.h>
16 #include <afs/param.h>
21 #include <stdlib.h> /* for malloc() */
22 #include <time.h> /* ANSI standard location for time stuff */
34 #include <afs/afs_assert.h>
39 #include <afs/afsint.h>
40 #include <afs/rxgen_consts.h>
42 #include <afs/errors.h>
43 #include <afs/ihandle.h>
44 #include <afs/vnode.h>
45 #include <afs/volume.h>
47 #include <afs/ptclient.h>
48 #include <afs/prs_fs.h>
49 #include <afs/afsutil.h>
51 #include <afs/cellconfig.h>
54 #include "../viced/viced_prototypes.h"
55 #include "../viced/viced.h"
56 #include "../viced/host.h"
57 #include "../viced/callback.h"
58 #include "serialize_state.h"
60 #ifdef AFS_DEMAND_ATTACH_FS
66 * in order to make state dump/restore as fast as possible,
67 * we use memory mapped files
69 * if this causes problems on certain platforms, the APIs
70 * have been written so that it will be very simple to go
71 * back to standard I/O for just those poorly written platforms
74 #define FS_STATE_USE_MMAP 1
77 #ifdef FS_STATE_USE_MMAP
78 #define FS_STATE_INIT_FILESIZE (8 * 1024 * 1024) /* truncate to 8MB initially */
84 static int fs_stateCreateDump(struct fs_dump_state * state);
85 static int fs_stateLoadDump(struct fs_dump_state * state);
86 static int fs_stateInvalidateDump(struct fs_dump_state * state);
87 static int fs_stateCommitDump(struct fs_dump_state * state);
88 static int fs_stateCloseDump(struct fs_dump_state * state);
90 #ifdef FS_STATE_USE_MMAP
91 static int fs_stateSizeFile(struct fs_dump_state * state);
92 static int fs_stateResizeFile(struct fs_dump_state * state, size_t min_add);
93 static int fs_stateTruncateFile(struct fs_dump_state * state);
95 static int fs_stateMapFile(struct fs_dump_state * state);
96 static int fs_stateUnmapFile(struct fs_dump_state * state);
98 static int fs_stateIncCursor(struct fs_dump_state * state, size_t len);
99 static int fs_stateCheckIOSafety(struct fs_dump_state * state,
103 static int fs_stateFillHeader(struct fs_state_header * hdr);
104 static int fs_stateCheckHeader(struct fs_state_header * hdr);
106 static int fs_stateAlloc(struct fs_dump_state * state);
107 static int fs_stateFree(struct fs_dump_state * state);
109 extern afsUUID FS_HostUUID;
110 extern char cml_version_number[];
113 fs_stateFileOpen(struct fs_dump_state *state)
116 return(state->fd != -1);
118 return(state->fd >= 0);
125 * save all fileserver state
130 int ret = 0, verified = 1;
131 struct fs_dump_state state;
133 /* save and restore need to be atomic wrt other host package operations */
136 ViceLog(0, ("fs_stateSave: commencing fileserver state dump\n"));
138 if (fs_stateAlloc(&state)) {
139 ViceLog(0, ("fs_stateSave: memory allocation failed; dump aborted\n"));
145 * on busy servers, these checks will inevitably fail since stuff drops H_LOCK
146 * all over the place (with structs left in inconsistent states) while RPCs to
147 * clients happen (grumble, grumble, the host package needs to be rewritten...)
149 * the current hack is to force the background threads that deal with host and
150 * callback state offline early in the shutdown process, do VShutdown, come
151 * back and wait for those threads to die, THEN do the state dump
153 * BUT, this still has one flaw -- what do we do about rx worker threads that
154 * are blocked in the host package making an RPC call to a cm???
156 * perhaps we need a refcounter that keeps track of threads blocked in rpc calls
157 * with H_LOCK dropped (and the host struct likely left in an inconsistent state)
159 * or better yet, we need to associate a state machine with each host object
160 * (kind of like demand attach Volume structures).
162 * sigh. I suspect we'll need to revisit this issue
165 if (fs_state.options.fs_state_verify_before_save) {
166 ViceLog(0, ("fs_stateSave: performing internal consistency checks before proceeding with state dump\n"));
168 if (h_stateVerify(&state)) {
169 ViceLog(0, ("fs_stateSave: error: host table consistency checks failed; state dump will not be marked clean\n"));
174 if (cb_stateVerify(&state)) {
175 ViceLog(0, ("fs_stateSave: error: callback table consistency checks failed; state dump will not be marked clean\n"));
180 /* if a consistency check asserted the bail flag, reset it */
183 ViceLog(0, ("fs_stateSave: proceeding with dump\n"));
186 if (fs_stateCreateDump(&state)) {
187 ViceLog(0, ("fs_stateSave: error: dump create failed\n"));
192 if (h_stateSave(&state)) {
193 ViceLog(0, ("fs_stateSave: error: host state dump failed\n"));
198 if (cb_stateSave(&state)) {
199 ViceLog(0, ("fs_stateSave: error: callback state dump failed\n"));
208 if (fs_stateCommitDump(&state)) {
209 ViceLog(0, ("fs_stateSave: error: dump commit failed\n"));
215 ViceLog(0, ("fs_stateSave: fileserver state dump completed successfully\n"));
217 ViceLog(0, ("fs_stateSave: fileserver state dump completed, but not marked clean.\n"));
218 ViceLog(0, ("fs_stateSave: please save a copy of '%s' for use by technical support\n",
223 if (fs_stateFileOpen(&state))
224 fs_stateCloseDump(&state);
225 fs_stateFree(&state);
232 * restore all fileserver state
234 * this function must appear as one atomic operation to the host and callback
235 * packages, hence H_LOCK is held for the entirety of the process.
238 fs_stateRestore(void)
241 struct fs_dump_state state;
243 /* save and restore need to be atomic wrt other host package operations */
246 ViceLog(0, ("fs_stateRestore: commencing fileserver state restore\n"));
248 if (fs_stateAlloc(&state)) {
249 ViceLog(0, ("fs_stateRestore: memory allocation failed\n"));
254 if (fs_stateLoadDump(&state)) {
255 ViceLog(0, ("fs_stateRestore: failed to load dump file '%s'\n", state.fn));
260 if (fs_stateInvalidateDump(&state)) {
261 ViceLog(0, ("fs_stateRestore: failed to invalidate dump file '%s'\n", state.fn));
267 if (state.flags.do_host_restore) {
268 if (h_stateRestore(&state)) {
269 ViceLog(0, ("fs_stateRestore: error: host state restore failed. exiting avoid further corruption\n"));
272 ViceLog(0, ("fs_stateRestore: host table restored\n"));
274 if (cb_stateRestore(&state)) {
275 ViceLog(0, ("fs_stateRestore: error: callback state restore failed. exiting to avoid further corruption\n"));
278 ViceLog(0, ("fs_stateRestore: FileEntry and CallBack tables restored\n"));
280 if (h_stateRestoreIndices(&state)) {
281 ViceLog(0, ("fs_stateRestore: error: host index remapping failed. exiting to avoid further corruption\n"));
284 ViceLog(0, ("fs_stateRestore: host table indices remapped\n"));
286 if (cb_stateRestoreIndices(&state)) {
287 ViceLog(0, ("fs_stateRestore: error: callback index remapping failed. exiting to avoid further corruption\n"));
290 ViceLog(0, ("fs_stateRestore: FileEntry and CallBack indices remapped\n"));
293 ViceLog(0, ("fs_stateRestore: restore phase complete\n"));
295 if (fs_state.options.fs_state_verify_after_restore) {
296 ViceLog(0, ("fs_stateRestore: beginning state verification phase\n"));
298 if (state.flags.do_host_restore) {
299 if (h_stateVerify(&state)) {
300 ViceLog(0, ("fs_stateRestore: error: host table consistency checks failed; exiting to avoid further corruption\n"));
304 if (cb_stateVerify(&state)) {
305 ViceLog(0, ("fs_stateRestore: error: callback table consistency checks failed; exiting to avoid further corruption\n"));
310 ViceLog(0, ("fs_stateRestore: fileserver state verification complete\n"));
313 ViceLog(0, ("fs_stateRestore: restore was successful\n"));
317 fs_stateInvalidateDump(&state);
318 fs_stateCloseDump(&state);
320 fs_stateFree(&state);
326 fs_stateCreateDump(struct fs_dump_state * state)
329 char savedump[MAXPATHLEN];
330 struct afs_stat status;
332 snprintf(savedump, sizeof(savedump), "%s.old", state->fn);
334 if (afs_stat(state->fn, &status) == 0) {
335 renamefile(state->fn, savedump);
338 if (((fd = afs_open(state->fn,
339 O_RDWR | O_CREAT | O_TRUNC,
340 S_IRUSR | S_IWUSR)) == -1) ||
341 (afs_fstat(fd, &status) == -1)) {
342 ViceLog(0, ("fs_stateCreateDump: failed to create state dump file '%s'\n",
349 state->mode = FS_STATE_DUMP_MODE;
350 memset(state->hdr, 0, sizeof(struct fs_state_header));
351 fs_stateIncEOF(state, sizeof(struct fs_state_header));
353 #ifdef FS_STATE_USE_MMAP
354 if (fs_stateSizeFile(state)) {
355 ViceLog(0, ("fs_stateCreateDump: failed to resize state dump file '%s'\n",
361 if (fs_stateMapFile(state)) {
362 ViceLog(0, ("fs_stateCreateDump: failed to memory map state dump file '%s'\n",
369 ret = fs_stateInvalidateDump(state);
376 fs_stateInvalidateDump(struct fs_dump_state * state)
380 struct fs_state_header hdr;
382 #ifdef FS_STATE_USE_MMAP
383 if (state->mmap.map == NULL) {
388 memcpy(&hdr, state->hdr, sizeof(hdr));
392 /* write a bogus header to flag dump in progress */
393 if (fs_stateWriteHeader(state, &z, &hdr, sizeof(hdr))) {
394 ViceLog(0, ("fs_stateInvalidateDump: failed to invalidate old dump file header '%s'\n",
399 if (fs_stateSync(state)) {
400 ViceLog(0, ("fs_stateInvalidateDump: failed to sync changes to disk\n"));
410 fs_stateCommitDump(struct fs_dump_state * state)
417 #ifdef FS_STATE_USE_MMAP
418 if (fs_stateTruncateFile(state)) {
419 ViceLog(0, ("fs_stateCommitDump: failed to truncate dump file to proper size\n"));
425 /* ensure that all pending data I/Os for the state file have been committed
426 * _before_ we make the metadata I/Os */
427 if (fs_stateSync(state)) {
428 ViceLog(0, ("fs_stateCommitDump: failed to sync changes to disk\n"));
433 #ifdef FS_STATE_USE_MMAP
434 /* XXX madvise may not exist on all platforms, so
435 * we may need to add some ifdefs at some point... */
437 madvise((((char *)state->mmap.map) + sizeof(struct fs_state_header)),
438 state->mmap.size - sizeof(struct fs_state_header),
443 /* build the header, and write it to disk */
444 fs_stateFillHeader(state->hdr);
446 state->hdr->valid = 0;
448 if (fs_stateWriteHeader(state, &z, state->hdr, sizeof(struct fs_state_header))) {
449 ViceLog(0, ("fs_stateCommitDump: failed to write header to dump file '%s'\n",
454 if (fs_stateSync(state)) {
455 ViceLog(0, ("fs_stateCommitDump: failed to sync new header to disk\n"));
465 fs_stateLoadDump(struct fs_dump_state * state)
469 struct afs_stat status;
470 afs_int32 now = FT_ApproxTime();
474 if ((fd = afs_open(state->fn, O_RDWR)) == -1 ||
475 (afs_fstat(fd, &status) == -1)) {
476 ViceLog(0, ("fs_stateLoadDump: failed to load state dump file '%s'\n",
482 state->mode = FS_STATE_LOAD_MODE;
483 state->file_len = status.st_size;
485 #ifdef FS_STATE_USE_MMAP
486 if (fs_stateMapFile(state)) {
487 ViceLog(0, ("fs_stateLoadDump: failed to memory map state dump file '%s'\n",
494 if (fs_stateReadHeader(state, &z, state->hdr, sizeof(struct fs_state_header))) {
495 ViceLog(0, ("fs_stateLoadDump: failed to read header from dump file '%s'\n",
501 /* check the validity of the header */
502 if (fs_stateCheckHeader(state->hdr)) {
503 ViceLog(1, ("fs_stateLoadDump: header failed validity checks; not restoring '%s'\n",
509 if ((state->hdr->timestamp + HOST_STATE_VALID_WINDOW) >= now) {
510 state->flags.do_host_restore = 1;
512 ViceLog(0, ("fs_stateLoadDump: warning: dump is too old for host and callback restore; skipping those steps\n"));
520 fs_stateCloseDump(struct fs_dump_state * state)
522 #ifdef FS_STATE_USE_MMAP
523 fs_stateUnmapFile(state);
530 fs_stateWrite(struct fs_dump_state * state,
531 void * buf, size_t len)
535 #ifdef FS_STATE_USE_MMAP
536 if (fs_stateCheckIOSafety(state, len)) {
537 if (fs_stateResizeFile(state, len)) {
538 ViceLog(0, ("fs_stateWrite: could not resize dump file '%s'\n",
545 memcpy(state->mmap.cursor, buf, len);
546 fs_stateIncCursor(state, len);
548 if (write(state->fd, buf, len) != len) {
549 ViceLog(0, ("fs_stateWrite: write failed\n"));
560 fs_stateRead(struct fs_dump_state * state,
561 void * buf, size_t len)
565 #ifdef FS_STATE_USE_MMAP
566 if (fs_stateCheckIOSafety(state, len)) {
567 ViceLog(0, ("fs_stateRead: read beyond EOF for dump file '%s'\n",
573 memcpy(buf, state->mmap.cursor, len);
574 fs_stateIncCursor(state, len);
576 if (read(state->fd, buf, len) != len) {
577 ViceLog(0, ("fs_stateRead: read failed\n"));
588 fs_stateWriteV(struct fs_dump_state * state,
589 struct iovec * iov, int niov)
594 for (i=0; i < niov; i++) {
595 len += iov[i].iov_len;
598 #ifdef FS_STATE_USE_MMAP
599 if (fs_stateCheckIOSafety(state, len)) {
600 if (fs_stateResizeFile(state, len)) {
601 ViceLog(0, ("fs_stateWrite: could not resize dump file '%s'\n",
608 for (i=0; i < niov; i++) {
609 memcpy(state->mmap.cursor, iov[i].iov_base, iov[i].iov_len);
610 fs_stateIncCursor(state, iov[i].iov_len);
614 if (writev(state->fd, iov, niov) != len) {
615 ViceLog(0, ("fs_stateWriteV: write failed\n"));
619 #else /* AFS_NT40_ENV */
620 for (i=0; i < niov; i++) {
621 if (write(state->fd, iov[i].iov_base, iov[i].iov_len) != iov[i].iov_len) {
622 ViceLog(0, ("fs_stateWriteV: write failed\n"));
627 #endif /* AFS_NT40_ENV */
635 fs_stateReadV(struct fs_dump_state * state,
636 struct iovec * iov, int niov)
641 for (i=0; i < niov; i++) {
642 len += iov[i].iov_len;
645 #ifdef FS_STATE_USE_MMAP
646 if (fs_stateCheckIOSafety(state, len)) {
647 ViceLog(0, ("fs_stateRead: read beyond EOF for dump file '%s'\n",
653 for (i=0; i < niov; i++) {
654 memcpy(iov[i].iov_base, state->mmap.cursor, iov[i].iov_len);
655 fs_stateIncCursor(state, iov[i].iov_len);
659 if (readv(state->fd, iov, niov) != len) {
660 ViceLog(0, ("fs_stateReadV: read failed\n"));
665 for (i=0; i < niov; i++) {
666 if (read(state->fd, iov[i].iov_base, iov[i].iov_len) != iov[i].iov_len) {
667 ViceLog(0, ("fs_stateReadV: read failed\n"));
672 #endif /* AFS_NT40_ENV */
680 fs_stateWriteHeader(struct fs_dump_state * state,
682 void * hdr, size_t len)
686 if (fs_stateSeek(state, offset)) {
687 ViceLog(0, ("fs_stateWriteHeader: could not seek to correct position in dump file '%s'\n",
693 if (fs_stateWrite(state, hdr, len)) {
694 ViceLog(0, ("fs_stateWriteHeader: write failed\n"));
704 fs_stateReadHeader(struct fs_dump_state * state,
706 void * hdr, size_t len)
710 if (fs_stateSeek(state, offset)) {
711 ViceLog(0, ("fs_stateReadHeader: could not seek to correct position in dump file '%s'\n",
717 if (fs_stateRead(state, hdr,len)) {
718 ViceLog(0, ("fs_stateReadHeader: read failed\n"));
727 #ifdef FS_STATE_USE_MMAP
729 fs_stateSizeFile(struct fs_dump_state * state)
732 state->file_len = FS_STATE_INIT_FILESIZE;
733 if (afs_ftruncate(state->fd, state->file_len) != 0)
739 fs_stateResizeFile(struct fs_dump_state * state, size_t min_add)
744 fs_stateUnmapFile(state);
746 inc = ((min_add / FS_STATE_INIT_FILESIZE)+1) * FS_STATE_INIT_FILESIZE;
747 state->file_len += inc;
749 if (afs_ftruncate(state->fd, state->file_len) != 0) {
750 ViceLog(0, ("fs_stateResizeFile: truncate failed\n"));
755 if (fs_stateMapFile(state)) {
756 ViceLog(0, ("fs_stateResizeFile: remapping memory mapped file failed\n"));
766 fs_stateTruncateFile(struct fs_dump_state * state)
770 if (afs_ftruncate(state->fd, state->eof_offset) != 0) {
778 fs_stateMapFile(struct fs_dump_state * state)
782 switch(state->mode) {
783 case FS_STATE_LOAD_MODE:
784 flags = PROT_READ | PROT_WRITE; /* loading involves a header invalidation */
786 case FS_STATE_DUMP_MODE:
790 ViceLog(0, ("fs_stateMapFile: invalid dump state mode\n"));
794 state->mmap.map = afs_mmap(NULL,
801 if (state->mmap.map == MAP_FAILED) {
802 state->mmap.size = 0;
803 state->mmap.map = NULL;
804 ViceLog(0, ("fs_stateMapFile: failed to memory map file '%s'\n",
810 state->mmap.size = state->file_len;
811 state->mmap.cursor = state->mmap.map;
812 state->mmap.offset = 0;
814 /* for state loading, accesses will be sequential, so let's give
815 * the VM subsystem a heads up */
816 if (state->mode == FS_STATE_LOAD_MODE) {
817 /* XXX madvise may not exist on all platforms, so
818 * we may need to add some ifdefs at some point... */
819 flags = MADV_SEQUENTIAL | MADV_WILLNEED;
820 #ifdef AFS_SUN510_ENV
821 flags |= MADV_ACCESS_LWP; /* added in solaris 9 12/02 */
823 madvise(state->mmap.map, state->mmap.size, flags);
831 fs_stateUnmapFile(struct fs_dump_state * state)
835 if (munmap(state->mmap.map, state->mmap.size) == -1) {
836 ViceLog(0, ("fs_stateUnmapFile: failed to unmap dump file '%s'\n",
847 fs_stateSync(struct fs_dump_state * state)
851 msync(state->mmap.map, state->mmap.size, MS_SYNC);
855 #else /* !FS_STATE_USE_MMAP */
857 fs_stateSync(struct fs_dump_state * state)
861 if (fsync(state->fd) == -1)
866 #endif /* !FS_STATE_USE_MMAP */
869 fs_stateIncEOF(struct fs_dump_state * state, afs_int32 len)
872 FillInt64(temp, 0, len);
873 AddUInt64(state->eof_offset, temp, &state->eof_offset);
877 #ifdef FS_STATE_USE_MMAP
879 fs_stateIncCursor(struct fs_dump_state * state, size_t len)
883 state->mmap.offset += len;
885 p = (char *) state->mmap.cursor;
887 state->mmap.cursor = (void *) p;
893 fs_stateCheckIOSafety(struct fs_dump_state * state, size_t len)
897 if ((state->mmap.offset + len) > state->mmap.size) {
902 #endif /* FS_STATE_USE_MMAP */
904 #ifdef FS_STATE_USE_MMAP
906 fs_stateSeek(struct fs_dump_state * state, afs_uint64 * offset)
912 p = (char *) state->mmap.map;
914 state->mmap.cursor = (void *) p;
917 state->mmap.offset = *offset;
921 #else /* !FS_STATE_USE_MMAP */
923 fs_stateSeek(struct fs_dump_state * state, afs_uint64 * offset)
927 if (afs_lseek(state->fd, *offset, SEEK_SET) == -1)
932 #endif /* !FS_STATE_USE_MMAP */
935 fs_stateFillHeader(struct fs_state_header * hdr)
937 hdr->stamp.magic = FS_STATE_MAGIC;
938 hdr->stamp.version = FS_STATE_VERSION;
940 hdr->sys_name = SYS_NAME_ID;
942 hdr->sys_name = 0xFFFFFFFF;
944 hdr->timestamp = FT_ApproxTime();
945 hdr->server_uuid = FS_HostUUID;
947 #ifdef WORDS_BIGENDIAN
952 #ifdef FS_STATS_DETAILED
953 hdr->stats_detailed = 1;
955 hdr->stats_detailed = 0;
957 if (strlcpy(hdr->server_version_string, cml_version_number, sizeof(hdr->server_version_string))
958 >= sizeof(hdr->server_version_string)) {
959 ViceLog(0, ("fs_stateFillHeader: WARNING -- cml_version_number field truncated\n"));
965 fs_stateCheckHeader(struct fs_state_header * hdr)
970 ViceLog(0, ("fs_stateCheckHeader: dump was previously flagged invalid\n"));
973 #ifdef WORDS_BIGENDIAN
974 else if (!hdr->endianness) {
975 ViceLog(0, ("fs_stateCheckHeader: wrong endianness\n"));
978 #else /* AFSLITTLE_ENDIAN */
979 else if (hdr->endianness) {
980 ViceLog(0, ("fs_stateCheckHeader: wrong endianness\n"));
983 #endif /* AFSLITTLE_ENDIAN */
985 else if (hdr->stamp.magic != FS_STATE_MAGIC) {
986 ViceLog(0, ("fs_stateCheckHeader: invalid dump header\n"));
989 else if (hdr->stamp.version != FS_STATE_VERSION) {
990 ViceLog(0, ("fs_stateCheckHeader: unknown dump format version number\n"));
994 #ifdef FS_STATS_DETAILED
995 else if (!hdr->stats_detailed) {
996 ViceLog(0, ("fs_stateCheckHeader: wrong config flags\n"));
999 #else /* FS_STATS_DETAILED */
1000 else if (hdr->stats_detailed) {
1001 ViceLog(0, ("fs_stateCheckHeader: wrong config flags\n"));
1004 #endif /* FS_STATS_DETAILED */
1006 else if (!afs_uuid_equal(&hdr->server_uuid, &FS_HostUUID)) {
1007 ViceLog(0, ("fs_stateCheckHeader: server UUID does not match this server's UUID\n"));
1011 /* the cml_version_string is included for informational purposes only. If someone ever
1012 * wants to limit state dump reloading based upon the contents of this string, just
1013 * uncomment the following code. uncommenting this code is _strongly discouraged_ because
1014 * we already make use of the version stamps in the various dump headers to deal with
1015 * data structure version incompatabilities.
1016 else if (strncmp(hdr->server_version_string, cml_version_number,
1017 sizeof(hdr->server_version_string)) != 0) {
1018 ViceLog(0, ("fs_stateCheckHeader: dump from different server version\n"));
1023 else if (strncmp(hdr->server_version_string, cml_version_number,
1024 sizeof(hdr->server_version_string)) != 0) {
1025 ViceLog(0, ("fs_stateCheckHeader: dump from different server version ; attempting state reload anyway\n"));
1033 fs_stateAlloc(struct fs_dump_state * state)
1036 memset(state, 0, sizeof(struct fs_dump_state));
1038 state->fn = (char *)AFSDIR_SERVER_FSSTATE_FILEPATH;
1039 state->hdr = (struct fs_state_header *)malloc(sizeof(struct fs_state_header));
1040 state->h_hdr = (struct host_state_header *)malloc(sizeof(struct host_state_header));
1041 state->cb_hdr = (struct callback_state_header *)malloc(sizeof(struct callback_state_header));
1042 state->cb_timeout_hdr = (struct callback_state_timeout_header *)
1043 malloc(sizeof(struct callback_state_timeout_header));
1044 state->cb_fehash_hdr = (struct callback_state_fehash_header *)
1045 malloc(sizeof(struct callback_state_fehash_header));
1046 if ((state->hdr == NULL) || (state->h_hdr == NULL) || (state->cb_hdr == NULL) ||
1047 (state->cb_timeout_hdr == NULL) || (state->cb_fehash_hdr == NULL))
1053 fs_stateFree(struct fs_dump_state * state)
1060 free(state->cb_hdr);
1061 if (state->cb_timeout_hdr)
1062 free(state->cb_timeout_hdr);
1063 if (state->cb_fehash_hdr)
1064 free(state->cb_fehash_hdr);
1065 if (state->h_map.entries)
1066 free(state->h_map.entries);
1067 if (state->fe_map.entries)
1068 free(state->fe_map.entries);
1069 if (state->cb_map.entries)
1070 free(state->cb_map.entries);
1074 #endif /* AFS_DEMAND_ATTACH_FS */