1. 04 7月, 2011 5 次提交
  2. 20 6月, 2011 1 次提交
  3. 13 6月, 2011 2 次提交
    • A
      ubifs: fix sget races · d251ed27
      Al Viro 提交于
      * allocate ubifs_info in ->mount(), fill it enough for sb_test() and
      set ->s_fs_info to it in set() callback passed to sget().
      * do *not* free it in ->put_super(); do that in ->kill_sb() after we'd
      done kill_anon_super().
      * don't free it in ubifs_fill_super() either - deactivate_locked_super()
      done by caller when ubifs_fill_super() returns an error will take care
      of that sucker.
      * get rid of kludge with passing ubi to ubifs_fill_super() in ->s_fs_info;
      we only need it in alloc_ubifs_info(), so ubifs_fill_super() will need
      only ubifs_info.  Which it will find in ->s_fs_info just fine, no need to
      reassign anything...
      
      As the result, sb_test() becomes safe to apply to all superblocks that
      can be found by sget() (and a kludge with temporary use of ->s_fs_info
      to store a pointer to very different structure goes away).
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      d251ed27
    • A
      ubifs: split allocation of ubifs_info into a separate function · b1c27ab3
      Al Viro 提交于
      preparation to ubifs sget() race fixes
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      b1c27ab3
  4. 03 6月, 2011 6 次提交
  5. 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
  6. 30 5月, 2011 1 次提交
  7. 28 5月, 2011 1 次提交
  8. 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
  9. 26 5月, 2011 2 次提交
  10. 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
  11. 20 5月, 2011 1 次提交
  12. 16 5月, 2011 15 次提交
    • A
      UBIFS: fix extremely rare mount failure · bbf2b37a
      Artem Bityutskiy 提交于
      This patch fixes an extremely rare mount failure after a power cut, when mount
      fails with ENOSPC error because UBIFS could not find the GC LEB.
      
      In short, the reason for this failure is that after recovery the GC head LEB
      contains less free space than it had contained just before the power cut
      happened. As a result, if the FS is full, 'ubifs_rcvry_gc_commit()' is unable
      to find a dirty LEB to GC and a free LEB, so mount fails.
      
      This patch contains a huge comment with more detailed explanation, please refer
      that comment.
      
      Since this is really really rare and unlikely situation, I do not send this
      patch to the stable tree, also because it requires a lot of preparation
      patches which I did before. So sending this to -stable would be too risky.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      bbf2b37a
    • A
      UBIFS: simplify LEB recovery function further · 43e07073
      Artem Bityutskiy 提交于
      Further simplify 'ubifs_recover_leb()' by noticing that we have to call
      'clean_buf()' in any case, and it is fine to call it if the offset is
      aligned to 'c->min_io_size'. Thus, we do not have to call it separately
      from every "if" - just call it once at the end.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      43e07073
    • A
      UBIFS: always cleanup the recovered LEB · 7c47bfd0
      Artem Bityutskiy 提交于
      Now when we call 'ubifs_recover_leb()' only for LEBs which are potentially
      corrupted (i.e., only for last buds, not for all of them), we can cleanup every
      LEB, not only those where we find corruption. The reason - unstable bits. Even
      though the LEB may look good now, it might contain unstable bits which may hit
      us a bit later.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      7c47bfd0
    • A
      UBIFS: clean up LEB recovery function · 61799206
      Artem Bityutskiy 提交于
      This patch cleans up 'ubifs_recover_leb()' function and makes it more readable.
      Move things which are done only once out of the loop and kill unneeded 'switch'
      statement.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      61799206
    • M
      UBIFS: fix-up free space on mount if flag is set · 9d510db4
      Matthew L. Creech 提交于
      If a UBIFS filesystem is being mounted read-write, or is being remounted
      from read-only to read-write, check for the "space_fixup" flag and fix
      all LEBs containing empty space if necessary.
      
      Artem: tweaked the patch a bit
      Signed-off-by: NMatthew L. Creech <mlcreech@gmail.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      9d510db4
    • M
      UBIFS: add the fixup function · 6554a657
      Matthew L. Creech 提交于
      This patch adds the 'ubifs_fixup_free_space()' function which scans all
      LEBs in the filesystem for those that are in-use but have one or more
      empty pages, then re-maps the LEBs in order to erase the empty portions.
      Afterward it removes the "space_fixup" flag from the UBIFS superblock.
      
      Artem: massaged the patch
      Signed-off-by: NMatthew L. Creech <mlcreech@gmail.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      6554a657
    • M
      UBIFS: add a superblock flag for free space fix-up · 9f58d350
      Matthew L. Creech 提交于
      The 'space_fixup' flag can be set in the superblock of a new filesystem by
      mkfs.ubifs to indicate that any eraseblocks with free space remaining should be
      fixed-up the first time it's mounted (after which the flag is un-set). This
      means that the UBIFS image has been flashed by a "dumb" flasher and the free
      space has been actually programmed (writing all 0xFFs), so this free space
      cannot be used. UBIFS fixes the free space up by re-writing the contents of all
      LEBs with free space using the atomic LEB change UBI operation.
      
      Artem: improved commit message, add some more commentaries to the code.
      Signed-off-by: NMatthew L. Creech <mlcreech@gmail.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      9f58d350
    • A
      UBIFS: share the next_log_lnum helper · e11602ea
      Artem Bityutskiy 提交于
      We'll need to use the 'next_log_lnum()' helper function from log.c in the fixup
      code, so let's move it to misc.h. IOW, this is a preparation to the following
      free space fixup changes.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      e11602ea
    • A
      UBIFS: expect corruption only in last journal head LEBs · 91c66083
      Artem Bityutskiy 提交于
      This patch improves UBIFS recovery and teaches it to expect corruption only
      in the last buds. Indeed, currently we just recover all buds, which is
      incorrect because only the last buds can have corruptions in case of a power
      cut. So it is inconsistent with the rest of the recovery strategy which tries
      hard to distinguish between corruptions cause by power cuts and other types of
      corruptions.
      
      This patch also adds one quirk - a bit older UBIFS was could have corruption in
      the next to last bud because of the way it switched buds: when bud A is full,
      it first searched for the next bud B, the wrote a reference node to the log
      about B, and then synchronized the write-buffer of A. So we could end up with
      buds A and B, where B is the last, but A had corruption. The UBIFS behavior
      was fixed, though, so currently it always first synchronizes A's write-buffer
      and only after this adds B to the log. However, to be make sure that we handle
      unclean (after a power cut) UBIFS images belonging to older UBIFS - we need to
      add a quirk and keep it for some time: we need to check for the situation
      described above.
      
      Thankfully, it is easy to check for that situation. When UBIFS adds B to the
      log, it always first unmaps B, then maps it, and then syncs A's write-buffer.
      Thus, in that situation we can check that B is empty, in which case it is OK to
      have corruption in A. To check that B is empty it is enough to just read the
      first few bytes of the bud and compare them with 0xFFs. This quirk may be
      removed in a couple of years.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      91c66083
    • A
      UBIFS: synchronize write-buffer before switching to the next bud · cb14a184
      Artem Bityutskiy 提交于
      Currently when UBIFS fills up the current bud (which is the last in the journal
      head) and switches to the next bud, it first writes the log reference node for
      the next bud and only after this synchronizes the write-buffer of the previous
      bud. This is not a big deal, but an unclean power cut may lead to a situation
      when we have corruption in a next-to-last bud, although it is much more logical
      that we have to have corruption only in the last bud.
      
      This patch also removes write-buffer synchronization from
      'ubifs_wbuf_seek_nolock()' because this is not needed anymore (we synchronize
      the write-buffer explicitly everywhere now) and also because this is just
      prone to various errors.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      cb14a184
    • A
      UBIFS: remove BUG statement · c49139d8
      Artem Bityutskiy 提交于
      Remove a 'BUG()' statement when we are unable to find a bud and add a
      similar 'ubifs_assert()' statement instead.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      c49139d8
    • A
      UBIFS: change bud replay function conventions · e76a4526
      Artem Bityutskiy 提交于
      This is a minor preparation patch which changes 'replay_bud()' interface -
      instead of passing bud lnum, offs, jhead, etc directly, pass a pointer to the
      bud entry which contains all the information. The bud entry will be also needed
      in one of the following patches.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      e76a4526
    • A
      UBIFS: substitute the replay tree with a replay list · debf12d5
      Artem Bityutskiy 提交于
      This patch simplifies replay even further - it removes the replay tree and
      adds the replay list instead. Indeed, we just do not need to use a tree here -
      all we need to do is to add all nodes to the list and then sort it. Using
      RB-tree is an overkill - more code and slower. And since we replay buds in
      order, we expect the nodes to follow in _mostly_ sorted order, so the merge
      sort becomes much cheaper in average than an RB-tree.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      debf12d5
    • A
      UBIFS: simplify replay · 074bcb9b
      Artem Bityutskiy 提交于
      This patch simplifies the replay code and makes it smaller. First of all, we
      can notice that we do not really need to create bud replay entries and insert
      them to the replay tree, because the only reason we do this is to set buds
      lprops correctly at the end. Instead, we can just walk the list of buds at the
      very end and set lprops for each bud. This allows us to get rid of whole
      'insert_ref_node()' function, the 'REPLAY_REF' flag, and several fields in
      'struct replay_entry'. Then we can also notice that we do not need the 'flags'
      'struct replay_entry' field, because there is only one flag -
      'REPLAY_DELETION'. Instead, we can just add a 'deletion' bit fields. As a
      result, this patch deletes much more lines that in adds.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      074bcb9b
    • A
      UBIFS: store free and dirty space in the bud replay entry · af1dd412
      Artem Bityutskiy 提交于
      This is just a small preparation patch which adds 'free' and 'drity' fields to
      'struct bud_entry'. They will be used to set bud lprops.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      af1dd412