aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ntfs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ntfs/super.c')
-rw-r--r--fs/ntfs/super.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index 41aa8eb6755b..453d0d51ea4b 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -126,6 +126,14 @@ static BOOL parse_options(ntfs_volume *vol, char *opt)
126 if (*v) \ 126 if (*v) \
127 goto needs_val; \ 127 goto needs_val; \
128 } 128 }
129#define NTFS_GETOPT_OCTAL(option, variable) \
130 if (!strcmp(p, option)) { \
131 if (!v || !*v) \
132 goto needs_arg; \
133 variable = simple_strtoul(ov = v, &v, 8); \
134 if (*v) \
135 goto needs_val; \
136 }
129#define NTFS_GETOPT_BOOL(option, variable) \ 137#define NTFS_GETOPT_BOOL(option, variable) \
130 if (!strcmp(p, option)) { \ 138 if (!strcmp(p, option)) { \
131 BOOL val; \ 139 BOOL val; \
@@ -157,9 +165,9 @@ static BOOL parse_options(ntfs_volume *vol, char *opt)
157 *v++ = 0; 165 *v++ = 0;
158 NTFS_GETOPT("uid", uid) 166 NTFS_GETOPT("uid", uid)
159 else NTFS_GETOPT("gid", gid) 167 else NTFS_GETOPT("gid", gid)
160 else NTFS_GETOPT("umask", fmask = dmask) 168 else NTFS_GETOPT_OCTAL("umask", fmask = dmask)
161 else NTFS_GETOPT("fmask", fmask) 169 else NTFS_GETOPT_OCTAL("fmask", fmask)
162 else NTFS_GETOPT("dmask", dmask) 170 else NTFS_GETOPT_OCTAL("dmask", dmask)
163 else NTFS_GETOPT("mft_zone_multiplier", mft_zone_multiplier) 171 else NTFS_GETOPT("mft_zone_multiplier", mft_zone_multiplier)
164 else NTFS_GETOPT_WITH_DEFAULT("sloppy", sloppy, TRUE) 172 else NTFS_GETOPT_WITH_DEFAULT("sloppy", sloppy, TRUE)
165 else NTFS_GETOPT_BOOL("show_sys_files", show_sys_files) 173 else NTFS_GETOPT_BOOL("show_sys_files", show_sys_files)
@@ -1133,7 +1141,8 @@ mft_unmap_out:
1133 * 1141 *
1134 * Return TRUE on success or FALSE on error. 1142 * Return TRUE on success or FALSE on error.
1135 */ 1143 */
1136static BOOL load_and_check_logfile(ntfs_volume *vol) 1144static BOOL load_and_check_logfile(ntfs_volume *vol,
1145 RESTART_PAGE_HEADER **rp)
1137{ 1146{
1138 struct inode *tmp_ino; 1147 struct inode *tmp_ino;
1139 1148
@@ -1145,7 +1154,7 @@ static BOOL load_and_check_logfile(ntfs_volume *vol)
1145 /* Caller will display error message. */ 1154 /* Caller will display error message. */
1146 return FALSE; 1155 return FALSE;
1147 } 1156 }
1148 if (!ntfs_check_logfile(tmp_ino)) { 1157 if (!ntfs_check_logfile(tmp_ino, rp)) {
1149 iput(tmp_ino); 1158 iput(tmp_ino);
1150 /* ntfs_check_logfile() will have displayed error output. */ 1159 /* ntfs_check_logfile() will have displayed error output. */
1151 return FALSE; 1160 return FALSE;
@@ -1689,6 +1698,7 @@ static BOOL load_system_files(ntfs_volume *vol)
1689 VOLUME_INFORMATION *vi; 1698 VOLUME_INFORMATION *vi;
1690 ntfs_attr_search_ctx *ctx; 1699 ntfs_attr_search_ctx *ctx;
1691#ifdef NTFS_RW 1700#ifdef NTFS_RW
1701 RESTART_PAGE_HEADER *rp;
1692 int err; 1702 int err;
1693#endif /* NTFS_RW */ 1703#endif /* NTFS_RW */
1694 1704
@@ -1841,8 +1851,9 @@ get_ctx_vol_failed:
1841 * Get the inode for the logfile, check it and determine if the volume 1851 * Get the inode for the logfile, check it and determine if the volume
1842 * was shutdown cleanly. 1852 * was shutdown cleanly.
1843 */ 1853 */
1844 if (!load_and_check_logfile(vol) || 1854 rp = NULL;
1845 !ntfs_is_logfile_clean(vol->logfile_ino)) { 1855 if (!load_and_check_logfile(vol, &rp) ||
1856 !ntfs_is_logfile_clean(vol->logfile_ino, rp)) {
1846 static const char *es1a = "Failed to load $LogFile"; 1857 static const char *es1a = "Failed to load $LogFile";
1847 static const char *es1b = "$LogFile is not clean"; 1858 static const char *es1b = "$LogFile is not clean";
1848 static const char *es2 = ". Mount in Windows."; 1859 static const char *es2 = ". Mount in Windows.";
@@ -1857,6 +1868,10 @@ get_ctx_vol_failed:
1857 "continue nor on_errors=" 1868 "continue nor on_errors="
1858 "remount-ro was specified%s", 1869 "remount-ro was specified%s",
1859 es1, es2); 1870 es1, es2);
1871 if (vol->logfile_ino) {
1872 BUG_ON(!rp);
1873 ntfs_free(rp);
1874 }
1860 goto iput_logfile_err_out; 1875 goto iput_logfile_err_out;
1861 } 1876 }
1862 sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME; 1877 sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME;
@@ -1867,6 +1882,7 @@ get_ctx_vol_failed:
1867 /* This will prevent a read-write remount. */ 1882 /* This will prevent a read-write remount. */
1868 NVolSetErrors(vol); 1883 NVolSetErrors(vol);
1869 } 1884 }
1885 ntfs_free(rp);
1870#endif /* NTFS_RW */ 1886#endif /* NTFS_RW */
1871 /* Get the root directory inode so we can do path lookups. */ 1887 /* Get the root directory inode so we can do path lookups. */
1872 vol->root_ino = ntfs_iget(sb, FILE_root); 1888 vol->root_ino = ntfs_iget(sb, FILE_root);