1. 03 6月, 2011 2 次提交
    • 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 1 次提交
  4. 28 5月, 2011 1 次提交
  5. 27 5月, 2011 1 次提交
    • C
      fs: pass exact type of data dirties to ->dirty_inode · aa385729
      Christoph Hellwig 提交于
      Tell the filesystem if we just updated timestamp (I_DIRTY_SYNC) or
      anything else, so that the filesystem can track internally if it
      needs to push out a transaction for fdatasync or not.
      
      This is just the prototype change with no user for it yet.  I plan
      to push large XFS changes for the next merge window, and getting
      this trivial infrastructure in this window would help a lot to avoid
      tree interdependencies.
      
      Also remove incorrect comments that ->dirty_inode can't block.  That
      has been changed a long time ago, and many implementations rely on it.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      aa385729
  6. 26 5月, 2011 2 次提交
  7. 23 5月, 2011 1 次提交
    • A
      UBIFS: switch to dynamic printks · 56e46742
      Artem Bityutskiy 提交于
      Switch to debugging using dynamic printk (pr_debug()). There is no good reason
      to carry custom debugging prints if there is so cool and powerful generic
      dynamic printk infrastructure, see Documentation/dynamic-debug-howto.txt. With
      dynamic printks we can switch on/of individual prints, per-file, per-function
      and per format messages. This means that instead of doing old-fashioned
      
      echo 1 > /sys/module/ubifs/parameters/debug_msgs
      
      to enable general messages, we can do:
      
      echo 'format "UBIFS DBG gen" +ptlf' > control
      
      to enable general messages and additionally ask the dynamic printk
      infrastructure to print process ID, line number and function name. So there is
      no reason to keep UBIFS-specific crud if there is more powerful generic thing.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      56e46742
  8. 20 5月, 2011 1 次提交
  9. 16 5月, 2011 24 次提交
  10. 14 5月, 2011 3 次提交
    • A
      UBIFS: fix a rare memory leak in ro to rw remounting path · eaeee242
      Artem Bityutskiy 提交于
      When re-mounting from R/O mode to R/W mode and the LEB count in the superblock
      is not up-to date, because for the underlying UBI volume became larger, we
      re-write the superblock. We allocate RAM for these purposes, but never free it.
      So this is a memory leak, although very rare one.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      Cc: stable@kernel.org
      eaeee242
    • A
      UBIFS: fix inode size debugging check failure · c1f1f91d
      Artem Bityutskiy 提交于
      This patch fixes a problem with the following symptoms:
      
      UBIFS: deferred recovery completed
      UBIFS error (pid 15676): dbg_check_synced_i_size: ui_size is 11481088, synced_i_size is 11459081, but inode is clean
      UBIFS error (pid 15676): dbg_check_synced_i_size: i_ino 128, i_mode 0x81a4, i_size 11481088
      
      It happens when additional debugging checks are enabled and we are recovering
      from a power cut. When we fixup corrupted inode size during recovery, we change
      them in-place and we change ui_size as well, but not synced_i_size, which
      causes this failure. This patch makes sure we change both fields and fixes the
      issue.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      c1f1f91d
    • A
      UBIFS: fix debugging FS checking failure · 45cd5cdd
      Artem Bityutskiy 提交于
      When the debugging self-checks are enabled, we go trough whole file-system
      after mount and check/validate every single node referred to by the index.
      This is implemented by the 'dbg_check_filesystem()' function. However, this
      function fails if we mount "unclean" file-system, i.e., if we mount the
      file-system after a power cut. It fails with the following symptoms:
      
      UBIFS DBG (pid 8171): ubifs_recover_size: ino 937 size 3309925 -> 3317760
      UBIFS: recovery deferred
      UBIFS error (pid 8171): check_leaf: data node at LEB 1000:0 is not within inode size 3309925
      
      The reason of failure is that recovery fixed up the inode size in memory, but
      not on the flash so far. So the value on the flash is incorrect so far,
      and would be corrected when we re-mount R/W. But 'check_leaf()' ignores
      this fact and tries to validate the size of the on-flash inode, which is
      incorrect, so it fails.
      
      This patch teaches the checking code to look at the VFS inode cache first,
      and if there is the inode in question, use that inode instead of the inode
      on the flash media. This fixes the issue.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      45cd5cdd