android_kernel_xiaomi_sm8350/fs/ext2
Vasily Averin 5a2b4062f5 [PATCH] ext2: errors behaviour fix
Current error behaviour for ext2 and ext3 filesystems does not fully
correspond to the documentation and should be fixed.

According to man 8 mount, ext2 and ext3 file systems allow to set one of 3
different on-errors behaviours:

  ---- start of quote man 8 mount ----

  errors=continue / errors=remount-ro / errors=panic

    Define the behaviour when an error is encountered.  (Either ignore
    errors and just mark the file system erroneous and continue, or remount
    the file system read-only, or panic and halt the system.) The default is
    set in the filesystem superblock, and can be changed using tune2fs(8).

  ---- end of quote ----

However EXT3_ERRORS_CONTINUE is not read from the superblock, and thus
ERRORS_CONT is not saved on the sbi->s_mount_opt.  It leads to the incorrect
handle of errors on ext3.

Then we've checked corresponding code in ext2 and discovered that it is buggy
as well:

- EXT2_ERRORS_CONTINUE is not read from the superblock (the same);

- parse_option() does not clean the alternative values and thus something
  like (ERRORS_CONT|ERRORS_RO) can be set;

- if options are omitted, parse_option() does not set any of these options.

Therefore it is possible to set any combination of these options on the ext2:

- none of them may be set: EXT2_ERRORS_CONTINUE on superblock / empty mount
  options;

- any of them may be set using mount options;

- 2 any options may be set: by using EXT2_ERRORS_RO/EXT2_ERRORS_PANIC on the
  superblock and other value in mount options;

- and finally all three options may be set by adding third option in remount.

Currently ext2 uses these values only in ext2_error() and it is not leading to
any noticeable troubles.  However somebody may be discouraged when he will try
to workaround EXT2_ERRORS_PANIC on the superblock by using errors=continue in
mount options.

This patch:

EXT2_ERRORS_CONTINUE should be read from the superblock as default value for
error behaviour.  parse_option() should clean the alternative options and
should not change default value taken from the superblock.

Signed-off-by: Vasily Averin <vvs@sw.ru>
Acked-by: Kirill Korotaev <dev@openvz.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-11 11:14:21 -07:00
..
acl.c [PATCH] fs: Removing useless casts 2006-09-27 08:26:10 -07:00
acl.h [PATCH] remove <linux/xattr_acl.h> 2005-06-23 09:45:33 -07:00
balloc.c [PATCH] EXT2: Remove superblock lock contention in ext2_statfs 2006-09-19 07:59:59 -07:00
dir.c [PATCH] BLOCK: Move the Ext2 device ioctl compat stuff to the Ext2 driver [try #6] 2006-09-30 20:52:29 +02:00
ext2.h [PATCH] BLOCK: Move the Ext2 device ioctl compat stuff to the Ext2 driver [try #6] 2006-09-30 20:52:29 +02:00
file.c [PATCH] Streamline generic_file_* interfaces and filemap cleanups 2006-10-01 00:39:28 -07:00
fsync.c [PATCH] ext2: cleanup: put_page and comment fix 2006-06-25 10:01:25 -07:00
ialloc.c [PATCH] inode-diet: Eliminate i_blksize from the inode structure 2006-09-27 08:26:18 -07:00
inode.c [PATCH] inode-diet: Eliminate i_blksize from the inode structure 2006-09-27 08:26:18 -07:00
ioctl.c [PATCH] BLOCK: Move the Ext2 device ioctl compat stuff to the Ext2 driver [try #6] 2006-09-30 20:52:29 +02:00
Makefile [PATCH] Make EXT2_DEBUG work again 2006-06-25 10:01:12 -07:00
namei.c [PATCH] r/o bind mounts: unlink: monitor i_nlink 2006-10-01 00:39:30 -07:00
super.c [PATCH] ext2: errors behaviour fix 2006-10-11 11:14:21 -07:00
symlink.c Fix nasty ncpfs symlink handling bug. 2005-08-19 18:02:56 -07:00
xattr_security.c [PATCH] ext2: Enable atomic inode security labeling 2005-09-09 13:57:27 -07:00
xattr_trusted.c [PATCH] capable/capability.h (fs/) 2006-01-11 18:42:13 -08:00
xattr_user.c [PATCH] remove ext2 xattr permission checks 2006-01-10 08:01:30 -08:00
xattr.c [PATCH] fs: Conversions from kmalloc+memset to k(z|c)alloc 2006-09-27 08:26:10 -07:00
xattr.h Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
xip.c [PATCH] fix xip sparse file handling in ext2 2005-07-27 16:25:53 -07:00
xip.h [PATCH] xip: ext2: execute in place 2005-06-24 00:06:41 -07:00