STABLE14-nfs-gc-fix-20070320

FIXES 56459

avoid issue with nfs gc handler and mismatched types


(cherry picked from commit ff81d7e77a4a302224dbb0f0c6b960ded42cafbe)
This commit is contained in:
Douglas Engert 2007-03-20 19:24:11 +00:00 committed by Derrick Brashear
parent cc98ae3917
commit 0baf0809bb
2 changed files with 15 additions and 12 deletions

View File

@ -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;

View File

@ -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;
}
}