1. 03 6月, 2011 5 次提交
    • B
      UBIFS: intialize LPT earlier · 781c5717
      Ben Gardiner 提交于
      The current 'mount_ubifs()' implementation does not initialize the LPT until the
      the master node is marked dirty. Move the LPT initialization to before marking
      the master node dirty. This is a preparation for the next patch which will move
      the free-space-fixup check to before marking the master node dirty, because we
      have to fix-up the free space before doing any writes.
      
      Artem: massaged the patch and commit message.
      Signed-off-by: NBen Gardiner <bengardiner@nanometrics.ca>
      Reviewed-by: NMatthew L. Creech <mlcreech@gmail.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      781c5717
    • B
      UBIFS: assert no fixup when writing a node · 4f1ab9b0
      Ben Gardiner 提交于
      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: NBen Gardiner <bengardiner@nanometrics.ca>
      Reviewed-by: NMatthew L. Creech <mlcreech@gmail.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      4f1ab9b0
    • A
      UBIFS: fix clean znode counter corruption in error cases · 83707237
      Artem Bityutskiy 提交于
      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: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      83707237
    • A
      UBIFS: fix memory leak on error path · 812eb258
      Artem Bityutskiy 提交于
      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: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      Cc: stable@kernel.org
      812eb258
    • A
      UBIFS: fix shrinker object count reports · cf610bf4
      Artem Bityutskiy 提交于
      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: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      Cc: stable@kernel.org
      cf610bf4
  2. 01 6月, 2011 4 次提交
    • A
      UBIFS: fix recovery broken by the previous recovery fix · da8b94ea
      Artem Bityutskiy 提交于
      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: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      da8b94ea
    • A
      UBIFS: amend ubifs_recover_leb interface · efcfde54
      Artem Bityutskiy 提交于
      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: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      efcfde54
    • A
      UBIFS: introduce a "grouped" journal head flag · 1a0b0699
      Artem Bityutskiy 提交于
      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: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      1a0b0699
    • A
      UBIFS: supress false error messages · ab75950b
      Artem Bityutskiy 提交于
      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: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      ab75950b
  3. 30 5月, 2011 31 次提交