Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1cf3109f authored by Anton Altaparmakov's avatar Anton Altaparmakov
Browse files

NTFS: Do more detailed reporting of why we cannot mount read-write by


     special casing the VOLUME_MODIFIED_BY_CHKDSK flag.

Signed-off-by: default avatarAnton Altaparmakov <aia21@cantab.net>
parent 78af34f0
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -457,6 +457,12 @@ ChangeLog


Note, a technical ChangeLog aimed at kernel hackers is in fs/ntfs/ChangeLog.
Note, a technical ChangeLog aimed at kernel hackers is in fs/ntfs/ChangeLog.


2.1.26:
	- Implement support for sector sizes above 512 bytes (up to the maximum
	  supported by NTFS which is 4096 bytes).
	- Enhance support for NTFS volumes which were supported by Windows but
	  not by Linux due to invalid attribute list attribute flags.
	- A few minor updates and bug fixes.
2.1.25:
2.1.25:
	- Write support is now extended with write(2) being able to both
	- Write support is now extended with write(2) being able to both
	  overwrite existing file data and to extend files.  Also, if a write
	  overwrite existing file data and to extend files.  Also, if a write
+2 −0
Original line number Original line Diff line number Diff line
@@ -29,6 +29,8 @@ ToDo/Notes:
	  kmem_cache_t.  (Pekka Enberg)
	  kmem_cache_t.  (Pekka Enberg)
	- Implement support for sector sizes above 512 bytes (up to the maximum
	- Implement support for sector sizes above 512 bytes (up to the maximum
	  supported by NTFS which is 4096 bytes).
	  supported by NTFS which is 4096 bytes).
	- Do more detailed reporting of why we cannot mount read-write by
	  special casing the VOLUME_MODIFIED_BY_CHKDSK flag.
	- Miscellaneous updates to layout.h.
	- Miscellaneous updates to layout.h.
	- Cope with attribute list attribute having invalid flags.  Windows
	- Cope with attribute list attribute having invalid flags.  Windows
	  copes with this and even chkdsk does not detect or fix this so we
	  copes with this and even chkdsk does not detect or fix this so we
+1 −1
Original line number Original line Diff line number Diff line
@@ -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.25\"
EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.26\"


ifeq ($(CONFIG_NTFS_DEBUG),y)
ifeq ($(CONFIG_NTFS_DEBUG),y)
EXTRA_CFLAGS += -DDEBUG
EXTRA_CFLAGS += -DDEBUG
+27 −7
Original line number Original line Diff line number Diff line
@@ -472,9 +472,16 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)
			ntfs_error(sb, "Volume is dirty and read-only%s", es);
			ntfs_error(sb, "Volume is dirty and read-only%s", es);
			return -EROFS;
			return -EROFS;
		}
		}
		if (vol->vol_flags & VOLUME_MODIFIED_BY_CHKDSK) {
			ntfs_error(sb, "Volume has been modified by chkdsk "
					"and is read-only%s", es);
			return -EROFS;
		}
		if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) {
		if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) {
			ntfs_error(sb, "Volume has unsupported flags set and "
			ntfs_error(sb, "Volume has unsupported flags set "
					"is read-only%s", es);
					"(0x%x) and is read-only%s",
					(unsigned)le16_to_cpu(vol->vol_flags),
					es);
			return -EROFS;
			return -EROFS;
		}
		}
		if (ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) {
		if (ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) {
@@ -1845,11 +1852,24 @@ static BOOL load_system_files(ntfs_volume *vol)
	/* Make sure that no unsupported volume flags are set. */
	/* Make sure that no unsupported volume flags are set. */
	if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) {
	if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) {
		static const char *es1a = "Volume is dirty";
		static const char *es1a = "Volume is dirty";
		static const char *es1b = "Volume has unsupported flags set";
		static const char *es1b = "Volume has been modified by chkdsk";
		static const char *es2 = ".  Run chkdsk and mount in Windows.";
		static const char *es1c = "Volume has unsupported flags set";
		const char *es1;
		static const char *es2a = ".  Run chkdsk and mount in Windows.";
		
		static const char *es2b = ".  Mount in Windows.";
		es1 = vol->vol_flags & VOLUME_IS_DIRTY ? es1a : es1b;
		const char *es1, *es2;

		es2 = es2a;
		if (vol->vol_flags & VOLUME_IS_DIRTY)
			es1 = es1a;
		else if (vol->vol_flags & VOLUME_MODIFIED_BY_CHKDSK) {
			es1 = es1b;
			es2 = es2b;
		} else {
			es1 = es1c;
			ntfs_warning(sb, "Unsupported volume flags 0x%x "
					"encountered.",
					(unsigned)le16_to_cpu(vol->vol_flags));
		}
		/* If a read-write mount, convert it to a read-only mount. */
		/* If a read-write mount, convert it to a read-only mount. */
		if (!(sb->s_flags & MS_RDONLY)) {
		if (!(sb->s_flags & MS_RDONLY)) {
			if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO |
			if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO |
+4 −6
Original line number Original line Diff line number Diff line
@@ -3,10 +3,7 @@
 *	      Part of the Linux-NTFS project.
 *	      Part of the Linux-NTFS project.
 *
 *
 * Copyright (c) 2001 Richard Russon <ntfs@flatcap.org>
 * Copyright (c) 2001 Richard Russon <ntfs@flatcap.org>
 * Copyright (c) 2001-2004 Anton Altaparmakov
 * Copyright (c) 2001-2006 Anton Altaparmakov
 *
 * Modified for mkntfs inclusion 9 June 2001 by Anton Altaparmakov.
 * Modified for kernel inclusion 10 September 2001 by Anton Altparmakov.
 *
 *
 * This program is free software; you can redistribute it and/or modify it
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * under the terms of the GNU General Public License as published by the Free
@@ -75,12 +72,13 @@ ntfschar *generate_default_upcase(void)
	if (!uc)
	if (!uc)
		return uc;
		return uc;
	memset(uc, 0, default_upcase_len * sizeof(ntfschar));
	memset(uc, 0, default_upcase_len * sizeof(ntfschar));
	/* Generate the little endian Unicode upcase table used by ntfs. */
	for (i = 0; i < default_upcase_len; i++)
	for (i = 0; i < default_upcase_len; i++)
		uc[i] = cpu_to_le16(i);
		uc[i] = cpu_to_le16(i);
	for (r = 0; uc_run_table[r][0]; r++)
	for (r = 0; uc_run_table[r][0]; r++)
		for (i = uc_run_table[r][0]; i < uc_run_table[r][1]; i++)
		for (i = uc_run_table[r][0]; i < uc_run_table[r][1]; i++)
			uc[i] = cpu_to_le16((le16_to_cpu(uc[i]) +
			uc[i] = cpu_to_le16(le16_to_cpu(uc[i]) +
					uc_run_table[r][2]));
					uc_run_table[r][2]);
	for (r = 0; uc_dup_table[r][0]; r++)
	for (r = 0; uc_dup_table[r][0]; r++)
		for (i = uc_dup_table[r][0]; i < uc_dup_table[r][1]; i += 2)
		for (i = uc_dup_table[r][0]; i < uc_dup_table[r][1]; i += 2)
			uc[i + 1] = cpu_to_le16(le16_to_cpu(uc[i + 1]) - 1);
			uc[i + 1] = cpu_to_le16(le16_to_cpu(uc[i + 1]) - 1);
Loading