From ee798e49f23d7894c92275fc3d69b8b5c3c516a2 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Thu, 9 May 2002 16:56:46 +0000 Subject: [PATCH] viced-cleanup-dirhandle-references-after-ourselves-20020509 doesn't fix any problem that i can find, but results in ihandles not having thousands of bogus references (and may fix problems if refcnt were to wrap) --- src/viced/afsfileprocs.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index e82fdd6fb..751857e1e 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -1795,6 +1795,7 @@ SAFSS_RemoveFile (acall, DirFid, Name, OutDirStatus, Sync) struct in_addr logHostAddr; /* host ip holder for inet_ntoa */ struct rx_connection *tcon = rx_ConnectionOf(acall); + FidZero(&dir); /* Get ptr to client data for user Id for logging */ t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key); logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon)); @@ -1863,6 +1864,7 @@ SAFSS_RemoveFile (acall, DirFid, Name, OutDirStatus, Sync) Bad_RemoveFile: /* Update and store volume/vnode and parent vnodes back */ PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, volptr); + FidZap(&dir); ViceLog(2, ("SAFS_RemoveFile returns %d\n", errorCode)); return errorCode; @@ -1957,6 +1959,8 @@ SAFSS_CreateFile (acall, DirFid, Name, InStatus, OutFid, OutFidStatus, struct in_addr logHostAddr; /* host ip holder for inet_ntoa */ struct rx_connection *tcon = rx_ConnectionOf(acall); + FidZero(&dir); + /* Get ptr to client data for user Id for logging */ t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key); logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon)); @@ -2024,6 +2028,7 @@ SAFSS_CreateFile (acall, DirFid, Name, InStatus, OutFid, OutFidStatus, Bad_CreateFile: /* Update and store volume/vnode and parent vnodes back */ PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, volptr); + FidZap(&dir); ViceLog(2, ("SAFS_CreateFile returns %d\n", errorCode)); return errorCode; @@ -2135,6 +2140,11 @@ SAFSS_Rename (acall, OldDirFid, OldName, NewDirFid, NewName, OutOldDirStatus, struct in_addr logHostAddr; /* host ip holder for inet_ntoa */ struct rx_connection *tcon = rx_ConnectionOf(acall); + FidZero(&olddir); + FidZero(&newdir); + FidZero(&filedir); + FidZero(&newfiledir); + /* Get ptr to client data for user Id for logging */ t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key); logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon)); @@ -2484,6 +2494,10 @@ Bad_Rename: } PutVolumePackage(fileptr, (newvptr && newvptr != oldvptr? newvptr : 0), oldvptr, volptr); + FidZap(&olddir); + FidZap(&newdir); + FidZap(&filedir); + FidZap(&newfiledir); ViceLog(2, ("SAFS_Rename returns %d\n", errorCode)); return errorCode; @@ -2583,6 +2597,8 @@ SAFSS_Symlink (acall, DirFid, Name, LinkContents, InStatus, OutFid, OutFidStatus FdHandle_t *fdP; struct rx_connection *tcon = rx_ConnectionOf(acall); + FidZero(&dir); + /* Get ptr to client data for user Id for logging */ t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key); logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon)); @@ -2674,6 +2690,7 @@ SAFSS_Symlink (acall, DirFid, Name, LinkContents, InStatus, OutFid, OutFidStatus Bad_SymLink: /* Write the all modified vnodes (parent, new files) and volume back */ PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, volptr); + FidZap(&dir); ViceLog(2, ("SAFS_Symlink returns %d\n", errorCode)); return errorCode; @@ -2771,6 +2788,8 @@ SAFSS_Link (acall, DirFid, Name, ExistingFid, OutFidStatus, OutDirStatus, Sync) struct in_addr logHostAddr; /* host ip holder for inet_ntoa */ struct rx_connection *tcon = rx_ConnectionOf(acall); + FidZero(&dir); + /* Get ptr to client data for user Id for logging */ t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key); logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon)); @@ -2875,6 +2894,7 @@ SAFSS_Link (acall, DirFid, Name, ExistingFid, OutFidStatus, OutDirStatus, Sync) Bad_Link: /* Write the all modified vnodes (parent, new files) and volume back */ PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, volptr); + FidZap(&dir); ViceLog(2, ("SAFS_Link returns %d\n", errorCode)); return errorCode; @@ -2975,6 +2995,9 @@ SAFSS_MakeDir (acall, DirFid, Name, InStatus, OutFid, OutFidStatus, struct in_addr logHostAddr; /* host ip holder for inet_ntoa */ struct rx_connection *tcon = rx_ConnectionOf(acall); + FidZero(&dir); + FidZero(&parentdir); + /* Get ptr to client data for user Id for logging */ t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key); logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon)); @@ -3045,7 +3068,7 @@ SAFSS_MakeDir (acall, DirFid, Name, InStatus, OutFid, OutFidStatus, Update_TargetVnodeStatus(targetptr, TVS_MKDIR, client, InStatus, parentptr, volptr, 0); - /* Actually create the New directory in the directory package */ + /* Actually create the New directory in the directory package */ SetDirHandle(&dir, targetptr); assert(!(MakeDir(&dir, OutFid, DirFid))); DFlush(); @@ -3068,6 +3091,8 @@ SAFSS_MakeDir (acall, DirFid, Name, InStatus, OutFid, OutFidStatus, Bad_MakeDir: /* Write the all modified vnodes (parent, new files) and volume back */ PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, volptr); + FidZap(&dir); + FidZap(&parentdir); ViceLog(2, ("SAFS_MakeDir returns %d\n", errorCode)); return errorCode; @@ -3163,6 +3188,8 @@ SAFSS_RemoveDir (acall, DirFid, Name, OutDirStatus, Sync) struct in_addr logHostAddr; /* host ip holder for inet_ntoa */ struct rx_connection *tcon = rx_ConnectionOf(acall); + FidZero(&dir); + /* Get ptr to client data for user Id for logging */ t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key); logHostAddr.s_addr = rx_HostOf(rx_PeerOf(tcon)); @@ -3227,6 +3254,7 @@ SAFSS_RemoveDir (acall, DirFid, Name, OutDirStatus, Sync) Bad_RemoveDir: /* Write the all modified vnodes (parent, new files) and volume back */ PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, volptr); + FidZap(&dir); ViceLog(2, ("SAFS_RemoveDir returns %d\n", errorCode)); return errorCode; @@ -6664,6 +6692,7 @@ int CopyOnWrite(targetptr, volptr) ViceLog(0,("CopyOnWrite failed: volume %u in partition %s (tried reading %u, read %u, wrote %u, errno %u) volume needs salvage\n", V_id(volptr), volptr->partition->name, length, rdlen, wrlen, errno)); + assert(0); /* Decrement this inode so salvager doesn't find it. */ FDH_REALLYCLOSE(newFdP); IH_RELEASE(newH); -- 2.39.5