linux/fs/ubifs
Artem Bityutskiy 2680d722bf UBIFS: introduce new flag for RO due to errors
The R/O state may have various reasons:

1. The UBI volume is R/O
2. The FS is mounted R/O
3. The FS switched to R/O mode because of an error

However, in UBIFS we have only one variable which represents cases
1 and 3 - 'c->ro_media'. Indeed, we set this to 1 if we switch to
R/O mode due to an error, and then we test it in many places to
make sure that we stop writing as soon as the error happens.

But this is very unclean. One consequence of this, for example, is
that in 'ubifs_remount_fs()' we use 'c->ro_media' to check whether
we are in R/O mode because on an error, and we print a message
in this case. However, if we are in R/O mode because the media
is R/O, our message is bogus.

This patch introduces new flag - 'c->ro_error' which is set when
we switch to R/O mode because of an error. It also changes all
"if (c->ro_media)" checks to "if (c->ro_error)" checks, because
this is what the checks actually mean. We do not need to check
for 'c->ro_media' because if the UBI volume is in R/O mode, we
do not allow R/W mounting, and now writes can happen. This is
guaranteed by VFS. But it is good to double-check this, so this
patch also adds many "ubifs_assert(!c->ro_media)" checks.

In the 'ubifs_remount_fs()' function this patch makes a bit more
changes - it fixes the error messages as well.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-09-17 17:08:09 +03:00
..
budget.c writeback: enforce s_umount locking in writeback_inodes_sb 2010-06-11 12:58:07 +02:00
commit.c UBIFS: introduce new flag for RO due to errors 2010-09-17 17:08:09 +03:00
compress.c UBIFS: fix sparse warnings 2008-12-31 14:13:24 +02:00
debug.c UBIFS: introduce list sorting debugging checks 2010-08-30 10:19:09 +03:00
debug.h UBIFS: introduce list sorting debugging checks 2010-08-30 10:19:09 +03:00
dir.c ubifs: replace inode uid,gid,mode initialization with helper function 2010-05-21 18:31:26 -04:00
file.c UBIFS: introduce new flag for RO due to errors 2010-09-17 17:08:09 +03:00
find.c UBIFS: improve find function interface 2009-03-08 13:29:09 +02:00
gc.c UBIFS: introduce new flag for RO due to errors 2010-09-17 17:08:09 +03:00
io.c UBIFS: introduce new flag for RO due to errors 2010-09-17 17:08:09 +03:00
ioctl.c headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
journal.c UBIFS: introduce new flag for RO due to errors 2010-09-17 17:08:09 +03:00
Kconfig Revert "lib: build list_sort() only if needed" 2010-03-07 09:54:44 -08:00
key.h UBIFS: mark unused key objects as invalid 2010-08-30 10:19:08 +03:00
log.c UBIFS: introduce new flag for RO due to errors 2010-09-17 17:08:09 +03:00
lprops.c UBIFS: improve lprops dump 2009-09-15 17:09:48 +03:00
lpt_commit.c UBIFS: check return code of pnode_lookup 2010-09-07 12:10:43 +03:00
lpt.c UBIFS: check return code of ubifs_lpt_lookup 2010-09-07 12:09:41 +03:00
Makefile
master.c UBIFS: introduce new flag for RO due to errors 2010-09-17 17:08:09 +03:00
misc.h UBIFS: introduce new flag for RO due to errors 2010-09-17 17:08:09 +03:00
orphan.c UBIFS: check ubifs_scan error codes better 2009-09-10 12:06:47 +03:00
recovery.c UBIFS: fix GC LEB recovery 2010-07-13 06:51:57 +03:00
replay.c UBIFS: do not print scary error messages needlessly 2009-09-10 12:06:47 +03:00
sb.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
scan.c UBIFS: mark unused key objects as invalid 2010-08-30 10:19:08 +03:00
shrinker.c UBIFS: introduce new flag for RO due to errors 2010-09-17 17:08:09 +03:00
super.c UBIFS: introduce new flag for RO due to errors 2010-09-17 17:08:09 +03:00
tnc_commit.c UBIFS: do not print scary error messages needlessly 2009-09-10 12:06:47 +03:00
tnc_misc.c UBIFS: correct key comparison 2008-09-30 11:12:57 +03:00
tnc.c UBIFS: mark unused key objects as invalid 2010-08-30 10:19:08 +03:00
ubifs-media.h UBIFS: define journal head numbers in ubifs-media.h 2009-09-15 14:45:35 +03:00
ubifs.h UBIFS: introduce new flag for RO due to errors 2010-09-17 17:08:09 +03:00
xattr.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00