]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE12-viced-cleanup-dirhandle-references-after-ourselves-20020509
authorDerrick Brashear <shadow@dementia.org>
Sat, 8 Jun 2002 01:16:09 +0000 (01:16 +0000)
committerDerrick Brashear <shadow@dementia.org>
Sat, 8 Jun 2002 01:16:09 +0000 (01:16 +0000)
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)

(cherry picked from commit ee798e49f23d7894c92275fc3d69b8b5c3c516a2)

src/viced/afsfileprocs.c

index ed9b7299f64677556eacba117044f396161ed04b..e35d7aba4258312125165949aa45ef9cf672b6c1 100644 (file)
@@ -1715,6 +1715,7 @@ SAFSS_RemoveFile (tcon, DirFid, Name, OutDirStatus, Sync)
     struct client *t_client;            /* tmp ptr to client data */
     struct in_addr logHostAddr;                /* host ip holder for inet_ntoa */
 
+    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));
@@ -1783,6 +1784,7 @@ SAFSS_RemoveFile (tcon, 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;
 
@@ -1877,6 +1879,8 @@ SAFSS_CreateFile (tcon, DirFid, Name, InStatus, OutFid, OutFidStatus,
     struct client *t_client;            /* tmp ptr to client data */
     struct in_addr logHostAddr;                /* host ip holder for inet_ntoa */
 
+    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));
@@ -1944,6 +1948,7 @@ SAFSS_CreateFile (tcon, 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;
 
@@ -2055,6 +2060,11 @@ SAFSS_Rename (tcon, OldDirFid, OldName, NewDirFid, NewName, OutOldDirStatus,
     struct client *t_client;            /* tmp ptr to client data */
     struct in_addr logHostAddr;                /* host ip holder for inet_ntoa */
 
+    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));
@@ -2404,6 +2414,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;
 
@@ -2503,6 +2517,8 @@ SAFSS_Symlink (tcon, DirFid, Name, LinkContents, InStatus, OutFid, OutFidStatus,
     struct in_addr logHostAddr;                /* host ip holder for inet_ntoa */
     FdHandle_t *fdP;
 
+    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));
@@ -2594,6 +2610,7 @@ SAFSS_Symlink (tcon, 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;
 
@@ -2690,6 +2707,8 @@ SAFSS_Link (tcon, DirFid, Name, ExistingFid, OutFidStatus, OutDirStatus, Sync)
     struct client *t_client;            /* tmp ptr to client data */
     struct in_addr logHostAddr;                /* host ip holder for inet_ntoa */
 
+    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));
@@ -2794,6 +2813,7 @@ SAFSS_Link (tcon, 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;
 
@@ -2894,6 +2914,9 @@ SAFSS_MakeDir (tcon, DirFid, Name, InStatus, OutFid, OutFidStatus,
     struct client *t_client;            /* tmp ptr to client data */
     struct in_addr logHostAddr;                /* host ip holder for inet_ntoa */
 
+    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));
@@ -2964,7 +2987,7 @@ SAFSS_MakeDir (tcon, 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();
@@ -2987,6 +3010,8 @@ SAFSS_MakeDir (tcon, 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;
 
@@ -3082,6 +3107,8 @@ SAFSS_RemoveDir (tcon, DirFid, Name, OutDirStatus, Sync)
     struct client *t_client;            /* tmp ptr to client data */
     struct in_addr logHostAddr;                /* host ip holder for inet_ntoa */
 
+    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));
@@ -3146,6 +3173,7 @@ SAFSS_RemoveDir (tcon, 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;
 
@@ -6572,6 +6600,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);