MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / Ext2UnlockVolume

Function Ext2UnlockVolume

Ext4Fsd/fsctl.c:240–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240NTSTATUS
241Ext2UnlockVolume (
242 IN PEXT2_IRP_CONTEXT IrpContext
243)
244{
245 PIO_STACK_LOCATION IrpSp = NULL;
246 PDEVICE_OBJECT DeviceObject = NULL;
247 PEXT2_VCB Vcb = NULL;
248 NTSTATUS Status;
249 BOOLEAN VcbResourceAcquired = FALSE;
250
251 __try {
252
253 ASSERT(IrpContext != NULL);
254 ASSERT((IrpContext->Identifier.Type == EXT2ICX) &&
255 (IrpContext->Identifier.Size == sizeof(EXT2_IRP_CONTEXT)));
256
257 DeviceObject = IrpContext->DeviceObject;
258 IrpSp = IoGetCurrentIrpStackLocation(IrpContext->Irp);
259
260 //
261 // This request is not allowed on the main device object
262 //
263 if (IsExt2FsDevice(DeviceObject)) {
264 Status = STATUS_INVALID_PARAMETER;
265 __leave;
266 }
267
268 Vcb = (PEXT2_VCB) DeviceObject->DeviceExtension;
269 ASSERT(Vcb != NULL);
270 ASSERT((Vcb->Identifier.Type == EXT2VCB) &&
271 (Vcb->Identifier.Size == sizeof(EXT2_VCB)));
272
273 ExAcquireResourceExclusiveLite(
274 &Vcb->MainResource,
275 TRUE );
276 VcbResourceAcquired = TRUE;
277
278 Status = Ext2UnlockVcb(Vcb, IrpSp->FileObject);
279
280 } __finally {
281
282 if (VcbResourceAcquired) {
283 ExReleaseResourceLite(&Vcb->MainResource);
284 }
285
286 if (!IrpContext->ExceptionInProgress) {
287 Ext2CompleteIrpContext(IrpContext, Status);
288 }
289 }
290
291 return Status;
292}
293
294
295NTSTATUS

Callers 1

Ext2UserFsRequestFunction · 0.85

Calls 2

Ext2UnlockVcbFunction · 0.85
Ext2CompleteIrpContextFunction · 0.85

Tested by

no test coverage detected