[VFATLIB]

It seems suspicious to directly return the value of fs_close as the NTSTATUS code of the check-disk operation (for FAT32 volumes it happens to return 1 whereas for FAT16 volumes it returns 0).
The documentation of this function says that it "returns a non-zero integer if the file system has been changed since the last fs_open, zero otherwise."
Maybe somebody has a more precise idea on that subject? In the meantime I also add some DPRINTs to attempt to diagnose the conditions where this problem occurs.

svn path=/trunk/; revision=70434
This commit is contained in:
Hermès Bélusca-Maïto 2015-12-27 02:01:52 +00:00
parent c266fd3fb0
commit ed1b816943

View file

@ -351,6 +351,7 @@ VfatChkdsk(IN PUNICODE_STRING DriveRoot,
BOOLEAN salvage_files; BOOLEAN salvage_files;
ULONG free_clusters; ULONG free_clusters;
DOS_FS fs; DOS_FS fs;
int ret;
/* Store callback pointer */ /* Store callback pointer */
ChkdskCallback = Callback; ChkdskCallback = Callback;
@ -372,7 +373,11 @@ VfatChkdsk(IN PUNICODE_STRING DriveRoot,
if (CheckOnlyIfDirty && !fs_isdirty()) if (CheckOnlyIfDirty && !fs_isdirty())
{ {
/* No need to check FS */ /* No need to check FS */
return fs_close(FALSE); // NOTE: Returning the value of fs_close looks suspicious.
// return fs_close(FALSE);
ret = fs_close(FALSE);
DPRINT1("No need to check FS; fs_close returning %d\n", ret);
return STATUS_SUCCESS;
} }
read_boot(&fs); read_boot(&fs);
@ -404,6 +409,8 @@ VfatChkdsk(IN PUNICODE_STRING DriveRoot,
if (fs_changed()) if (fs_changed())
{ {
DPRINT1("fs_changed is TRUE!\n");
if (FixErrors) if (FixErrors)
{ {
if (FsCheckFlags & FSCHECK_INTERACTIVE) if (FsCheckFlags & FSCHECK_INTERACTIVE)
@ -430,7 +437,11 @@ VfatChkdsk(IN PUNICODE_STRING DriveRoot,
} }
/* Close the volume */ /* Close the volume */
return fs_close(FixErrors) ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL; // NOTE: Returning the value of fs_close looks suspicious.
// return fs_close(FixErrors) ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL;
res = fs_close(FixErrors);
DPRINT1("fs_close returning %d\n", ret);
return STATUS_SUCCESS;
} }
/* EOF */ /* EOF */