Commit d14e09af authored by Anton Altaparmakov's avatar Anton Altaparmakov

NTFS: 2.1.10 - Force read-only (re)mounting of volumes with unsupported flags.

parent 9d41ab4c
......@@ -273,6 +273,9 @@ ChangeLog
Note, a technical ChangeLog aimed at kernel hackers is in fs/ntfs/ChangeLog.
2.1.10:
- Force read-only (re)mounting of volumes with unsupported volume
flags and various cleanups.
2.1.9:
- Fix two bugs in handling of corner cases in the decompression engine.
2.1.8:
......
......@@ -19,9 +19,23 @@ ToDo:
sufficient for synchronisation here. We then just need to make sure
ntfs_readpage/writepage/truncate interoperate properly with us.
2.1.10 - .
2.1.10 - Force read-only (re)mounting of volumes with unsupported volume flags.
- Finish off the white space cleanups (remove trailing spaces, etc).
- Clean up ntfs_fill_super() and ntfs_read_inode_mount() by removing
the kludges around the first iget(). Instead of (re)setting ->s_op
we have the $MFT inode set up by explicit new_inode() / set ->i_ino /
insert_inode_hash() / call ntfs_read_inode_mount() directly. This
kills the need for second super_operations and allows to return error
from ntfs_read_inode_mount() without resorting to ugly "poisoning"
tricks. (Al Viro)
- Force read-only (re)mounting if any of the following bits are set in
the volume information flags:
VOLUME_IS_DIRTY, VOLUME_RESIZE_LOG_FILE,
VOLUME_UPGRADE_ON_MOUNT, VOLUME_DELETE_USN_UNDERWAY,
VOLUME_REPAIR_OBJECT_ID, VOLUME_MODIFIED_BY_CHKDSK
To make this easier we define VOLUME_MUST_MOUNT_RO_MASK with all the
above bits set so the test is made easy.
2.1.9 - Fix two bugs in decompression engine.
......
......@@ -5,7 +5,7 @@ obj-$(CONFIG_NTFS_FS) += ntfs.o
ntfs-objs := aops.o attrib.o compress.o debug.o dir.o file.o inode.o logfile.o \
mft.o mst.o namei.o super.o sysctl.o unistr.o upcase.o
EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.10-WIP\"
EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.10\"
ifeq ($(CONFIG_NTFS_DEBUG),y)
EXTRA_CFLAGS += -DDEBUG
......
......@@ -1790,6 +1790,9 @@ typedef enum {
VOLUME_REPAIR_OBJECT_ID = const_cpu_to_le16(0x0020),
VOLUME_MODIFIED_BY_CHKDSK = const_cpu_to_le16(0x8000),
VOLUME_FLAGS_MASK = const_cpu_to_le16(0x803f),
/* To make our life easier when checking if we must mount read-only. */
VOLUME_MUST_MOUNT_RO_MASK = const_cpu_to_le16(0x8037),
} __attribute__ ((__packed__)) VOLUME_FLAGS;
/*
......
......@@ -28,8 +28,6 @@
#include "inode.h"
extern int format_mft_record(ntfs_inode *ni, MFT_RECORD *m);
//extern int format_mft_record2(struct super_block *vfs_sb,
// const unsigned long inum, MFT_RECORD *m);
extern MFT_RECORD *map_mft_record(ntfs_inode *ni);
extern void unmap_mft_record(ntfs_inode *ni);
......
......@@ -314,7 +314,9 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)
#else /* ! NTFS_RW */
/*
* For the read-write compiled driver, if we are remounting read-write,
* make sure there aren't any volume errors and empty the lofgile.
* make sure there are no volume errors and that no unsupported volume
* flags are set. Also, empty the logfile journal as it would become
* stale as soon as something is written to the volume.
*/
if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) {
static const char *es = ". Cannot remount read-write.";
......@@ -324,6 +326,11 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)
es);
return -EROFS;
}
if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) {
ntfs_error(sb, "Volume has unsupported flags set and "
"is read-only%s", es);
return -EROFS;
}
if (!ntfs_empty_logfile(vol->logfile_ino)) {
ntfs_error(sb, "Failed to empty journal $LogFile%s",
es);
......@@ -1133,6 +1140,31 @@ static BOOL load_system_files(ntfs_volume *vol)
printk(KERN_INFO "NTFS volume version %i.%i.\n", vol->major_ver,
vol->minor_ver);
#ifdef NTFS_RW
/* Make sure that no unsupported volume flags are set. */
if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) {
static const char *es1 = "Volume has unsupported flags set ";
static const char *es2 = ". Run chkdsk and mount in Windows.";
/* If a read-write mount, convert it to a read-only mount. */
if (!(sb->s_flags & MS_RDONLY)) {
if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO |
ON_ERRORS_CONTINUE))) {
ntfs_error(sb, "%s and neither on_errors="
"continue nor on_errors="
"remount-ro was specified%s",
es1, es2);
goto iput_vol_err_out;
}
sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME;
ntfs_error(sb, "%s. Mounting read-only%s", es1, es2);
} else
ntfs_warning(sb, "%s. Will not be able to remount "
"read-write%s", es1, es2);
/*
* Do not set NVolErrors() because ntfs_remount() re-checks the
* flags which we need to do in case any flags have changed.
*/
}
/*
* Get the inode for the logfile, check it and determine if the volume
* was shutdown cleanly.
......@@ -1240,6 +1272,7 @@ static BOOL load_system_files(ntfs_volume *vol)
#ifdef NTFS_RW
if (vol->logfile_ino)
iput(vol->logfile_ino);
iput_vol_err_out:
#endif /* NTFS_RW */
iput(vol->vol_ino);
iput_lcnbmp_err_out:
......
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