1. 03 Jun, 2011 4 commits
    • Ben Gardiner's avatar
      UBIFS: assert no fixup when writing a node · 4f1ab9b0
      Ben Gardiner authored
      The current free space fixup can result in some writing to the UBI volume
      when the space_fixup flag is set.
      
      To catch instances where UBIFS is writing to the NAND while the space_fixup
      flag is set, add an assert to ubifs_write_node().
      
      Artem: tweaked the patch, added similar assertion to the write buffer
             write path.
      Signed-off-by: default avatarBen Gardiner <bengardiner@nanometrics.ca>
      Reviewed-by: default avatarMatthew L. Creech <mlcreech@gmail.com>
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      4f1ab9b0
    • Artem Bityutskiy's avatar
      UBIFS: fix clean znode counter corruption in error cases · 83707237
      Artem Bityutskiy authored
      UBIFS maintains per-filesystem and global clean znode counters
      ('c->clean_zn_cnt' and 'ubifs_clean_zn_cnt'). It is important to maintain
      correct values there since the shrinker relies on 'ubifs_clean_zn_cnt'.
      
      However, in case of failures during commit the counters were corrupted. E.g.,
      if a failure happens in the middle of 'write_index()', then some nodes in the
      commit list ('c->cnext') are marked as clean, and some are marked as dirty. And
      the 'ubifs_destroy_tnc_subtree()' frees does not retrun correct count, and we
      end up with non-zero 'c->clean_zn_cnt' when unmounting. This means that if we
      have 2 file-sytem and one of them fails, and we unmount it,
      'ubifs_clean_zn_cnt' stays incorrect and confuses the shrinker.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      83707237
    • Artem Bityutskiy's avatar
      UBIFS: fix memory leak on error path · 812eb258
      Artem Bityutskiy authored
      UBIFS leaks memory on error path in 'ubifs_jnl_update()' in case of write
      failure because it forgets to free the 'struct ubifs_dent_node *dent' object.
      Although the object is small, the alignment can make it large - e.g., 2KiB
      if the min. I/O unit is 2KiB.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      Cc: stable@kernel.org
      812eb258
    • Artem Bityutskiy's avatar
      UBIFS: fix shrinker object count reports · cf610bf4
      Artem Bityutskiy authored
      Sometimes VM asks the shrinker to return amount of objects it can shrink,
      and we return the ubifs_clean_zn_cnt in that case. However, it is possible
      that this counter is negative for a short period of time, due to the way
      UBIFS TNC code updates it. And I can observe the following warnings sometimes:
      
      shrink_slab: ubifs_shrinker+0x0/0x2b7 [ubifs] negative objects to delete nr=-8541616642706119788
      
      This patch makes sure UBIFS never returns negative count of objects.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      Cc: stable@kernel.org
      cf610bf4
  2. 01 Jun, 2011 4 commits
    • Artem Bityutskiy's avatar
      UBIFS: fix recovery broken by the previous recovery fix · da8b94ea
      Artem Bityutskiy authored
      Unfortunately, the recovery fix d1606a59b6be4ea392eabd40d1250aa1eeb19efb
      (UBIFS: fix extremely rare mount failure) broke recovery. This commit make
      UBIFS drop the last min. I/O unit in all journal heads, but this is needed only
      for the GC head. And this does not work for non-GC heads. For example, if
      suppose we have min. I/O units A and B, and A contains a valid node X, which
      was fsynced, and then a group of nodes Y which spans the rest of A and B. In
      this case we'll drop not only Y, but also X, which is obviously incorrect.
      
      This patch fixes the issue and additionally makes recovery to drop last min.
      I/O unit only for the GC head, and leave things as they have been for ages for
      the other heads - this is safer.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      da8b94ea
    • Artem Bityutskiy's avatar
      UBIFS: amend ubifs_recover_leb interface · efcfde54
      Artem Bityutskiy authored
      Instead of passing "grouped" parameter to 'ubifs_recover_leb()' which tells
      whether the nodes are grouped in the LEB to recover, pass the journal head
      number and let 'ubifs_recover_leb()' look at the journal head's 'grouped' flag.
      
      This patch is a preparation to a further fix where we'll need to know the
      journal head number for other purposes.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      efcfde54
    • Artem Bityutskiy's avatar
      UBIFS: introduce a "grouped" journal head flag · 1a0b0699
      Artem Bityutskiy authored
      Journal heads are different in a way how UBIFS writes nodes there. All normal
      journal heads receive grouped nodes, while the GC journal heads receives
      ungrouped nodes. This patch adds a 'grouped' flag to 'struct ubifs_jhead' which
      describes this property.
      
      This patch is a preparation to a further recovery fix.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      1a0b0699
    • Artem Bityutskiy's avatar
      UBIFS: supress false error messages · ab75950b
      Artem Bityutskiy authored
      Commit ab51afe05273741f72383529ef488aa1ea598ec6 was a good clean-up, but
      it introduced a regression - now UBIFS prints scary error messages during
      recovery on all corrupted nodes, even though the corruptions are expected
      (due to a power cut). This patch fixes the issue.
      
      Additionally fix a typo in a commentary introduced by the same commit.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      ab75950b
  3. 30 May, 2011 1 commit
  4. 29 May, 2011 31 commits