Commit graph

196 commits

Author SHA1 Message Date
Joachim Henze 19f220bf51 [0.4.9][CDFS_NEW] -> [CDFS]
port back:
0.4.10-dev-615-g 45fd48bd0f [CDFS_NEW] -> [CDFS] No old driver, thus no new driver
0.4.10-dev-614-g 5795254933 [CDFS] Delete the old CDFS driver.

The new MS PL licensed one worked for several years fine for us now
even in the older releases.
So no need to keep our old unfinished one any longer within
the release-branches. They are no mausoleum.
This does *not* change, which driver is actually in use.
We do continue to use 1:1 the state of current releases/0.4.10
2023-03-23 22:09:06 +01:00
Joachim Henze 9764a5e2e2 [0.4.9][NTFS] PrintAllVCNs(): Fix a typo in an ASSERT() (#4682), DPRINT1->DPRINT, EOL-WS
First part with the typo in the assert was introduced by 5579428b4f
which was merged into ros by a merge-task during 0.4.8-dev'ing.
releases/0.4.7 didn't have that code yet.
fix picked from 0.4.15-dev-5035-g f308c6a2bc
----------
[NTFS] Do not print debug message for every function call by default
That 2nd part was picked from 0.4.13-dev-450-g 1552434940
----------
And for all the files that I had to touch for the 2nd part in the older branches,
I ported back also some EOL-whitespace-fixes within like they were done during 0.4.15-dev'ing.
2022-10-16 23:33:43 +02:00
Joachim Henze 94db51a700 [0.4.9][UDFS] Fix crash on boot in release builds with UDFS removable media inserted (#4061) CORE-17598
Changes to specific files and their effects are as follows:
create.cpp - Allows booting past second stage with UDFS media inserted without BSOD
close.cpp - Allows shutdown without hang
dircntrl.cpp - Allows New Hardware Wizard not to hang on initial third phase install

It began to crash with the introduction of the UDFS driver in SVN r74901 == git 3a104c8f20

Fix picked from 0.4.15-dev-3326-g a91f5e8e4d
2021-11-14 21:21:59 +01:00
Joachim Henze dec08c83a5 [0.4.9][CDFS_NEW] Fix a macro-copy-paste and shrink the binary size CORE-17405
picked from 0.4.15-dev-1456-g 889eab7
2021-07-03 20:47:57 +02:00
Joachim Henze de9a7b0dc7 [0.4.9][EXT2] Fix filesystem corruption regressions CORE-17572 CORE-17195
It regressed when we upgraded Ext2Fsd to version 0.69 from version 0.68
via CORE-13980 in 0.4.8-dev-117-g a1d7e9936d

The fix is a partial revert of that.
Thanks to the patches author Doug Lyons.

VBox https://reactos.org/testman/compare.php?ids=77904,77908 LGTM
KVM https://reactos.org/testman/compare.php?ids=77903,77907 LGTM

fix picked from 0.4.15-dev-2792-g cb408102cc
2021-07-02 13:45:36 +02:00
Joachim Henze cbd0b79f8a [0.4.9][CDFS_NEW][SDK] Replace intermediate workarounds with proper fix CORE-14067
Historically we did hit assertions and exceptions in MS CDFS driver
when special characters 'äöüßÄÖÜ' were used in a valid filesystem.

We did already apply varying workarounds for those issues
into CDFS_NEW for 0.4.8, 0.4.9, 0.4.10
while we were in the learning curve still.

Later we found the root cause to be our faulty XDK
FsRtlIsAnsiCharacter* macros.

By fixing the macros we can replace the varying historic workarounds
and sync to the final 0.4.11-dev master state.

We did not ever observe new issues with any other filesystems that do
also use those macros during the last years. So we can sync now.
2020-12-31 15:15:43 +01:00
Joachim Henze 9ff6310cdc [0.4.9][FFS] Silence some only-informative KdPrints.
picked from 0.4.13-dev-924-g 4016225269
2020-12-21 07:54:37 +01:00
Joachim Henze 2b20379851 [0.4.9][CDFS_NEW] Make windows gcc release build compile CORE-15659
This fixes a regression introduced by 0.4.8-dev-164-g
ec6b3ecbe4
when the new driver was activated for compiling.

Many thanks to Thomas Faber, Pierre Schweitzer, Serge Gautherie

The fix is squashed backport of commit 0.4.12-dev-431-g
bccad87f3c
and commit 0.4.12-dev-432-g
3463b2db9f
2020-10-03 19:33:17 +02:00
Pierre Schweitzer ea76ef8477 [0.4.9] cherry-pick [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

(cherry picked from commit 01e2877161)
2018-06-07 20:57:47 +02:00
Pierre Schweitzer 98e87bcafd [0.4.9] cherry-pick [FASTFAT] Lock DirResource on flush in case we're updating entry
CORE-14660

(cherry picked from commit 9f3169b295)
2018-05-28 19:44:27 +02:00
Pierre Schweitzer 367cb1fff3 [0.4.9] cherry-pick [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.

(cherry picked from commit fc788cf2fd)
2018-05-27 12:58:00 +02:00
Pierre Schweitzer c71d198fd8 [0.4.9] cherry-pick [FASTFAT] Initialize cache if neded for changing volume label.
CORE-14654

(cherry picked from commit 47b9db9d02)
2018-05-26 14:13:17 +02:00
Pierre Schweitzer bf2d787a94 [0.4.9] cherry-pick [FASTFAT] Properly handle IRPs that can wait and these that cannot.
CORE-14634

(cherry picked from commit b4363068d1)
2018-05-26 14:12:36 +02:00
Pierre Schweitzer 07a13ca67c [0.4.9] cherry-pick [FASTFAT] Properly queue pending write IRPs.
Addendum to 30b836b

(cherry picked from commit e9e14be661)
2018-05-26 14:12:29 +02:00
Pierre Schweitzer 4af12f40ca [0.4.9] cherry-pick [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 ;-).

(cherry picked from commit 30b836bf3f)
2018-05-26 14:12:22 +02:00
Joachim Henze 7f96f90110 [0.4.9] [CDFS_NEW] Mute continuable assertion to avoid CORE-14067
like in 0.4.8 before

(cherry picked from commit 51f9494d48)
2018-05-20 22:46:42 +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
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
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
Serge Gautherie d6fab4158e [FASTFAT] Improve code style in addition to 8294118174. 2018-01-07 19:29:23 +01:00
Pierre Schweitzer f0a1a5c773
[FASTFAT] Notify on file size change in FileAllocationInformation/FileEndOfFileInformation 2018-01-07 15:29:33 +01:00
Pierre Schweitzer 8294118174
[FASTFAT] Add a wrapper around FsRtlNotifyFullReportChange 2018-01-07 14:16:31 +01:00
Pierre Schweitzer 2a36b632ef
[FASTFAT] When a file gets overwritten, notify about the changes 2018-01-07 11:44:25 +01:00
Pierre Schweitzer ffeb3f070b
[FASTFAT] When overwriting a file, also update its write time 2018-01-07 11:34:41 +01:00
Pierre Schweitzer 0eacb0b1ef
[FASTFAT] When dealing with attributes on IRP_MJ_CREATE, filter user input to ensure we have only attributes we can handle.
This applies to files newly created, or for files overwritten where attributes are reset/modified.
2018-01-06 22:02:10 +01:00
Pierre Schweitzer 7bea4ec07e
[NTFS] Apply fix from 52f0726: allow partial info copy on dir enumeration on first entry return.
This is assorted with misc fixes to make this code closer to what we currently have in FastFAT.
This also allows fixing a memory leak in case of single entry return.

CORE-13367
2018-01-06 21:39:25 +01:00
Pierre Schweitzer 2b4d5c5cff
[FASTFAT] When overwriting a file with FILE_OVERWRITE*, don't erase previous file attributes, only update them.
Keep erasing them in case the file gets overwritten with FILE_SUPERSEDE.

CORE-14158
2018-01-01 14:29:15 +01:00
Pierre Schweitzer f3fecf92c1
[FASTFAT] On file overwrite, deny it if file as HIDDEN/SYSTEM flag and caller doesn't set them.
CORE-14158
2018-01-01 12:13:46 +01:00
Pierre Schweitzer d2a5322576
[NTFS] Start using different tags for allocations.
They all be Ntf? as for the Windows NTFS driver
2017-12-31 23:11:57 +01:00
Pierre Schweitzer 2d3d74151b
[NTFS] Fix a memory leak on error
CID 1427053
2017-12-31 14:18:02 +01:00
Pierre Schweitzer 216a2cae73
[NTFS] Use LookasideList allocations for FILE_RECORD_HEADER.
TODO: use a specific tag

This, and previous commit, should speed up a bit the driver until caching gets implemented
2017-12-31 14:14:24 +01:00
Pierre Schweitzer 3ddf44ff10
[NTFS] Use LookasideList allocations for NTFS_ATTR_CONTEXT.
TODO: use a specific tag
2017-12-31 12:15:17 +01:00