Commit graph

336 commits

Author SHA1 Message Date
Pierre Schweitzer a10f6c7a0c
[FASTFAT] Fail if allocating the stream FO fails. 2018-05-20 13:53:43 +02:00
Pierre Schweitzer 7283f3cfd9
[FASTFAT] Addendum to d69f318 2018-05-19 13:46:34 +02:00
Pierre Schweitzer d69f31848e
[FASTFAT] Misc. fixes spotted by Thomas. 2018-05-19 10:07:14 +02:00
Pierre Schweitzer 7c01587680
[FASTFAT] Completely rewrite support for dirty volumes.
Until now, our support for dirty volumes was totally broken
to a point where, on FAT32 volume, the dirty couldn't even
be written nor read from the disk.

This commit totally rewrites its handling, for both FAT16 and FAT32
so that it's now fully functionnal. Furthermore, it also gets
totally compatible with our vfatlib, and thus, autochk.
Now, on mount, FastFAT will check if the volume is dirty or not, and
autochk will be able to ask for a repair if dirty. vfatlib will
repair the volume and remove the dirty bit. So that, on next
reboot, the volume will be mounted clean.

As a reminder, the dirty bit is set immediately after mounting
the volume, so that, if you crash or have a powercut, autochk
will always attempt to repair your volume (with more or less,
that's FAT!).

If you want to experience without breaking your FAT volume,
just boot, open a cmd prompt and type: fsutil dirty set c:
and reboot!

CORE-13758
CORE-13760
CORE-13759
2018-05-18 23:05:05 +02:00
Pierre Schweitzer efa75dd5b2
[FASTFAT] Allow locking system volume on boot.
This is a hack, and totally not the default behavior.
But it will allow autochk locking the boot volume in
order to verify it on boot, in case it would have
been improperly dismounted.

CORE-13759
2018-05-18 23:05:05 +02:00
Pierre Schweitzer a837694518
[FASTFAT] Uninit directory cache on last handle close.
CORE-14629
CORE-14557
2018-05-18 14:51:24 +02:00
Pierre Schweitzer 3c3ebe3320
[FASTFAT] Only initialize directory cache on use.
This avoids initializing cache directly on directory
open/create.
The advantage is we reduce the load on cache manager
and on memory manager by avoiding creating everytime
a stream file object, and initializing cache for it.

This will avoid initializing cache for started
applications 'current directory' which is just opened
for having a valid handle but no read/write is performed
in it, by default.

This is a step forward for autochk.

CORE-14629
2018-05-18 14:09:30 +02:00
Pierre Schweitzer 5d743b7bd7
[FASTFAT] When attaching our FCB to a FO, also set the VPB.
Spotted by Alex.
2018-05-18 10:30:52 +02:00
Peter Wathall ae9cc6bb52 Fixed typo 2018-05-17 16:15:25 +01:00
Peter Wathall 6412253d44 Fixed typo 2018-05-17 16:15:25 +01:00
Peter Wathall 3a3a4f7970 Fixed typo 2018-05-17 16:15:25 +01:00
Pierre Schweitzer d37280efaa
[FASTFAT] Deny dismounting system volume or a volume with a pagefile 2018-05-16 21:45:35 +02:00
Thomas Faber ccaf7b24c3
[NDIS] Fix parameter order when calling ResetHandler. CORE-14624 2018-05-14 18:17:52 +02:00
Pierre Schweitzer 38078335b9
[FASTFAT] Implement support for stack overflow in read operations.
Before performing a read operation, FastFAT driver will
attempt to compute whether it would run out of stack
during the operation. If so, instead of attempting the
operation in the current thread, it will post the read
request to the overflow thread.

This should help with the regressions brought in by
94ead99e0c.

CORE-14601
2018-05-12 12:03:18 +02:00
Thomas Faber 0ce31759d0
[USBPORT] Fix x64 build. 2018-05-12 10:11:21 +02:00
Vadim Galyant c89a190ea6
[USBPORT][USBOHCI_NEW] Avoid using pointers for physical addresses. 2018-05-11 15:46:25 +02:00
Thomas Faber 837411e292
[USBOHCI_NEW] Fix build. 2018-05-11 15:44:19 +02:00
Serge Gautherie b893124a20 [NTFS] Fix 2 Clang-Cl warnings about CurrentKey->IndexEntry->Flags
"warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]"

CORE-14306
2018-05-04 08:08:45 +02:00
Pierre Schweitzer 2a7d16727a
[FASTFAT] Implement write IOs defering.
Before any write operation that would involve caching, ask
the cache controler whether writing would make it exceed its memory
consumption. If so, queue the write operation for later execution.

In case the write operation can wait, then, the FSD operation will be
halted until the write is allowed.

I could test it successfully by copying huge files from a FAT volume to
another. The write is halted until some portions of the file is written
to the disk.
I could also properly install Qt (SDK) on ReactOS with this and less than 1GB RAM:
- https://www.heisspiter.net/~Pierre/rostests/Qt_OS.png
- https://www.heisspiter.net/~Pierre/rostests/Qt_OS2.png

CORE-12081
CORE-14582
CORE-14313
2018-04-29 20:42:53 +02:00
Pierre Schweitzer 00e843b1ed
[FASTFAT] Reduce the number of local declaration. 2018-04-29 12:33:53 +02:00
Pierre Schweitzer fd8197645f
[FASTFAT] Use KdRosRegisterCliCallback() to register in KDBG. 2018-04-29 12:23:18 +02:00
Pierre Schweitzer c5a35ecd37 [FASTFAT] Introduce a KDBG extension.
This is a PoC of what it's possible to realize thanks to an
already existing hack in ntoskrnl :-).
With this extension, on the kdb:> prompt, you're able to type
in commands that will be handled by the FastFAT driver and not
by the kernel, allowing internal debug, not possible otherwise.

So far, three commands exist:
- ?fat.vols: lists all the mounted volumes by FastFAT
- ?fat.files: lists all the files on a specific volume (with their attributes)
- ?fat.setdbgfile: allows watching on specifics files lifetime

This is obviously only the begin and could be greatly improved.

For instance, this is what allowed to debug CORE-14557
2018-04-29 12:15:11 +02:00
Pierre Schweitzer 94ead99e0c [FASTFAT] Don't leak directories FILE_OBJECT, FCB and cache entries.
Once a directory is crossed (opened or a child is opened), associated
FCB structure is created in FastFAT, but also a stream FO for caching.
Up to now, due to an extra reference taken by the stream file object,
even when the directory was no longer used, the directory was kept in
memory: the FCB was never deleted, the file object was never dereferenced,
and the cache never released.

The immediate effect of this bug is that our FAT driver was leaking every
directory that was used affecting the whole OS situation. In case of
directories intensive operation (like extraction the ReactOS source code
in ReactOS ;-)), we were just killin the whole OS RAM without any way to
release it and recover.

The other side effects: IOs were faster as half of the FS was always
permanant in RAM.

This commit fixes the issue by forcing the FSD to release the FO,
and the cache when a directory is no longer used, leading to its
destruction in RAM.
Downside: on IO intensive operation, expect slowdowns, obviously,
there's less caching now. But more efficient!

CORE-14557
2018-04-28 18:33:14 +02:00
Pierre Schweitzer 315f9a13d4
[FASTFAT] When allocating a FCB, set its node type code.
We set the same value as MS FastFAT driver for consistency.
2018-04-27 18:56:31 +02:00
Peter Wathall 9e2dd8676a Removed unreachable line (#517)
The break statement was unnecessary because the goto on the line before it returns from the routine so it can never be reached
2018-04-24 21:35:23 +01:00
Hermès Bélusca-Maïto da5dcdcbf2
[NULL] Additions for the Null driver.
- Allow the driver to be unloaded, as on Windows.
- Use a static fast IO dispatch table, instead of allocating one and
  risking any potential memory allocation failure.
- Update the file header.
2018-04-22 22:23:54 +02:00
Hermès Bélusca-Maïto 2183e65c17
[ACPI] Fix the format of the (default hardcoded) "unique" instance ID. 2018-04-22 16:52:42 +02:00
Pierre Schweitzer c7bba39afc
[NTFS] When reading $I30 attribute fails, stop the rename operation.
This makes the function return the error instead of continuing and
performing use-after-frees operations.
This is likely to be a forgotten return!

CID 1434254, 1434268
2018-04-14 11:43:57 +02:00
Timo Kreuzer 6b1ca75899
[REACTOS] Fix 64 bit build (#465)
* [HAL] Simplify HalpReboot() and make it portable
* [NTOS:MM] Cast constant to PVOID
* [BINPATCH] Fix 64 bit build
* [VFDDRV] Fix 64 bit build and buffer overruns
* [USBOHCI] Fix structure alignment issues
* [ATL_APITEST] Fix 64 bit build
* [XDK] Update unwind structures in winnt.h
* [NTDLL_APITEST] Fix 64 bit build
* [NTDLL_WINETEST] Fix 64 bit build
* [TFTPD] Fix x64 build
* [USBPORT] Fix a C_ASSERT
* [DSOUND] Fix x64 build
* [HAL] Remove obsolete GetPteAddress() macro
2018-04-03 15:13:17 -06:00
Colin Finck 765280bf5f Merge PR #283 "[USBPORT] Transaction Translator (TT) support bringup" 2018-03-29 23:52:22 +02:00
Thomas Faber 851a554b59
[USBHUB_NEW] Fix USBH_CheckDeviceIDUnique return value. 2018-03-27 08:59:54 +02:00
Nikita Krapivin 10645167b8 [I8042PRT] Enable keyboard clock explicitly (fixes Lenovo ACPI bug). CORE-14256 (#434) 2018-03-21 22:07:30 +01:00
Mark Jansen 8b84b1c6b3 [AFD] Mark the socket as named pipe, so NtWriteFile actually knows what to do with it.
CORE-13067
2018-03-21 19:22:13 +01:00
Mark Jansen 9168226378 [AFD] Respond to FileFsDeviceInformation.
CORE-13067
2018-03-21 19:22:13 +01:00
Bișoc George 1a951aa4e6 [BUS][ACPI] Silence DPRINT1 in the special case of IOCTL_BATTERY_QUERY_TAG (#427) 2018-03-12 15:29:14 +01:00
Eric Kohl ca22dc9bb5 [STORPORT][DDK] Add the StorPortExtendedFunction stub
- Add the StorPortExtendedFunction stub to the storport driver.
- Add the declaration of StorPortExtendedFunction to the ddk.

CORE-12695
2018-03-03 14:19:33 +01:00
Pierre Schweitzer 1986049a38
[CDFS_NEW] Sync with HEAD.
CORE-14315
2018-02-25 10:14:27 +01:00
Vadim Galyant 62612a7e45 [USBPORT] Use USB2_HS_INTERRUPT_IN_OVERHEAD instead USB2_HS_ISOCHRONOUS_OUT_OVERHEAD. 2018-02-21 13:35:25 +09:00
Pierre Schweitzer 69f51d1533
[FASTFAT] Drop read ahead locking routines in favor of lazy writer routines.
This avoids code duplication while being consistent with MS FastFAT.
2018-02-17 13:49:15 +01:00
Doug Lyons 8ea42001d9
[I8042PRT] Apply a workaround for Dell Latitude D610
CORE-14324
2018-02-15 22:49:39 +01:00
Pierre Schweitzer a5e89014dc
[CDFS_NEW] Fix a bug in Microsoft CDFS implementation where the top level IRP
is set before locking is actually attempted for Cc worker thread (lazy write/read ahead).
So in case locking fails, the top level IRP is set and never unset, and latter
call will hit the assert where it expects the top level IRP to be NULL.

Should be reported upstream (tm).

CORE-14315
2018-02-12 20:47:32 +01:00
Vadim Galyant 11772da783 [USBPORT] Small changes for debugging. 2018-01-26 20:46:34 +09:00
Vadim Galyant f37a3dc42f [USBPORT] Add USB2_BIT_STUFFING_OVERHEAD constant. 2018-01-22 14:15:57 +09:00
Vadim Galyant 797ebcab72 [USBPORT] Fixing use DeviceSpeed instead Direction. 2018-01-21 19:36:01 +01:00
Vadim Galyant a4dee8e3ac [USBPORT] Add a space in indentation. 2018-01-21 19:36:00 +01:00
Vadim Galyant ecd0097e37 [USBPORT] Delete DPRINTs. 2018-01-21 19:36:00 +01:00
Vadim Galyant 0f8079df3a [USBPORT] Add USB2_PREV_MICROFRAME constant. 2018-01-21 19:35:59 +01:00
Vadim Galyant fd5beb5593 [USBPORT] Moving array CMASKS[] to start file. 2018-01-21 19:35:59 +01:00
Vadim Galyant 2c73523b76 [USBPORT] Removing optional braces. 2018-01-21 19:35:59 +01:00
Vadim Galyant c86210e800 [USBPORT] Correcting check Period. 2018-01-21 19:35:58 +01:00