1. 05 4月, 2011 1 次提交
    • A
      UBIFS: fix assertion warnings · c88ac00c
      Artem Bityutskiy 提交于
      This patch fixes UBIFS assertion warnings like:
      
      UBIFS assert failed in ubifs_leb_unmap at 135 (pid 29365)
      Pid: 29365, comm: integck Tainted: G          I 2.6.37-ubi-2.6+ #34
      Call Trace:
       [<ffffffffa047c663>] ubifs_lpt_init+0x95e/0x9ee [ubifs]
       [<ffffffffa04623a7>] ubifs_remount_fs+0x2c7/0x762 [ubifs]
       [<ffffffff810f066e>] do_remount_sb+0xb6/0x101
       [<ffffffff81106ff4>] ? do_mount+0x191/0x78e
       [<ffffffff811070bb>] do_mount+0x258/0x78e
       [<ffffffff810da1e8>] ? alloc_pages_current+0xa2/0xc5
       [<ffffffff81107674>] sys_mount+0x83/0xbd
       [<ffffffff81009a12>] system_call_fastpath+0x16/0x1b
      
      They happen when we re-mount from R/O mode to R/W mode. While
      re-mounting, we write to the media, but we still have the c->ro_mount
      flag set. The fix is very simple - just clear the flag before
      starting re-mounting R/W.
      
      These warnings are caused by the following commit:
      2ef13294
      
      For -stable guys: this bug was introduced in 2.6.38, this is materieal
      for 2.6.38-stable.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      Cc: stable@kernel.org [2.6.38]
      c88ac00c
  2. 11 3月, 2011 3 次提交
    • A
      UBIFS: do not check data crc by default · 2bcf0021
      Artem Bityutskiy 提交于
      Change the default UBIFS behavior WRT data CRC checking. Currently,
      UBIFS checks data CRC when reading, which slows it down quite a bit,
      and this is the default option. However, it looks like in average
      user does not need this feature and would prefer faster read speed
      over extra reliability. And this seems to be de-facto standard that
      file-systems do not check data CRC every time they read from the
      media.
      
      Thus, make UBIFS default behavior so that it does not check data
      CRC. This corresponds to the no_chk_data_crc mount option. Those users
      who need extra protection can always enable it using the chk_data_crc
      option.
      
      Please, read more information about this feature here:
      http://www.linux-mtd.infradead.org/doc/ubifs.html#L_checksummingSigned-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      2bcf0021
    • A
      UBIFS: print max. index node size · 6342aaeb
      Artem Bityutskiy 提交于
      Improve debugging messages by printing the maximum index node size
      on mount.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      6342aaeb
    • M
      UBIFS: handle allocation failures in UBIFS write path · d882962f
      Matthew L. Creech 提交于
      Running kernel 2.6.37, my PPC-based device occasionally gets an
      order-2 allocation failure in UBIFS, which causes the root FS to
      become unwritable:
      
      kswapd0: page allocation failure. order:2, mode:0x4050
      Call Trace:
      [c787dc30] [c00085b8] show_stack+0x7c/0x194 (unreliable)
      [c787dc70] [c0061aec] __alloc_pages_nodemask+0x4f0/0x57c
      [c787dd00] [c0061b98] __get_free_pages+0x20/0x50
      [c787dd10] [c00e4f88] ubifs_jnl_write_data+0x54/0x200
      [c787dd50] [c00e82d4] do_writepage+0x94/0x198
      [c787dd90] [c00675e4] shrink_page_list+0x40c/0x77c
      [c787de40] [c0067de0] shrink_inactive_list+0x1e0/0x370
      [c787de90] [c0068224] shrink_zone+0x2b4/0x2b8
      [c787df00] [c0068854] kswapd+0x408/0x5d4
      [c787dfb0] [c0037bcc] kthread+0x80/0x84
      [c787dff0] [c000ef44] kernel_thread+0x4c/0x68
      
      Similar problems were encountered last April by Tomasz Stanislawski:
      
      http://patchwork.ozlabs.org/patch/50965/
      
      This patch implements Artem's suggested fix: fall back to a
      mutex-protected static buffer, allocated at mount time.  I tested it
      by forcing execution down the failure path, and didn't see any ill
      effects.
      
      Artem: massaged the patch a little, improved it so that we'd not
      allocate the write reserve buffer when we are in R/O mode.
      Signed-off-by: NMatthew L. Creech <mlcreech@gmail.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      d882962f
  3. 10 3月, 2011 1 次提交
  4. 08 3月, 2011 2 次提交
  5. 18 1月, 2011 1 次提交
    • A
      UBIFS: introduce mounting flag · 18d1d7fb
      Artem Bityutskiy 提交于
      This is a preparational patch which removes the 'c->always_chk_crc' which was
      set during mounting and remounting to R/W mode and introduces 'c->mounting'
      flag which is set when mounting. Now the 'c->always_chk_crc' flag is the
      same as 'c->remounting_rw && c->mounting'.
      
      This patch is a preparation for the next one which will need to know when we
      are mounting and remounting to R/W mode, which is exactly what
      'c->always_chk_crc' effectively is, but its name does not suite the
      next patch. The other possibility would be to just re-name it, but then
      we'd end up with less logical flags coverage.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      18d1d7fb
  6. 07 1月, 2011 1 次提交
    • N
      fs: icache RCU free inodes · fa0d7e3d
      Nick Piggin 提交于
      RCU free the struct inode. This will allow:
      
      - Subsequent store-free path walking patch. The inode must be consulted for
        permissions when walking, so an RCU inode reference is a must.
      - sb_inode_list_lock to be moved inside i_lock because sb list walkers who want
        to take i_lock no longer need to take sb_inode_list_lock to walk the list in
        the first place. This will simplify and optimize locking.
      - Could remove some nested trylock loops in dcache code
      - Could potentially simplify things a bit in VM land. Do not need to take the
        page lock to follow page->mapping.
      
      The downsides of this is the performance cost of using RCU. In a simple
      creat/unlink microbenchmark, performance drops by about 10% due to inability to
      reuse cache-hot slab objects. As iterations increase and RCU freeing starts
      kicking over, this increases to about 20%.
      
      In cases where inode lifetimes are longer (ie. many inodes may be allocated
      during the average life span of a single inode), a lot of this cache reuse is
      not applicable, so the regression caused by this patch is smaller.
      
      The cache-hot regression could largely be avoided by using SLAB_DESTROY_BY_RCU,
      however this adds some complexity to list walking and store-free path walking,
      so I prefer to implement this at a later date, if it is shown to be a win in
      real situations. I haven't found a regression in any non-micro benchmark so I
      doubt it will be a problem.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      fa0d7e3d
  7. 29 10月, 2010 1 次提交
  8. 21 10月, 2010 2 次提交
    • A
      UBIFS: do not forget to cancel timers · 3601ba27
      Artem Bityutskiy 提交于
      This is a bug-fix: when we unmount, and we are currently in R/O
      mode because of an error - we do not sync write-buffers, which
      means we also do not cancel write-buffer timers we may possibly
      have armed. This patch fixes the issue.
      
      The issue can easily be reproduced by enabling UBIFS failure debug
      mode (echo 4 > /sys/module/ubifs/parameters/debug_tsts) and
      unmounting as soon as a failure happen. At some point the system
      oopses because we have an armed hrtimer but UBIFS is unmounted
      already.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      3601ba27
    • A
      UBIFS: remove a bit of unneeded code · 39037559
      Artem Bityutskiy 提交于
      This is a clean-up patch which:
      
      1. Removes explicite 'hrtimer_cancel()' after 'ubifs_wbuf_sync()' in
         'ubifs_remount_ro()', because the timers will be canceled by
         'ubifs_wbuf_sync()', no need to cancel them for the second time.
      2. Remove "if (c->jheads)" check from 'ubifs_put_super()', because
         at journal heads must always be allocated there, since we checked
         earlier that we were mounted R/W, and the olny situation when
         journal heads are not allocated is when mounter or re-mounted R/O.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      39037559
  9. 28 9月, 2010 1 次提交
  10. 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
  11. 17 9月, 2010 1 次提交
    • A
      UBIFS: introduce new flag for RO due to errors · 2680d722
      Artem Bityutskiy 提交于
      The R/O state may have various reasons:
      
      1. The UBI volume is R/O
      2. The FS is mounted R/O
      3. The FS switched to R/O mode because of an error
      
      However, in UBIFS we have only one variable which represents cases
      1 and 3 - 'c->ro_media'. Indeed, we set this to 1 if we switch to
      R/O mode due to an error, and then we test it in many places to
      make sure that we stop writing as soon as the error happens.
      
      But this is very unclean. One consequence of this, for example, is
      that in 'ubifs_remount_fs()' we use 'c->ro_media' to check whether
      we are in R/O mode because on an error, and we print a message
      in this case. However, if we are in R/O mode because the media
      is R/O, our message is bogus.
      
      This patch introduces new flag - 'c->ro_error' which is set when
      we switch to R/O mode because of an error. It also changes all
      "if (c->ro_media)" checks to "if (c->ro_error)" checks, because
      this is what the checks actually mean. We do not need to check
      for 'c->ro_media' because if the UBI volume is in R/O mode, we
      do not allow R/W mounting, and now writes can happen. This is
      guaranteed by VFS. But it is good to double-check this, so this
      patch also adds many "ubifs_assert(!c->ro_media)" checks.
      
      In the 'ubifs_remount_fs()' function this patch makes a bit more
      changes - it fixes the error messages as well.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      2680d722
  12. 10 8月, 2010 1 次提交
  13. 03 8月, 2010 1 次提交
  14. 12 6月, 2010 1 次提交
  15. 06 3月, 2010 1 次提交
  16. 16 12月, 2009 1 次提交
  17. 24 11月, 2009 1 次提交
  18. 16 9月, 2009 1 次提交
  19. 11 9月, 2009 2 次提交
  20. 10 9月, 2009 1 次提交
  21. 24 7月, 2009 2 次提交
  22. 05 7月, 2009 4 次提交
    • D
      UBIFS: allow more than one volume to be mounted · 7fcd9c3e
      Daniel Mack 提交于
      UBIFS uses a bdi device per volume, but does not care to hand out unique
      names to each of them. This causes an error when trying to mount more
      than one volumes. Append the UBI volume and device ID to avoid that.
      
      [Amended a bit by Artem Bityutskiy]
      Signed-off-by: NDaniel Mack <daniel@caiaq.de>
      Cc: Artem Bityutskiy <dedekind@infradead.org>
      Cc: Adrian Hunter <ext-adrian.hunter@nokia.com>
      Cc: linux-mtd@lists.infradead.org
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      7fcd9c3e
    • A
      UBIFS: fix assertion warning · 1fb8bd01
      Artem Bityutskiy 提交于
      When debugging is enabled and an unclean file-system is mounter,
      the following assertion is triggered:
      
      UBIFS assert failed in ubifs_tnc_start_commit at 805 (pid 1081)
      Call Trace:
      [cfaffbd0] [c0006cf8] show_stack+0x44/0x16c (unreliable)
      [cfaffc10] [c011b738] ubifs_tnc_start_commit+0xbb8/0xd18
      [cfaffc90] [c0112670] do_commit+0x150/0xa44
      [cfaffd10] [c0125234] ubifs_rcvry_gc_commit+0xd8/0x544
      [cfaffd60] [c0100e9c] ubifs_fill_super+0xe78/0x15f8
      [cfaffdf0] [c0102118] ubifs_get_sb+0x20c/0x320
      [cfaffe70] [c007f764] vfs_kern_mount+0x58/0xe0
      [cfaffe90] [c007f83c] do_kern_mount+0x40/0xf8
      [cfaffeb0] [c0095c24] do_mount+0x550/0x758
      [cfafff10] [c0095ebc] sys_mount+0x90/0xe0
      [cfafff40] [c000ed4c] ret_from_syscall+0x0/0x3c
      
      The reason is that we initialize 'c->min_leb_idx' early, and do
      not re-calculate it after journal replay.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      1fb8bd01
    • A
      UBIFS: few spelling fixes · cb54ef8b
      Artem Bityutskiy 提交于
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      cb54ef8b
    • A
      UBIFS: slightly optimize write-buffer timer usage · 0b335b9d
      Artem Bityutskiy 提交于
      This patch adds the following minor optimization:
      
      1. If write-buffer does not use the timer, indicate it with the
         wbuf->no_timer variable, instead of using the wbuf->softlimit
         variable. This is better because wbuf->softlimit is of ktime_t
         type, and the ktime_to_ns function contains 64-bit multiplication.
      
      2. Do not call the 'hrtimer_cancel()' function for write-buffers
         which do not use timers.
      
      3. Do not cancel the timer in 'ubifs_put_super()' because the
         synchronization function does this.
      
      This patch also removes a confusing comment.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      0b335b9d
  23. 16 6月, 2009 1 次提交
  24. 12 6月, 2009 3 次提交
  25. 08 6月, 2009 2 次提交
  26. 02 6月, 2009 1 次提交
  27. 26 5月, 2009 1 次提交
    • A
      UBIFS: use anonymous device · 7c83f5cb
      Artem Bityutskiy 提交于
      UBIFS has erroneuosly set 'sb->s_dev' to the UBI volume
      character device major/minor. This may lead to clashes
      if there is another FS mounted to a block device with
      the same major/minor numbers. User-space programs which
      use 'stat->st_dev' may get confused because of this.
      
      This problem was found by Al Viro. He also pointed the
      way to fix the problem - use 'set_anon_super()' and
      'kill_anon_super()' VFS helpers.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      7c83f5cb
  28. 25 5月, 2009 1 次提交