Commit e7a1033b authored by Anton Altaparmakov's avatar Anton Altaparmakov

NTFS: Support more clean journal ($LogFile) states.

      - Support journals ($LogFile) which have been modified by chkdsk.  This
        means users can boot into Windows after we marked the volume dirty.
        The Windows boot will run chkdsk and then reboot.  The user can then
        immediately boot into Linux rather than having to do a full Windows
        boot first before rebooting into Linux and we will recognize such a
        journal and empty it as it is clean by definition.
      - Support journals ($LogFile) with only one restart page as well as
        journals with two different restart pages.  We sanity check both and
        either use the only sane one or the more recent one of the two in the
        case that both are valid.
Signed-off-by: default avatarAnton Altaparmakov <aia21@cantab.net>
parent caf39e87
...@@ -22,6 +22,19 @@ ToDo/Notes: ...@@ -22,6 +22,19 @@ ToDo/Notes:
- Enable the code for setting the NT4 compatibility flag when we start - Enable the code for setting the NT4 compatibility flag when we start
making NTFS 1.2 specific modifications. making NTFS 1.2 specific modifications.
2.1.24-WIP
- Support journals ($LogFile) which have been modified by chkdsk. This
means users can boot into Windows after we marked the volume dirty.
The Windows boot will run chkdsk and then reboot. The user can then
immediately boot into Linux rather than having to do a full Windows
boot first before rebooting into Linux and we will recognize such a
journal and empty it as it is clean by definition.
- Support journals ($LogFile) with only one restart page as well as
journals with two different restart pages. We sanity check both and
either use the only sane one or the more recent one of the two in the
case that both are valid.
2.1.23 - Implement extension of resident files and make writing safe as well as 2.1.23 - Implement extension of resident files and make writing safe as well as
many bug fixes, cleanups, and enhancements... many bug fixes, cleanups, and enhancements...
......
...@@ -6,7 +6,7 @@ ntfs-objs := aops.o attrib.o collate.o compress.o debug.o dir.o file.o \ ...@@ -6,7 +6,7 @@ ntfs-objs := aops.o attrib.o collate.o compress.o debug.o dir.o file.o \
index.o inode.o mft.o mst.o namei.o runlist.o super.o sysctl.o \ index.o inode.o mft.o mst.o namei.o runlist.o super.o sysctl.o \
unistr.o upcase.o unistr.o upcase.o
EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.23\" EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.24-WIP\"
ifeq ($(CONFIG_NTFS_DEBUG),y) ifeq ($(CONFIG_NTFS_DEBUG),y)
EXTRA_CFLAGS += -DDEBUG EXTRA_CFLAGS += -DDEBUG
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* logfile.h - Defines for NTFS kernel journal ($LogFile) handling. Part of * logfile.h - Defines for NTFS kernel journal ($LogFile) handling. Part of
* the Linux-NTFS project. * the Linux-NTFS project.
* *
* Copyright (c) 2000-2004 Anton Altaparmakov * Copyright (c) 2000-2005 Anton Altaparmakov
* *
* This program/include file is free software; you can redistribute it and/or * This program/include file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published * modify it under the terms of the GNU General Public License as published
...@@ -296,9 +296,11 @@ typedef struct { ...@@ -296,9 +296,11 @@ typedef struct {
/* sizeof() = 160 (0xa0) bytes */ /* sizeof() = 160 (0xa0) bytes */
} __attribute__ ((__packed__)) LOG_CLIENT_RECORD; } __attribute__ ((__packed__)) LOG_CLIENT_RECORD;
extern BOOL ntfs_check_logfile(struct inode *log_vi); extern BOOL ntfs_check_logfile(struct inode *log_vi,
RESTART_PAGE_HEADER **rp);
extern BOOL ntfs_is_logfile_clean(struct inode *log_vi); extern BOOL ntfs_is_logfile_clean(struct inode *log_vi,
const RESTART_PAGE_HEADER *rp);
extern BOOL ntfs_empty_logfile(struct inode *log_vi); extern BOOL ntfs_empty_logfile(struct inode *log_vi);
......
...@@ -1133,7 +1133,8 @@ mft_unmap_out: ...@@ -1133,7 +1133,8 @@ mft_unmap_out:
* *
* Return TRUE on success or FALSE on error. * Return TRUE on success or FALSE on error.
*/ */
static BOOL load_and_check_logfile(ntfs_volume *vol) static BOOL load_and_check_logfile(ntfs_volume *vol,
RESTART_PAGE_HEADER **rp)
{ {
struct inode *tmp_ino; struct inode *tmp_ino;
...@@ -1145,7 +1146,7 @@ static BOOL load_and_check_logfile(ntfs_volume *vol) ...@@ -1145,7 +1146,7 @@ static BOOL load_and_check_logfile(ntfs_volume *vol)
/* Caller will display error message. */ /* Caller will display error message. */
return FALSE; return FALSE;
} }
if (!ntfs_check_logfile(tmp_ino)) { if (!ntfs_check_logfile(tmp_ino, rp)) {
iput(tmp_ino); iput(tmp_ino);
/* ntfs_check_logfile() will have displayed error output. */ /* ntfs_check_logfile() will have displayed error output. */
return FALSE; return FALSE;
...@@ -1687,6 +1688,7 @@ static BOOL load_system_files(ntfs_volume *vol) ...@@ -1687,6 +1688,7 @@ static BOOL load_system_files(ntfs_volume *vol)
struct super_block *sb = vol->sb; struct super_block *sb = vol->sb;
MFT_RECORD *m; MFT_RECORD *m;
VOLUME_INFORMATION *vi; VOLUME_INFORMATION *vi;
RESTART_PAGE_HEADER *rp;
ntfs_attr_search_ctx *ctx; ntfs_attr_search_ctx *ctx;
#ifdef NTFS_RW #ifdef NTFS_RW
int err; int err;
...@@ -1841,8 +1843,9 @@ get_ctx_vol_failed: ...@@ -1841,8 +1843,9 @@ get_ctx_vol_failed:
* Get the inode for the logfile, check it and determine if the volume * Get the inode for the logfile, check it and determine if the volume
* was shutdown cleanly. * was shutdown cleanly.
*/ */
if (!load_and_check_logfile(vol) || rp = NULL;
!ntfs_is_logfile_clean(vol->logfile_ino)) { if (!load_and_check_logfile(vol, &rp) ||
!ntfs_is_logfile_clean(vol->logfile_ino, rp)) {
static const char *es1a = "Failed to load $LogFile"; static const char *es1a = "Failed to load $LogFile";
static const char *es1b = "$LogFile is not clean"; static const char *es1b = "$LogFile is not clean";
static const char *es2 = ". Mount in Windows."; static const char *es2 = ". Mount in Windows.";
...@@ -1857,6 +1860,10 @@ get_ctx_vol_failed: ...@@ -1857,6 +1860,10 @@ get_ctx_vol_failed:
"continue nor on_errors=" "continue nor on_errors="
"remount-ro was specified%s", "remount-ro was specified%s",
es1, es2); es1, es2);
if (vol->logfile_ino) {
BUG_ON(!rp);
ntfs_free(rp);
}
goto iput_logfile_err_out; goto iput_logfile_err_out;
} }
sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME; sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME;
...@@ -1867,6 +1874,7 @@ get_ctx_vol_failed: ...@@ -1867,6 +1874,7 @@ get_ctx_vol_failed:
/* This will prevent a read-write remount. */ /* This will prevent a read-write remount. */
NVolSetErrors(vol); NVolSetErrors(vol);
} }
ntfs_free(rp);
#endif /* NTFS_RW */ #endif /* NTFS_RW */
/* Get the root directory inode so we can do path lookups. */ /* Get the root directory inode so we can do path lookups. */
vol->root_ino = ntfs_iget(sb, FILE_root); vol->root_ino = ntfs_iget(sb, FILE_root);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment