Allow mounting volumes with non-clean logfile with force mount option.

Volume left dirty upon umount. So, this is equal to running ntfsfix and then mounting with force option.
edge.strict_endians
Yura Pakhuchiy 2007-09-16 00:15:46 +03:00
parent bf3a7442eb
commit e5690b57d4
2 changed files with 10 additions and 6 deletions

View File

@ -1219,14 +1219,20 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, ntfs_mount_flags flags)
* But do not do that if this is a FORENSIC mount.
*/
if (!(flags & NTFS_MNT_RDONLY)) {
if (ntfs_volume_check_logfile(vol) < 0)
goto error_exit;
if (ntfs_volume_check_hiberfile(vol) < 0)
goto error_exit;
if (ntfs_volume_check_logfile(vol) < 0) {
if (errno != EOPNOTSUPP || !(flags & NTFS_MNT_FORCE))
goto error_exit;
ntfs_log_warning("WARNING: $LogFile is not clean, "
"forced to continue.\n");
NVolSetWasDirty(vol); /* Leave volume dirty since we
empted logfile. */
}
if (!NVolForensicMount(vol)) {
if (ntfs_logfile_reset(vol) < 0)
goto error_exit;
if (!NVolWasDirty(vol)) {
if (!(vol->flags & VOLUME_IS_DIRTY)) {
vol->flags |= VOLUME_IS_DIRTY;
if (ntfs_volume_write_flags(vol, vol->flags) <
0)
@ -1234,7 +1240,6 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, ntfs_mount_flags flags)
}
}
}
return vol;
io_error_exit:
errno = EIO;

View File

@ -104,8 +104,7 @@ static const char *unclean_journal_msg =
" C) Use 'Eject' from Windows Explorer to safely remove the device.\n"
" D) If you ran chkdsk previously then boot Windows again which will\n"
" automatically initialize the journal.\n"
" E) Run 'ntfsfix' on Linux which will reset the NTFS journal.\n"
" Then submit force option (WARNING: This solution it not recommended).\n"
" E) Submit 'force' option (WARNING: This solution it not recommended).\n"
" F) ntfsmount: Mount the volume read-only by using the 'ro' mount option.\n";
static const char *opened_volume_msg =