Windows: Report actual volume creation time
authorJeffrey Altman <jaltman@your-file-system.com>
Mon, 11 Mar 2013 04:03:38 +0000 (00:03 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Tue, 12 Mar 2013 00:39:46 +0000 (17:39 -0700)
The cm_scache.volumeCreationDate is populated by any non-bulkstat
callback issuing operation.  If it is not set at the time the
redirector requests volume information, force an RXAFS_FetchStatus
and then use the resulting timestamp in the response.

Change-Id: I8ab471767dd6525efc71deff073d54ae38f1f462
Reviewed-on: http://gerrit.openafs.org/9554
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsrdr/user/RDRFunction.c

index e58163f..3503154 100644 (file)
@@ -5690,6 +5690,7 @@ RDR_GetVolumeInfo( IN cm_user_t     *userp,
     cm_req_t    req;
     DWORD       status;
     FILETIME ft = {0x832cf000, 0x01abfcc4}; /* October 1, 1982 00:00:00 +0600 */
+    afs_uint32  flags;
 
     char volName[32]="(unknown)";
     char offLineMsg[256]="server temporarily inaccessible";
@@ -5773,8 +5774,6 @@ RDR_GetVolumeInfo( IN cm_user_t     *userp,
         if ( pResultCB->CellLength )
             pResultCB->CellLength--;
     } else {
-        memcpy(&pResultCB->VolumeCreationTime, &ft, sizeof(ft));
-
         volp = cm_GetVolumeByFID(&scp->fid);
         if (!volp) {
             code = CM_ERROR_NOSUCHVOLUME;
@@ -5785,8 +5784,10 @@ RDR_GetVolumeInfo( IN cm_user_t     *userp,
         if (volType == ROVOL || volType == BACKVOL)
             pResultCB->FileSystemAttributes |= FILE_READ_ONLY_VOLUME;
 
-        code = cm_SyncOp(scp, NULL, userp, &req, PRSFS_READ,
-                         CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
+        flags = CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS;
+        if (scp->volumeCreationDate == 0)
+            flags |= CM_SCACHESYNC_FORCECB;
+        code = cm_SyncOp(scp, NULL, userp, &req, PRSFS_READ, flags);
         if (code == 0)
         {
             sync_done = 1;
@@ -5810,6 +5811,10 @@ RDR_GetVolumeInfo( IN cm_user_t     *userp,
             code = cm_MapRPCError(code, &req);
         }
 
+        if ( scp->volumeCreationDate )
+            cm_LargeSearchTimeFromUnixTime(&ft, scp->volumeCreationDate);
+        memcpy(&pResultCB->VolumeCreationTime, &ft, sizeof(ft));
+
         if (code == 0) {
             if (volType == ROVOL || volType == BACKVOL) {
                 pResultCB->TotalAllocationUnits.QuadPart = volStat.BlocksInUse;