Windows: RXAFS_GetVolumeStatus no PRSFS_READ check
authorJeffrey Altman <jaltman@your-file-system.com>
Thu, 5 Dec 2013 05:41:10 +0000 (00:41 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Thu, 5 Dec 2013 17:21:58 +0000 (09:21 -0800)
Since d2d591caf2c9b4cf2ebae708cc9b4c8b78ca5a5a the file server no
longer performs a PRSFS_READ access check for the GetVolumeStatus RPC.
The cache manager should no longer test for PRSFS_READ as a means of
avoiding RPCs that are known to fail.

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

src/WINNT/afsd/cm_ioctl.c
src/WINNT/afsd/cm_volume.c
src/WINNT/afsrdr/user/RDRFunction.c

index 87ce2b1..59c589d 100644 (file)
@@ -781,13 +781,6 @@ cm_IoctlGetVolumeStatus(struct cm_ioctl *ioctlp, struct cm_user *userp, cm_scach
         if (code)
             return code;
 
-        lock_ObtainWrite(&vscp->rw);
-        code = cm_SyncOp(vscp, NULL, userp, reqp, PRSFS_READ,
-                          CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
-        lock_ReleaseWrite(&vscp->rw);
-        if (code)
-            return code;
-
         Name = volName;
         OfflineMsg = offLineMsg;
         MOTD = motd;
@@ -803,9 +796,6 @@ cm_IoctlGetVolumeStatus(struct cm_ioctl *ioctlp, struct cm_user *userp, cm_scach
         } while (cm_Analyze(connp, userp, reqp, &vfid, NULL, 0, NULL, NULL, NULL, NULL, code));
         code = cm_MapRPCError(code, reqp);
 
-        lock_ObtainWrite(&vscp->rw);
-        cm_SyncOpDone(vscp, NULL, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
-        lock_ReleaseWrite(&vscp->rw);
         cm_ReleaseSCache(vscp);
     }
 
index 8eca1ca..1b1a65c 100644 (file)
@@ -1391,37 +1391,27 @@ cm_CheckOfflineVolumeState(cm_volume_t *volp, cm_vol_state_t *statep, afs_uint32
 
                 code = cm_GetSCache(&vfid, NULL, &vscp, cm_rootUserp, &req);
                 if (code = 0) {
-                    lock_ObtainWrite(&vscp->rw);
-                    code = cm_SyncOp(vscp, NULL, cm_rootUserp, &req, PRSFS_READ,
-                                     CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
-                    lock_ReleaseWrite(&vscp->rw);
-                    if (code == 0) {
-                        do {
-                            code = cm_ConnFromVolume(volp, statep->ID, cm_rootUserp, &req, &connp);
-                            if (code)
-                                continue;
-
-                            rxconnp = cm_GetRxConn(connp);
-                            code = RXAFS_GetVolumeStatus(rxconnp, statep->ID,
-                                                         &volStat, &Name, &OfflineMsg, &MOTD);
-                            rx_PutConnection(rxconnp);
-                        } while (cm_Analyze(connp, cm_rootUserp, &req, &vfid, NULL, 0, NULL, NULL, NULL, NULL, code));
-                        code = cm_MapRPCError(code, &req);
-
-                        if (code == 0 && volType == ROVOL)
-                        {
-
-                            lock_ObtainWrite(&volp->rw);
-                            volp->volumeSizeRO = volStat.BlocksInUse * 1024;
-                            _InterlockedOr(&volp->flags, CM_VOLUMEFLAG_RO_SIZE_VALID);
-                            lock_ReleaseWrite(&volp->rw);
-                        }
-                    }
-
-                    lock_ObtainWrite(&vscp->rw);
-                    cm_SyncOpDone(vscp, NULL, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
-                    lock_ReleaseWrite(&vscp->rw);
-                    cm_ReleaseSCache(vscp);
+                   do {
+                       code = cm_ConnFromVolume(volp, statep->ID, cm_rootUserp, &req, &connp);
+                       if (code)
+                          continue;
+
+                       rxconnp = cm_GetRxConn(connp);
+                       code = RXAFS_GetVolumeStatus(rxconnp, statep->ID,
+                                                    &volStat, &Name, &OfflineMsg, &MOTD);
+                       rx_PutConnection(rxconnp);
+                   } while (cm_Analyze(connp, cm_rootUserp, &req, &vfid, NULL, 0, NULL, NULL, NULL, NULL, code));
+                   code = cm_MapRPCError(code, &req);
+
+                   if (code == 0 && volType == ROVOL)
+                   {
+                       lock_ObtainWrite(&volp->rw);
+                       volp->volumeSizeRO = volStat.BlocksInUse * 1024;
+                       _InterlockedOr(&volp->flags, CM_VOLUMEFLAG_RO_SIZE_VALID);
+                       lock_ReleaseWrite(&volp->rw);
+                   }
+
+                   cm_ReleaseSCache(vscp);
                 }
                 lock_ObtainWrite(&volp->rw);
                 if (code == 0 && volStat.Online) {
index b87f7c5..a60ac14 100644 (file)
@@ -5833,7 +5833,6 @@ 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";
@@ -5844,7 +5843,6 @@ RDR_GetVolumeInfo( IN cm_user_t     *userp,
     char *OfflineMsg;
     char *MOTD;
     struct rx_connection * rxconnp;
-    int sync_done = 0;
     int scp_locked = 0;
 
     RDR_InitReq(&req, bWow64);
@@ -5944,40 +5942,30 @@ RDR_GetVolumeInfo( IN cm_user_t     *userp,
         
         if (code == -1)
         {
-            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;
-
-                Name = volName;
-                OfflineMsg = offLineMsg;
-                MOTD = motd;
-                lock_ReleaseWrite(&scp->rw);
-                scp_locked = 0;
-
-                do {
-                    code = cm_ConnFromFID(&scp->fid, userp, &req, &connp);
-                    if (code) continue;
-
-                    rxconnp = cm_GetRxConn(connp);
-                    code = RXAFS_GetVolumeStatus(rxconnp, scp->fid.volume,
-                                                 &volStat, &Name, &OfflineMsg, &MOTD);
-                    rx_PutConnection(rxconnp);
-
-                } while (cm_Analyze(connp, userp, &req, &scp->fid, NULL, 0, NULL, NULL, NULL, NULL, code));
-                code = cm_MapRPCError(code, &req);
-
-                if (code == 0 && volType == ROVOL)
-                {
-
-                    lock_ObtainWrite(&volp->rw);
-                    volp->volumeSizeRO = volStat.BlocksInUse * 1024;
-                    _InterlockedOr(&volp->flags, CM_VOLUMEFLAG_RO_SIZE_VALID);
-                    lock_ReleaseWrite(&volp->rw);
-                }
+           Name = volName;
+           OfflineMsg = offLineMsg;
+           MOTD = motd;
+           lock_ReleaseWrite(&scp->rw);
+           scp_locked = 0;
+
+           do {
+               code = cm_ConnFromFID(&scp->fid, userp, &req, &connp);
+               if (code) continue;
+
+               rxconnp = cm_GetRxConn(connp);
+               code = RXAFS_GetVolumeStatus(rxconnp, scp->fid.volume,
+                                            &volStat, &Name, &OfflineMsg, &MOTD);
+               rx_PutConnection(rxconnp);
+
+           } while (cm_Analyze(connp, userp, &req, &scp->fid, NULL, 0, NULL, NULL, NULL, NULL, code));
+           code = cm_MapRPCError(code, &req);
+
+           if (code == 0 && volType == ROVOL)
+           {
+               lock_ObtainWrite(&volp->rw);
+               volp->volumeSizeRO = volStat.BlocksInUse * 1024;
+               _InterlockedOr(&volp->flags, CM_VOLUMEFLAG_RO_SIZE_VALID);
+               lock_ReleaseWrite(&volp->rw);
             }
         }
 
@@ -6048,14 +6036,6 @@ RDR_GetVolumeInfo( IN cm_user_t     *userp,
         /* do not include the trailing nul */
         if ( pResultCB->CellLength )
             pResultCB->CellLength--;
-
-        if (sync_done) {
-            if (!scp_locked) {
-                lock_ObtainWrite(&scp->rw);
-                scp_locked = 1;
-            }
-            cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
-        }
     }
     pResultCB->VolumeLabelLength *= sizeof(WCHAR);  /* convert to bytes from chars */
     pResultCB->CellLength *= sizeof(WCHAR);         /* convert to bytes from chars */
@@ -6099,7 +6079,6 @@ RDR_GetVolumeSizeInfo( IN cm_user_t     *userp,
     char *OfflineMsg;
     char *MOTD;
     struct rx_connection * rxconnp;
-    int sync_done = 0;
     int scp_locked = 0;
 
     RDR_InitReq(&req, bWow64);
@@ -6176,38 +6155,30 @@ RDR_GetVolumeSizeInfo( IN cm_user_t     *userp,
         
         if (code == -1)
         {
-            code = cm_SyncOp(scp, NULL, userp, &req, PRSFS_READ,
-                              CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
-            if (code == 0)
-            {
-                sync_done = 1;
-
-                Name = volName;
-                OfflineMsg = offLineMsg;
-                MOTD = motd;
-                lock_ReleaseWrite(&scp->rw);
-                scp_locked = 0;
-
-                do {
-                    code = cm_ConnFromFID(&scp->fid, userp, &req, &connp);
-                    if (code) continue;
-
-                    rxconnp = cm_GetRxConn(connp);
-                    code = RXAFS_GetVolumeStatus(rxconnp, scp->fid.volume,
-                                                  &volStat, &Name, &OfflineMsg, &MOTD);
-                    rx_PutConnection(rxconnp);
-
-                } while (cm_Analyze(connp, userp, &req, &scp->fid, NULL, 0, NULL, NULL, NULL, NULL, code));
-                code = cm_MapRPCError(code, &req);
-
-                if (code == 0 && volType == ROVOL)
-                {
-
-                    lock_ObtainWrite(&volp->rw);
-                    volp->volumeSizeRO = volStat.BlocksInUse * 1024;
-                    _InterlockedOr(&volp->flags, CM_VOLUMEFLAG_RO_SIZE_VALID);
-                    lock_ReleaseWrite(&volp->rw);
-                }
+           Name = volName;
+           OfflineMsg = offLineMsg;
+           MOTD = motd;
+           lock_ReleaseWrite(&scp->rw);
+           scp_locked = 0;
+
+           do {
+               code = cm_ConnFromFID(&scp->fid, userp, &req, &connp);
+               if (code) continue;
+
+               rxconnp = cm_GetRxConn(connp);
+               code = RXAFS_GetVolumeStatus(rxconnp, scp->fid.volume,
+                                            &volStat, &Name, &OfflineMsg, &MOTD);
+               rx_PutConnection(rxconnp);
+
+           } while (cm_Analyze(connp, userp, &req, &scp->fid, NULL, 0, NULL, NULL, NULL, NULL, code));
+           code = cm_MapRPCError(code, &req);
+
+           if (code == 0 && volType == ROVOL)
+           {
+               lock_ObtainWrite(&volp->rw);
+               volp->volumeSizeRO = volStat.BlocksInUse * 1024;
+               _InterlockedOr(&volp->flags, CM_VOLUMEFLAG_RO_SIZE_VALID);
+               lock_ReleaseWrite(&volp->rw);
             }
         }
 
@@ -6237,14 +6208,6 @@ RDR_GetVolumeSizeInfo( IN cm_user_t     *userp,
             pResultCB->AvailableAllocationUnits.QuadPart = (volType == ROVOL || volType == BACKVOL) ? 0 : 0x3F000000;
             code = 0;
         }
-
-        if (sync_done) {
-            if (!scp_locked) {
-                lock_ObtainWrite(&scp->rw);
-                scp_locked = 1;
-            }
-            cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
-        }
     }
 
   _done: