1. 20 6月, 2011 1 次提交
  2. 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
  3. 03 6月, 2011 2 次提交
  4. 01 6月, 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. 16 5月, 2011 1 次提交
  7. 14 5月, 2011 4 次提交
    • 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: improve space checking debugging feature · f1bd66af
      Artem Bityutskiy 提交于
      This patch improves the 'dbg_check_space_info()' function which checks
      whether the amount of space before re-mounting and after re-mounting
      is the same (remounting from R/O to R/W modes and vice-versa).
      
      The problem is that 'dbg_check_space_info()' does not save the budgeting
      information before re-mounting, so when an error is reported, we do not
      know why the amount of free space changed.
      
      This patches makes the following changes:
      
      1. Teaches 'dbg_dump_budg()' function to accept a 'struct ubifs_budg_info'
         argument and print out the this argument. This way we may ask it to
         print any saved budgeting info, no only the current one.
      2. Accordingly changes all the callers of 'dbg_dump_budg()' to comply with
         the changed interface.
      3. Introduce a 'saved_bi' (saved budgeting info) field to
         'struct ubifs_debug_info' and save the budgeting info before re-mounting
         there.
      4. Change 'dbg_check_space_info()' and make it print both old and new
         budgeting information.
      5. Additionally, save 'c->igx_gc_cnt' and print it if and error happens. This
         value contributes to the amount of free space, so we have to print it.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      f1bd66af
    • A
      UBIFS: introduce a separate structure for budgeting info · b137545c
      Artem Bityutskiy 提交于
      This patch separates out all the budgeting-related information
      from 'struct ubifs_info' to 'struct ubifs_budg_info'. This way the
      code looks a bit cleaner. However, the main driver for this is
      that we want to save budgeting information and print it later,
      so a separate data structure for this is helpful.
      
      This patch is a preparation for the further debugging output
      improvements.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      b137545c
    • A
      UBIFS: fix minor stylistic issues · c4361570
      Artem Bityutskiy 提交于
      Fix several minor stylistic issues:
      * lines longer than 80 characters
      * space before closing parenthesis ')'
      * spaces in the indentations
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      c4361570
  8. 03 5月, 2011 1 次提交
    • A
      UBIFS: do not free write-buffers when in R/O mode · b50b9f40
      Artem Bityutskiy 提交于
      Currently UBIFS has a small optimization - it frees write-buffers when it is
      re-mounted from R/W mode to R/O mode. Of course, when it is mounted R/O, it
      does not allocate write-buffers as well.
      
      This optimization is nice but it leads to subtle problems and complications
      in recovery, which I can reproduce using the integck test. The symptoms are
      that after a power cut the file-system cannot be mounted if we first mount
      it R/O, and then re-mount R/W - 'ubifs_rcvry_gc_commit()' prints:
      
      UBIFS error (pid 34456): could not find an empty LEB
      
      Analysis of the  problem.
      
      When mounting R/W, the reply process sets journal heads to buds [1], but
      when mounting R/O - it does not do this, because the write-buffers are not
      allocated. So 'ubifs_rcvry_gc_commit()' works completely differently for the
      same file-system but for the following 2 cases:
      
      1. mounting R/W after a power cut and recover
      2. mounting R/O after a power cut, re-mounting R/W and run deferred recovery
      
      In the former case, we have journal heads seeked to the a bud, in the latter
      case, they are non-seeked (wbuf->lnum == -1). So in the latter case we do not
      try to recover the GC LEB by garbage-collecting to the GC head, but we just
      try to find an empty LEB, and there may be no empty LEBs, so we just fail.
      On the other hand, in the former case (mount R/W), we are able to make a GC LEB
      (@c->gc_lnum) by garbage-collecting.
      
      Thus, let's remove this small nice optimization and always allocate
      write-buffers. This should not make too big difference - we have only 3
      of them, each of max. write unit size, which is usually 2KiB. So this is
      about 6KiB of RAM for the typical case, and only when mounted R/O.
      
      [1]: Note, currently the replay process is setting (seeking) the journal heads
      to _some_ buds, not necessarily to the buds which had been the journal heads
      before the power cut happened. This will be fixed separately.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      Cc: stable@kernel.org
      b50b9f40
  9. 21 4月, 2011 1 次提交
  10. 20 4月, 2011 1 次提交
  11. 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
  12. 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
  13. 10 3月, 2011 1 次提交
  14. 08 3月, 2011 2 次提交
  15. 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
  16. 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
  17. 29 10月, 2010 1 次提交
  18. 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
  19. 28 9月, 2010 1 次提交
  20. 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
  21. 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
  22. 10 8月, 2010 1 次提交
  23. 03 8月, 2010 1 次提交
  24. 12 6月, 2010 1 次提交
  25. 06 3月, 2010 1 次提交
  26. 16 12月, 2009 1 次提交
  27. 24 11月, 2009 1 次提交
  28. 16 9月, 2009 1 次提交
  29. 11 9月, 2009 2 次提交
  30. 10 9月, 2009 1 次提交