Windows: AFSLocateNameEntry Backup Volume Change
authorJeffrey Altman <jaltman@your-file-system.com>
Thu, 7 Mar 2013 22:39:05 +0000 (17:39 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Mon, 11 Mar 2013 14:03:40 +0000 (07:03 -0700)
When AFSLocateNameEntry() calls AFSBackupEntry() in the name array it is
possible that the DirectoryCB returned belongs to a different VolumeCB.
If so, pCurrentVolume must be updated and reference counts must be
adjusted.

Change-Id: I9fcd30374b20f2e1c214a019feeab55c30ce9666
Reviewed-on: http://gerrit.openafs.org/9465
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsrdr/kernel/lib/AFSNameSupport.cpp

index 8581153..ea7977c 100644 (file)
@@ -688,6 +688,34 @@ AFSLocateNameEntry( IN GUID *AuthGroup,
                                           NULL,
                                           lCount);
                         }
+
+                        if ( pDirEntry->ObjectInformation->VolumeCB != pCurrentVolume)
+                        {
+
+                            lCount = AFSVolumeDecrement( pCurrentVolume,
+                                                         VolumeReferenceReason);
+
+                            AFSDbgLogMsg( AFS_SUBSYSTEM_VOLUME_REF_COUNTING,
+                                          AFS_TRACE_LEVEL_VERBOSE,
+                                          "AFSLocateNameEntry Decrement count on volume %p Reason %u Cnt %d\n",
+                                          pCurrentVolume,
+                                          VolumeReferenceReason,
+                                          lCount);
+
+                            pCurrentVolume = pDirEntry->ObjectInformation->VolumeCB;
+
+                            VolumeReferenceReason = AFS_VOLUME_REFERENCE_LOCATE_NAME;
+
+                            lCount = AFSVolumeIncrement( pCurrentVolume,
+                                                         VolumeReferenceReason);
+
+                            AFSDbgLogMsg( AFS_SUBSYSTEM_VOLUME_REF_COUNTING,
+                                          AFS_TRACE_LEVEL_VERBOSE,
+                                          "AFSLocateNameEntry Increment count on volume %p Reason %u Cnt %d\n",
+                                          pCurrentVolume,
+                                          VolumeReferenceReason,
+                                          lCount);
+                        }
                     }
                     else
                     {
@@ -1452,6 +1480,34 @@ AFSLocateNameEntry( IN GUID *AuthGroup,
                     }
                 }
 
+                if ( pDirEntry->ObjectInformation->VolumeCB != pCurrentVolume)
+                {
+
+                    lCount = AFSVolumeDecrement( pCurrentVolume,
+                                                 VolumeReferenceReason);
+
+                    AFSDbgLogMsg( AFS_SUBSYSTEM_VOLUME_REF_COUNTING,
+                                  AFS_TRACE_LEVEL_VERBOSE,
+                                  "AFSLocateNameEntry Decrement count on volume %p Reason %u Cnt %d\n",
+                                  pCurrentVolume,
+                                  VolumeReferenceReason,
+                                  lCount);
+
+                    pCurrentVolume = pDirEntry->ObjectInformation->VolumeCB;
+
+                    VolumeReferenceReason = AFS_VOLUME_REFERENCE_LOCATE_NAME;
+
+                    lCount = AFSVolumeIncrement( pCurrentVolume,
+                                                 VolumeReferenceReason);
+
+                    AFSDbgLogMsg( AFS_SUBSYSTEM_VOLUME_REF_COUNTING,
+                                  AFS_TRACE_LEVEL_VERBOSE,
+                                  "AFSLocateNameEntry Increment count on volume %p Reason %u Cnt %d\n",
+                                  pCurrentVolume,
+                                  VolumeReferenceReason,
+                                  lCount);
+                }
+
                 uniPathName = uniRemainingPath;
 
                 continue;