- Timestamp:
- Jul 1, 2016 1:42:28 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/ISCSI.cpp
r61037 r61978 573 573 /** Flag whether to dump malformed packets in the release log. */ 574 574 bool fDumpMalformedPackets; 575 /** Flag whtether the target is readonly. */ 576 bool fTargetReadOnly; 577 /** Flag whether to retry the connection before processing new requests. */ 578 bool fTryReconnect; 575 579 576 580 /** Head of request queue */ … … 3436 3440 case ISCSICMDTYPE_REQ: 3437 3441 { 3442 if ( !iscsiIsClientConnected(pImage) 3443 && pImage->fTryReconnect) 3444 { 3445 pImage->fTryReconnect = false; 3446 iscsiReattach(pImage); 3447 } 3448 3438 3449 /* If there is no connection complete the command with an error. */ 3439 3450 if (RT_LIKELY(iscsiIsClientConnected(pImage))) … … 4275 4286 if (RT_SUCCESS(rc)) 4276 4287 { 4277 if (!(uOpenFlags & VD_OPEN_FLAGS_READONLY) && data4[2] & 0x80) 4288 pImage->fTargetReadOnly = !!(data4[2] & 0x80); 4289 if (!(uOpenFlags & VD_OPEN_FLAGS_READONLY) && pImage->fTargetReadOnly) 4278 4290 { 4279 4291 rc = VERR_VD_IMAGE_READ_ONLY; … … 5163 5175 static DECLCALLBACK(int) iscsiSetOpenFlags(void *pBackendData, unsigned uOpenFlags) 5164 5176 { 5165 LogFlowFunc(("pBackendData=%#p \n uOpenFlags=%#x", pBackendData, uOpenFlags));5177 LogFlowFunc(("pBackendData=%#p uOpenFlags=%#x\n", pBackendData, uOpenFlags)); 5166 5178 PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData; 5167 int rc ;5179 int rc = VINF_SUCCESS; 5168 5180 5169 5181 /* Image must be opened and the new flags must be valid. */ 5170 if (!pImage || (uOpenFlags & ~( VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_INFO 5171 | VD_OPEN_FLAGS_ASYNC_IO | VD_OPEN_FLAGS_SHAREABLE 5172 | VD_OPEN_FLAGS_SEQUENTIAL | VD_OPEN_FLAGS_SKIP_CONSISTENCY_CHECKS))) 5173 { 5174 rc = VERR_INVALID_PARAMETER; 5175 goto out; 5176 } 5177 5178 /* Implement this operation via reopening the image if we actually need 5179 * to do something. A read/write -> readonly transition doesn't need a 5180 * reopen. In the other direction we don't have the necessary information 5181 * as the "disk is readonly" flag is thrown away. Can be optimized too, 5182 * but it's not worth the effort at the moment. */ 5182 AssertReturn(pImage && !(uOpenFlags & ~( VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_INFO 5183 | VD_OPEN_FLAGS_ASYNC_IO | VD_OPEN_FLAGS_SHAREABLE 5184 | VD_OPEN_FLAGS_SEQUENTIAL | VD_OPEN_FLAGS_SKIP_CONSISTENCY_CHECKS)), 5185 VERR_INVALID_PARAMETER); 5186 5187 /* 5188 * A read/write -> readonly transition is always possible, 5189 * for the reverse direction check that the target didn't present itself 5190 * as readonly during the first attach. 5191 */ 5183 5192 if ( !(uOpenFlags & VD_OPEN_FLAGS_READONLY) 5184 && (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)) 5185 { 5186 iscsiFreeImage(pImage, false); 5187 rc = iscsiOpenImage(pImage, uOpenFlags); 5188 } 5193 && (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY) 5194 && pImage->fTargetReadOnly) 5195 rc = VERR_VD_IMAGE_READ_ONLY; 5189 5196 else 5190 5197 { 5191 5198 pImage->uOpenFlags = uOpenFlags; 5192 rc = VINF_SUCCESS;5193 } 5194 out: 5199 pImage->fTryReconnect = true; 5200 } 5201 5195 5202 LogFlowFunc(("returns %Rrc\n", rc)); 5196 5203 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.