Commit graph

211 commits

Author SHA1 Message Date
Pierre Schweitzer 45fd48bd0f
[CDFS_NEW] -> [CDFS] No old driver, thus no new driver 2018-08-21 12:32:15 +02:00
Pierre Schweitzer 5795254933
[CDFS] Delete the old CDFS driver.
You served us well!
2018-08-21 12:27:35 +02:00
Pierre Schweitzer b5aa79a66d
[FASTFAT] Drop an useless #ifdef, we have this cast in all other FSDs 2018-08-21 08:50:29 +02:00
Pierre Schweitzer 4bb1baa860
[FASTFAT] Finally drop the TAG_VFAT allocation tag 2018-08-21 08:36:51 +02:00
Mark Jansen 6c75215bb3 [BTRFS] Fix booting with runtime checks 2018-08-21 07:05:40 +02:00
Pierre Schweitzer 53985bf64d
[FASTFAT] Disable delayed close
It brings too many regressions for too little gain.

CORE-14938
CORE-14917
CORE-14826
2018-08-20 19:43:43 +02:00
Victor Perevertkin 0e61b570e7 [BTRFS] Applied upstream pull-requests before they are merged 2018-08-20 08:26:56 +02:00
Victor Perevertkin 07bc92f740 [USETUP][SETUPLIB] Added support for formatting partition in BTRFS and installing ReactOS on it.
Removed code related to EXT2 boot sector for now.
CORE-13769
2018-08-20 08:26:56 +02:00
Pierre Schweitzer 901c47ed14
[FASTFAT] Don't delay any other close once shutdown has started 2018-08-19 09:56:12 +02:00
Pierre Schweitzer 4fe7aafe10
[FASTFAT] Magic values-- 2018-08-19 09:56:12 +02:00
Pierre Schweitzer 047479e0a2
[FASTFAT] Don't leak statistics on dismount 2018-08-18 19:03:30 +02:00
Pierre Schweitzer 639e6d635f
[FASTFAT] Reduce the usage of the generic allocation tag
And use tag compatible with MS FastFAT, to use debug with WinDBG
2018-08-18 19:03:30 +02:00
Pierre Schweitzer 50b00f0fcc
[FASTFAT] Implement delayed close
When we're about to close a file (ie, forget everything about it
and release any associated structure), actually delay it.
This allows keep data fresh in memory for faster reuse in case
it would be required. The effective closing will only happen after some time.

For specific operations, this will produce a real speed up in ReactOS.
For instance, with that patch, Winamp starts within seconds, instead of dozen
of minutes.
In most cases, it will bring ReactOS to performances it had before fixing
the huge leak in FastFAT (commit 94ead99) without leaking the whole FS.

For now, due to regressions, this is only activated for files and not
for directories. Once it gets fixed, it will be enabled for both.

CORE-14826
CORE-14917
2018-08-18 19:03:30 +02:00
Mike Swanson 3c7e9bb332 Remove unnecessary executable bits 2018-08-15 18:29:09 +02:00
Pierre Schweitzer c13ccc92f6
[BTRFS] Leak the root stream file object on mount.
For whatever (unknown) reason yet, this stream file object
seems to be deleted when still in use while installing
ReactOS on BtrFS partition, leading to use after free.

So, quick and dirty hack: leak it to prevent deletion.

CORE-13769
2018-08-15 16:38:56 +02:00
Pierre Schweitzer 80e11516b1
[BTRFS] Allow driver to start at first stage when no hive is present.
Contrary to upstream, we will ignore failure when opening registry
and will keep going.

CORE-13769
2018-08-15 16:35:05 +02:00
Timo Kreuzer 9e066abe2a [DRIVERS] Fix 64 bit issues 2018-08-04 19:19:34 +02:00
Timo Kreuzer ca9fd861aa [DRIVERS][NTOS][NDK] Use IO_STACK_LOCATION instead of EXTENDED_IO_STACK_LOCATION and remove the latter from NDK 2018-07-01 14:45:21 +02:00
Pierre Schweitzer 52f0f80a83
[FASTFAT] Don't add an extra \, when renaming a file at root.
This fixes failures to rename a file where destination is
the root of a FAT volume.

CORE-10503
2018-06-09 22:17:17 +02:00
Pierre Schweitzer 6aa4beeefb
[FASTFAT] Use the FastFAT mechanism for counting clusters already implemented
This allows us having more accurate statistics regarding available clusters
count. Even though FastFAT and chkdsk still don't agree!

CORE-3877
2018-06-09 18:23:07 +02:00
Pierre Schweitzer 704baed2df
[FASTFAT] Start implementing FAT32 statistics support
Not fully perfect yet, chkdsk still complains.

CORE-3877
2018-06-09 12:36:43 +02:00
Pierre Schweitzer 04640f9264
[FASTFAT] Save the FSINFO sector location 2018-06-09 12:11:43 +02:00
Pierre Schweitzer 01e2877161
[FASTFAT] Properly check for buffer size on dir enumeration.
This avoids improper returns when multiple entries are requested
and, in rare circumstances, entries not being seen by umode.

CORE-14699
2018-06-07 19:34:47 +02:00
Serge Gautherie c1256dda20 [EXT2FS][REISERFS] VSSolution: Actually disable C4189 errors (#540)
Multiple "error C4189: '[...]': local variable is initialized but not referenced".

Thanks to Yuntian Zhang, who hinted at this in CORE-11836.

CORE-11280
2018-06-05 20:16:22 +02:00
Pierre Schweitzer 9f3169b295
[FASTFAT] Lock DirResource on flush in case we're updating entry
CORE-14660
2018-05-28 19:37:56 +02:00
Pierre Schweitzer fc788cf2fd
[FASTFAT] Lock DirResource when modifying an entry on disk.
Likely not optimal, but fixes some races conditions where
the directory is uninit in the middle of the write.
2018-05-26 17:13:08 +02:00
Pierre Schweitzer c7806a6b29
[BTRFS] Upgrade to 1.0.2
CORE-14655
2018-05-26 10:44:36 +02:00
Pierre Schweitzer 47b9db9d02
[FASTFAT] Initialize cache if neded for changing volume label.
CORE-14654
2018-05-26 10:12:55 +02:00
Pierre Schweitzer b4363068d1
[FASTFAT] Properly handle IRPs that can wait and these that cannot.
CORE-14634
2018-05-22 21:30:08 +02:00
Pierre Schweitzer e9e14be661
[FASTFAT] Properly queue pending write IRPs.
Addendum to 30b836b
2018-05-21 10:41:59 +02:00
Pierre Schweitzer 30b836bf3f
[FASTFAT] When extending a file, also lock the DirResource.
This avoids race conditions under high IOs and thus corruption on
the FS, or assertions failures in the kernel.
Easily triggered by building ReactOS on ReactOS ;-).
2018-05-21 10:30:14 +02:00
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
Pierre Schweitzer d37280efaa
[FASTFAT] Deny dismounting system volume or a volume with a pagefile 2018-05-16 21:45:35 +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
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
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
Pierre Schweitzer 1986049a38
[CDFS_NEW] Sync with HEAD.
CORE-14315
2018-02-25 10:14:27 +01:00