diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2013-03-14 04:49:23 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2013-03-14 05:20:22 -0400 |
commit | 67e753ca41782913d805ff4a8a2b0f60b26b7915 (patch) | |
tree | b7a7e8a033fdc6427f42c320c0b6f12628bdd8ac /fs | |
parent | f6161aa153581da4a3867a2d1a7caf4be19b6ec9 (diff) |
UBIFS: make space fixup work in the remount case
The UBIFS space fixup is a useful feature which allows to fixup the "broken"
flash space at the time of the first mount. The "broken" space is usually the
result of using a "dumb" industrial flasher which is not able to skip empty
NAND pages and just writes all 0xFFs to the empty space, which has grave
side-effects for UBIFS when UBIFS trise to write useful data to those empty
pages.
The fix-up feature works roughly like this:
1. mkfs.ubifs sets the fixup flag in UBIFS superblock when creating the image
(see -F option)
2. when the file-system is mounted for the first time, UBIFS notices the fixup
flag and re-writes the entire media atomically, which may take really a lot
of time.
3. UBIFS clears the fixup flag in the superblock.
This works fine when the file system is mounted R/W for the very first time.
But it did not really work in the case when we first mount the file-system R/O,
and then re-mount R/W. The reason was that we started the fixup procedure too
late, which we cannot really do because we have to fixup the space before it
starts being used.
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Reported-by: Mark Jackson <mpfj-list@mimc.co.uk>
Cc: stable@vger.kernel.org # 3.0+
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ubifs/super.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index ac838b844936..f21acf0ef01f 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -1568,6 +1568,12 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
1568 | c->remounting_rw = 1; | 1568 | c->remounting_rw = 1; |
1569 | c->ro_mount = 0; | 1569 | c->ro_mount = 0; |
1570 | 1570 | ||
1571 | if (c->space_fixup) { | ||
1572 | err = ubifs_fixup_free_space(c); | ||
1573 | if (err) | ||
1574 | return err; | ||
1575 | } | ||
1576 | |||
1571 | err = check_free_space(c); | 1577 | err = check_free_space(c); |
1572 | if (err) | 1578 | if (err) |
1573 | goto out; | 1579 | goto out; |
@@ -1684,12 +1690,6 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
1684 | err = dbg_check_space_info(c); | 1690 | err = dbg_check_space_info(c); |
1685 | } | 1691 | } |
1686 | 1692 | ||
1687 | if (c->space_fixup) { | ||
1688 | err = ubifs_fixup_free_space(c); | ||
1689 | if (err) | ||
1690 | goto out; | ||
1691 | } | ||
1692 | |||
1693 | mutex_unlock(&c->umount_mutex); | 1693 | mutex_unlock(&c->umount_mutex); |
1694 | return err; | 1694 | return err; |
1695 | 1695 | ||