From 0baf0809bb777ffb6be8578f8f4924c5658e6a63 Mon Sep 17 00:00:00 2001 From: Douglas Engert Date: Tue, 20 Mar 2007 19:24:11 +0000 Subject: [PATCH] STABLE14-nfs-gc-fix-20070320 FIXES 56459 avoid issue with nfs gc handler and mismatched types (cherry picked from commit ff81d7e77a4a302224dbb0f0c6b960ded42cafbe) --- src/afs/afs_nfsclnt.c | 11 +++++------ src/venus/kdump.c | 16 ++++++++++------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/afs/afs_nfsclnt.c b/src/afs/afs_nfsclnt.c index a40d835ccd..cc98dde0b5 100644 --- a/src/afs/afs_nfsclnt.c +++ b/src/afs/afs_nfsclnt.c @@ -314,11 +314,10 @@ afs_nfsclient_sysname(register struct nfsclientpag *np, char *inname, #endif AFS_STATCNT(afs_nfsclient_sysname); if (inname) { - if (np->sysname) { for(count=0; count < np->sysnamecount;++count) { afs_osi_Free(np->sysname[count], MAXSYSNAME); + np->sysname[count] = NULL; } - } for(count=0; count < *num;++count) { np->sysname[count]= afs_osi_Alloc(MAXSYSNAME); } @@ -329,8 +328,6 @@ afs_nfsclient_sysname(register struct nfsclientpag *np, char *inname, cp += t+1; } np->sysnamecount = *num; - } else if (!np->sysname) { - return ENODEV; /* XXX */ } *outname = np->sysname; *num = np->sysnamecount; @@ -346,6 +343,7 @@ afs_nfsclient_GC(exporter, pag) { register struct nfsclientpag *np, **tnp, *nnp; register afs_int32 i, delflag; + int count; #if defined(AFS_SGIMP_ENV) osi_Assert(ISAFS_GLOCK()); @@ -361,8 +359,9 @@ afs_nfsclient_GC(exporter, pag) if ((pag == -1) || (!pag && delflag) || (pag && (np->refCount == 0) && (np->pag == pag))) { *tnp = np->next; - if (np->sysname) - afs_osi_Free(np->sysname, MAXSYSNAME); + for(count=0; count < np->sysnamecount;++count) { + afs_osi_Free(np->sysname[count], MAXSYSNAME); + } afs_osi_Free(np, sizeof(struct nfsclientpag)); } else { tnp = &np->next; diff --git a/src/venus/kdump.c b/src/venus/kdump.c index 67c689aafe..33e6372881 100644 --- a/src/venus/kdump.c +++ b/src/venus/kdump.c @@ -2515,15 +2515,19 @@ print_nfsclient(kmem, ep, ptr, pnt) struct nfsclientpag *ep, *ptr; { char sysname[100]; + int count; - if (ep->sysname) { - kread(kmem, (off_t) ep->sysname, sysname, (KDUMP_SIZE_T) 30); - Sum_nfssysnames += MAXSYSNAME; - } if (pnt) - printf("%lx: uid=%d, host=%x, pag=%x, @sys=%s, lastt=%d, ref=%d\n", + printf("%lx: uid=%d, host=%x, pag=%x, lastt=%d, ref=%d count=%d\n", ptr, ep->uid, ep->host, ep->pag, - (ep->sysname ? sysname : "nil"), ep->lastcall, ep->refCount); + ep->lastcall, ep->refCount, ep->sysnamecount); + + for(count = 0; count < ep->sysnamecount; count++){ + kread(kmem, (off_t) ep->sysname[count], sysname, (KDUMP_SIZE_T) 30); + printf(" %lx: @sys[%d]=%s\n", + ep->sysname[count], count, sysname); + Sum_nfssysnames += MAXSYSNAME; + } }