From 759c756b0fa51b774e3894d5f9a5029955232612 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Mon, 21 Sep 2009 11:09:56 -0500 Subject: [PATCH] DAFS: Put back volumes we get in FSSYNC handlers fssync-server.c has a few issues with not properly VPutVolume_r'ing volumes that were VGetVolume_r'd. The most important of these was that the handler for FSYNC_VOL_MOVE can put back a volume it did not get, when DAFS is enabled. Fix that, and another erroneous edge case in the FSYNC_VOL_QUERY_HDR handler when DAFS is not enabled. Reviewed-on: http://gerrit.openafs.org/477 Tested-by: Derrick Brashear Reviewed-by: Derrick Brashear --- src/vol/fssync-server.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/vol/fssync-server.c b/src/vol/fssync-server.c index 482bd24..86bd5fd 100644 --- a/src/vol/fssync-server.c +++ b/src/vol/fssync-server.c @@ -905,7 +905,9 @@ FSYNC_com_VolMove(FSSYNC_VolOp_command * vcom, SYNC_response * res) } else { res->hdr.reason = FSYNC_WRONG_PART; } +#ifndef AFS_DEMAND_ATTACH_FS VPutVolume_r(vp); +#endif /* !AFS_DEMAND_ATTACH_FS */ } else { res->hdr.reason = FSYNC_UNKNOWN_VOLID; } @@ -1188,17 +1190,17 @@ FSYNC_com_VolHdrQuery(FSSYNC_VolOp_command * vcom, SYNC_response * res) !(V_attachFlags(vp) & VOL_HDR_ATTACHED) || !(V_attachFlags(vp) & VOL_HDR_LOADED)) { res->hdr.reason = FSYNC_HDR_NOT_ATTACHED; - goto done; + goto cleanup; } #else /* !AFS_DEMAND_ATTACH_FS */ if (!vp || !vp->header) { res->hdr.reason = FSYNC_HDR_NOT_ATTACHED; - goto done; + goto cleanup; } #endif /* !AFS_DEMAND_ATTACH_FS */ } else { res->hdr.reason = FSYNC_WRONG_PART; - goto done; + goto cleanup; } } else { res->hdr.reason = FSYNC_UNKNOWN_VOLID; @@ -1207,10 +1209,12 @@ FSYNC_com_VolHdrQuery(FSSYNC_VolOp_command * vcom, SYNC_response * res) memcpy(res->payload.buf, &V_disk(vp), sizeof(VolumeDiskData)); res->hdr.response_len += sizeof(VolumeDiskData); + code = SYNC_OK; + + cleanup: #ifndef AFS_DEMAND_ATTACH_FS VPutVolume_r(vp); #endif - code = SYNC_OK; done: return code; -- 1.9.4