aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ntfs/super.c
diff options
context:
space:
mode:
authorAnton Altaparmakov <aia21@cantab.net>2005-09-08 11:12:28 -0400
committerAnton Altaparmakov <aia21@cantab.net>2005-09-08 11:12:28 -0400
commite7a1033b946f4f2622f2b338ab107f559aad542c (patch)
tree333b235d6903392d269e0e5cab807631ab652854 /fs/ntfs/super.c
parentcaf39e87cc1182f7dae84eefc43ca14d54c78ef9 (diff)
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: Anton Altaparmakov <aia21@cantab.net>
Diffstat (limited to 'fs/ntfs/super.c')
-rw-r--r--fs/ntfs/super.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index 41aa8eb6755b..bf8569d503a6 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -1133,7 +1133,8 @@ mft_unmap_out:
1133 * 1133 *
1134 * Return TRUE on success or FALSE on error. 1134 * Return TRUE on success or FALSE on error.
1135 */ 1135 */
1136static BOOL load_and_check_logfile(ntfs_volume *vol) 1136static BOOL load_and_check_logfile(ntfs_volume *vol,
1137 RESTART_PAGE_HEADER **rp)
1137{ 1138{
1138 struct inode *tmp_ino; 1139 struct inode *tmp_ino;
1139 1140
@@ -1145,7 +1146,7 @@ static BOOL load_and_check_logfile(ntfs_volume *vol)
1145 /* Caller will display error message. */ 1146 /* Caller will display error message. */
1146 return FALSE; 1147 return FALSE;
1147 } 1148 }
1148 if (!ntfs_check_logfile(tmp_ino)) { 1149 if (!ntfs_check_logfile(tmp_ino, rp)) {
1149 iput(tmp_ino); 1150 iput(tmp_ino);
1150 /* ntfs_check_logfile() will have displayed error output. */ 1151 /* ntfs_check_logfile() will have displayed error output. */
1151 return FALSE; 1152 return FALSE;
@@ -1687,6 +1688,7 @@ static BOOL load_system_files(ntfs_volume *vol)
1687 struct super_block *sb = vol->sb; 1688 struct super_block *sb = vol->sb;
1688 MFT_RECORD *m; 1689 MFT_RECORD *m;
1689 VOLUME_INFORMATION *vi; 1690 VOLUME_INFORMATION *vi;
1691 RESTART_PAGE_HEADER *rp;
1690 ntfs_attr_search_ctx *ctx; 1692 ntfs_attr_search_ctx *ctx;
1691#ifdef NTFS_RW 1693#ifdef NTFS_RW
1692 int err; 1694 int err;
@@ -1841,8 +1843,9 @@ get_ctx_vol_failed:
1841 * Get the inode for the logfile, check it and determine if the volume 1843 * Get the inode for the logfile, check it and determine if the volume
1842 * was shutdown cleanly. 1844 * was shutdown cleanly.
1843 */ 1845 */
1844 if (!load_and_check_logfile(vol) || 1846 rp = NULL;
1845 !ntfs_is_logfile_clean(vol->logfile_ino)) { 1847 if (!load_and_check_logfile(vol, &rp) ||
1848 !ntfs_is_logfile_clean(vol->logfile_ino, rp)) {
1846 static const char *es1a = "Failed to load $LogFile"; 1849 static const char *es1a = "Failed to load $LogFile";
1847 static const char *es1b = "$LogFile is not clean"; 1850 static const char *es1b = "$LogFile is not clean";
1848 static const char *es2 = ". Mount in Windows."; 1851 static const char *es2 = ". Mount in Windows.";
@@ -1857,6 +1860,10 @@ get_ctx_vol_failed:
1857 "continue nor on_errors=" 1860 "continue nor on_errors="
1858 "remount-ro was specified%s", 1861 "remount-ro was specified%s",
1859 es1, es2); 1862 es1, es2);
1863 if (vol->logfile_ino) {
1864 BUG_ON(!rp);
1865 ntfs_free(rp);
1866 }
1860 goto iput_logfile_err_out; 1867 goto iput_logfile_err_out;
1861 } 1868 }
1862 sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME; 1869 sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME;
@@ -1867,6 +1874,7 @@ get_ctx_vol_failed:
1867 /* This will prevent a read-write remount. */ 1874 /* This will prevent a read-write remount. */
1868 NVolSetErrors(vol); 1875 NVolSetErrors(vol);
1869 } 1876 }
1877 ntfs_free(rp);
1870#endif /* NTFS_RW */ 1878#endif /* NTFS_RW */
1871 /* Get the root directory inode so we can do path lookups. */ 1879 /* Get the root directory inode so we can do path lookups. */
1872 vol->root_ino = ntfs_iget(sb, FILE_root); 1880 vol->root_ino = ntfs_iget(sb, FILE_root);