1. 10 2月, 2015 1 次提交
    • H
      UBIFS: return -EINVAL if log head is empty · 88cff0f0
      hujianyang 提交于
      CS node is recognized as a sign in UBIFS log replay mechanism.
      Log relaying during mount should find the CS node in log head
      at beginning and then replay the following uncommitted buds.
      
      Here is a bug in log replay path: If the log head, which is
      indicated by @log_lnum in mst_node, is empty, current UBIFS
      replay nothing and directly mount the partition without any
      warning. This action will put filesystem in an abnormal state,
      e.g. space management in LPT area is incorrect to the real
      space usage in main area.
      
      We reproduced this bug by fault injection: turn log head leb
      into all 0xFF. UBIFS driver mount the polluted partition
      normally. But errors occur while running fs_stress on this
      mount:
      
      [89068.055183] UBI error: ubi_io_read: error -74 (ECC error) while reading 59 bytes from PEB 711:33088, read 59 bytes
      [89068.179877] UBIFS error (pid 10517): ubifs_check_node: bad magic 0x101031, expected 0x6101831
      [89068.179882] UBIFS error (pid 10517): ubifs_check_node: bad node at LEB 591:28992
      [89068.179891] Not a node, first 24 bytes:
      [89068.179892] 00000000: 31 10 10 00 37 84 64 04 10 04 00 00 00 00 00 00 20 00 00 00 02 01 00 00                          1...7.d......... .......
      [89068.180282] UBIFS error (pid 10517): ubifs_read_node: expected node type 2
      
      This patch fix the problem by checking *lnum* to guarantee
      the empty leb is not log head leb and return an error if the
      log head leb is incorrectly empty. After this, we could catch
      *log head empty* error in place.
      Signed-off-by: Nhujianyang <hujianyang@huawei.com>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      88cff0f0
  2. 31 8月, 2012 2 次提交
  3. 21 8月, 2012 1 次提交
  4. 20 7月, 2012 1 次提交
  5. 21 5月, 2012 1 次提交
  6. 17 5月, 2012 2 次提交
  7. 13 1月, 2012 1 次提交
    • A
      UBIFS: fix key printing · 515315a1
      Artem Bityutskiy 提交于
      Before commit 56e46742 we have had locking
      around all printing macros and we could use static buffers for creating
      key strings and printing them. However, now we do not have that locking and
      we cannot use static buffers. This commit removes the old DBGKEY() macros
      and introduces few new helper macros for printing debugging messages plus
      a key at the end. Thankfully, all the messages are already structures in
      a way that the key is printed in the end.
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      515315a1
  8. 04 7月, 2011 1 次提交
  9. 01 6月, 2011 1 次提交
    • 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
  10. 16 5月, 2011 9 次提交
    • 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: 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
    • A
      UBIFS: double check that buds are replied in order · 7703f09d
      Artem Bityutskiy 提交于
      Commit 52c6e6f9 provides misleading infomation
      in the commit messages - buds are replied in order. And the real reason why
      that fix helped is probably because it made sure we seek head even in read-only
      mode (so deferred recovery will have seeked heads).
      
      This patch adds an assertion which will fire if we reply buds out of order.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      7703f09d
    • A
      UBIFS: improve commentary · 7a9c3e39
      Artem Bityutskiy 提交于
      This is a tiny clean-up patch which improves replay commentaries.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      7a9c3e39
    • A
      UBIFS: improve debugging messages · c839e297
      Artem Bityutskiy 提交于
      Print a bit more information is some recovery and replay paths.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      c839e297
  11. 14 5月, 2011 1 次提交
  12. 03 5月, 2011 1 次提交
    • A
      UBIFS: seek journal heads to the latest bud in replay · 52c6e6f9
      Artem Bityutskiy 提交于
      This is the second fix of the following symptom:
      
      UBIFS error (pid 34456): could not find an empty LEB
      
      which sometimes happens after power cuts when we mount the file-system - UBIFS
      refuses it with the above error message which comes from the
      'ubifs_rcvry_gc_commit()' function. I can reproduce this using the integck test
      with the UBIFS power cut emulation enabled.
      
      Analysis of the problem.
      
      Currently UBIFS replay seeks the journal heads to the last _replayed_ bud.
      But the buds are replayed out-of-order, so the replay basically seeks journal
      heads to the "random" bud belonging to this head, and not to the _last_ one.
      
      The result of this is that the GC head may be seeked to a full LEB with no free
      space, or very little free space. And 'ubifs_rcvry_gc_commit()' tries to find a
      fully or mostly dirty LEB to match the current GC head (because we need to
      garbage-collect that dirty LEB at one go, because we do not have @c->gc_lnum).
      So 'ubifs_find_dirty_leb()' fails and we fall back to finding an empty LEB and
      also fail. As a result - recovery fails and mounting fails.
      
      This patch teaches the replay to initialize the GC heads exactly to the latest
      buds, i.e. the buds which have the largest sequence number in corresponding
      log reference nodes.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      Cc: stable@kernel.org
      52c6e6f9
  13. 21 10月, 2010 1 次提交
  14. 17 10月, 2010 1 次提交
  15. 20 9月, 2010 1 次提交
    • A
      UBIFS: introduce new flags for RO mounts · 2ef13294
      Artem Bityutskiy 提交于
      Commit 2fde99cb "UBIFS: mark VFS SB RO too"
      introduced regression. This commit made UBIFS set the 'MS_RDONLY' flag in the
      VFS superblock when it switches to R/O mode due to an error. This was done
      to make VFS show the R/O UBIFS flag in /proc/mounts.
      
      However, several places in UBIFS relied on the 'MS_RDONLY' flag and assume this
      flag can only change when we re-mount. For example, 'ubifs_put_super()'.
      
      This patch introduces new UBIFS flag - 'c->ro_mount' which changes only when
      we re-mount, and preserves the way UBIFS was originally mounted (R/W or R/O).
      This allows us to de-initialize UBIFS cleanly in 'ubifs_put_super()'.
      
      This patch also changes all 'ubifs_assert(!c->ro_media)' assertions to
      'ubifs_assert(!c->ro_media && !c->ro_mount)', because we never should write
      anything if the FS was mounter R/O.
      
      All the places where we test for 'MS_RDONLY' flag in the VFS SB were changed
      and now we test the 'c->ro_mount' flag instead, because it preserves the
      original UBIFS mount type, unlike the 'MS_RDONLY' flag.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      2ef13294
  16. 10 9月, 2009 1 次提交
    • A
      UBIFS: do not print scary error messages needlessly · 348709ba
      Artem Bityutskiy 提交于
      At the moment UBIFS print large and scary error messages and
      flash dumps in case of nearly any corruption, even if it is
      a recoverable corruption. For example, if the master node is
      corrupted, ubifs_scan() prints error dumps, then UBIFS recovers
      just fine and goes on.
      
      This patch makes UBIFS print scary error messages only in
      real cases, which are not recoverable. It adds 'quiet' argument
      to the 'ubifs_scan()' function, so the caller may ask 'ubi_scan()'
      not to print error messages if the caller is able to do recovery.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      Reviewed-by: NAdrian Hunter <Adrian.Hunter@nokia.com>
      348709ba
  17. 09 7月, 2009 1 次提交
  18. 05 7月, 2009 1 次提交
  19. 21 3月, 2009 1 次提交
  20. 31 12月, 2008 1 次提交
  21. 06 11月, 2008 1 次提交
    • A
      UBIFS: fix compilation warnings · e84461ad
      Artem Bityutskiy 提交于
      We print 'ino_t' type using '%lu' printk() placeholder, but this
      results in many warnings when compiling for Alpha platform. Fix
      this by adding (unsingned long) casts.
      
      Fixes these warnings:
      
      fs/ubifs/journal.c:693: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/journal.c:1131: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/dir.c:163: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/tnc.c:2680: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/tnc.c:2700: warning: format '%lu' expects type 'long unsigned int', but argument 5 has type 'ino_t'
      fs/ubifs/replay.c:1066: warning: format '%lu' expects type 'long unsigned int', but argument 7 has type 'ino_t'
      fs/ubifs/orphan.c:108: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/orphan.c:135: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/orphan.c:142: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/orphan.c:154: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/orphan.c:159: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/orphan.c:451: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/orphan.c:539: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/orphan.c:612: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/orphan.c:843: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/orphan.c:856: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/recovery.c:1438: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/recovery.c:1443: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/recovery.c:1475: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/recovery.c:1495: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/debug.c:105: warning: format '%lu' expects type 'long unsigned int', but argument 3 has type 'ino_t'
      fs/ubifs/debug.c:105: warning: format '%lu' expects type 'long unsigned int', but argument 3 has type 'ino_t'
      fs/ubifs/debug.c:110: warning: format '%lu' expects type 'long unsigned int', but argument 3 has type 'ino_t'
      fs/ubifs/debug.c:110: warning: format '%lu' expects type 'long unsigned int', but argument 3 has type 'ino_t'
      fs/ubifs/debug.c:114: warning: format '%lu' expects type 'long unsigned int', but argument 3 has type 'ino_t'
      fs/ubifs/debug.c:114: warning: format '%lu' expects type 'long unsigned int', but argument 3 has type 'ino_t'
      fs/ubifs/debug.c:118: warning: format '%lu' expects type 'long unsigned int', but argument 3 has type 'ino_t'
      fs/ubifs/debug.c:118: warning: format '%lu' expects type 'long unsigned int', but argument 3 has type 'ino_t'
      fs/ubifs/debug.c:1591: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/debug.c:1671: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/debug.c:1674: warning: format '%lu' expects type 'long unsigned int', but argument 5 has type 'ino_t'
      fs/ubifs/debug.c:1680: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/debug.c:1699: warning: format '%lu' expects type 'long unsigned int', but argument 5 has type 'ino_t'
      fs/ubifs/debug.c:1788: warning: format '%lu' expects type 'long unsigned int', but argument 5 has type 'ino_t'
      fs/ubifs/debug.c:1821: warning: format '%lu' expects type 'long unsigned int', but argument 5 has type 'ino_t'
      fs/ubifs/debug.c:1833: warning: format '%lu' expects type 'long unsigned int', but argument 5 has type 'ino_t'
      fs/ubifs/debug.c:1924: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/debug.c:1932: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/debug.c:1938: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/debug.c:1945: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/debug.c:1953: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/debug.c:1960: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/debug.c:1967: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/debug.c:1973: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/debug.c:1988: warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'ino_t'
      fs/ubifs/debug.c:1991: warning: format '%lu' expects type 'long unsigned int', but argument 5 has type 'ino_t'
      fs/ubifs/debug.c:2009: warning: format '%lu' expects type 'long unsigned int', but argument 2 has type 'ino_t'
      Reported-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      e84461ad
  22. 15 7月, 2008 1 次提交