Skip to content
Snippets Groups Projects
  1. Mar 11, 2014
  2. May 07, 2013
  3. May 06, 2013
  4. Nov 21, 2012
  5. Mar 26, 2012
  6. Jan 09, 2012
    • Brian Norris's avatar
      mtd: mtd_blkdevs: don't increase 'open' count on error path · 342ff28f
      Brian Norris authored
      
      Some error paths in mtd_blkdevs were fixed in the following commit:
      
          commit 94735ec4
          mtd: mtd_blkdevs: fix error path in blktrans_open
      
      But on these error paths, the block device's `dev->open' count is
      already incremented before we check for errors. This meant that, while
      the error path was handled correctly on the first time through
      blktrans_open(), the device is erroneously considered already open on
      the second time through.
      
      This problem can be seen, for instance, when a UBI volume is
      simultaneously mounted as a UBIFS partition and read through its
      corresponding gluebi mtdblockX device. This results in blktrans_open()
      passing its error checks (with `dev->open > 0') without actually having
      a handle on the device. Here's a summarized log of the actions and
      results with nandsim:
      
          # modprobe nandsim
          # modprobe mtdblock
          # modprobe gluebi
          # modprobe ubifs
          # ubiattach /dev/ubi_ctrl -m 0
          ...
          # ubimkvol /dev/ubi0 -N test -s 16MiB
          ...
          # mount -t ubifs ubi0:test /mnt
          # ls /dev/mtdblock*
          /dev/mtdblock0  /dev/mtdblock1
          # cat /dev/mtdblock1 > /dev/null
          cat: can't open '/dev/mtdblock4': Device or resource busy
          # cat /dev/mtdblock1 > /dev/null
      
          CPU 0 Unable to handle kernel paging request at virtual address
          fffffff0, epc == 8031536c, ra == 8031f280
          Oops[#1]:
          ...
          Call Trace:
          [<8031536c>] ubi_leb_read+0x14/0x164
          [<8031f280>] gluebi_read+0xf0/0x148
          [<802edba8>] mtdblock_readsect+0x64/0x198
          [<802ecfe4>] mtd_blktrans_thread+0x330/0x3f4
          [<8005be98>] kthread+0x88/0x90
          [<8000bc04>] kernel_thread_helper+0x10/0x18
      
      Cc: stable@kernel.org [3.0+]
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
      Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
      342ff28f
  7. Oct 14, 2011
  8. May 25, 2011
  9. Mar 11, 2011
  10. Oct 30, 2010
  11. Oct 25, 2010
  12. Oct 05, 2010
    • Arnd Bergmann's avatar
      block: autoconvert trivial BKL users to private mutex · 2a48fc0a
      Arnd Bergmann authored
      
      The block device drivers have all gained new lock_kernel
      calls from a recent pushdown, and some of the drivers
      were already using the BKL before.
      
      This turns the BKL into a set of per-driver mutexes.
      Still need to check whether this is safe to do.
      
      file=$1
      name=$2
      if grep -q lock_kernel ${file} ; then
          if grep -q 'include.*linux.mutex.h' ${file} ; then
                  sed -i '/include.*<linux\/smp_lock.h>/d' ${file}
          else
                  sed -i 's/include.*<linux\/smp_lock.h>.*$/include <linux\/mutex.h>/g' ${file}
          fi
          sed -i ${file} \
              -e "/^#include.*linux.mutex.h/,$ {
                      1,/^\(static\|int\|long\)/ {
                           /^\(static\|int\|long\)/istatic DEFINE_MUTEX(${name}_mutex);
      
      } }"  \
          -e "s/\(un\)*lock_kernel\>[ ]*()/mutex_\1lock(\&${name}_mutex)/g" \
          -e '/[      ]*cycle_kernel_lock();/d'
      else
          sed -i -e '/include.*\<smp_lock.h\>/d' ${file}  \
                      -e '/cycle_kernel_lock()/d'
      fi
      
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      2a48fc0a
  13. Aug 08, 2010
  14. Aug 07, 2010
  15. Aug 06, 2010
  16. Aug 02, 2010
  17. Mar 09, 2010
  18. Feb 26, 2010
  19. Feb 25, 2010
  20. Nov 30, 2009
  21. Nov 26, 2009
    • Ilya Loginov's avatar
      block: add helpers to run flush_dcache_page() against a bio and a request's pages · 2d4dc890
      Ilya Loginov authored
      
      Mtdblock driver doesn't call flush_dcache_page for pages in request.  So,
      this causes problems on architectures where the icache doesn't fill from
      the dcache or with dcache aliases.  The patch fixes this.
      
      The ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE symbol was introduced to avoid
      pointless empty cache-thrashing loops on architectures for which
      flush_dcache_page() is a no-op.  Every architecture was provided with this
      flush pages on architectires where ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE is
      equal 1 or do nothing otherwise.
      
      See "fix mtd_blkdevs problem with caches on some architectures" discussion
      on LKML for more information.
      
      Signed-off-by: default avatarIlya Loginov <isloginov@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Peter Horton <phorton@bitbox.co.uk>
      Cc: "Ed L. Cashin" <ecashin@coraid.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      2d4dc890
  22. Oct 20, 2009
  23. Oct 01, 2009
    • Christoph Hellwig's avatar
      block: use normal I/O path for discard requests · c15227de
      Christoph Hellwig authored
      
      prepare_discard_fn() was being called in a place where memory allocation
      was effectively impossible.  This makes it inappropriate for all but
      the most trivial translations of Linux's DISCARD operation to the block
      command set.  Additionally adding a payload there makes the ownership
      of the bio backing unclear as it's now allocated by the device driver
      and not the submitter as usual.
      
      It is replaced with QUEUE_FLAG_DISCARD which is used to indicate whether
      the queue supports discard operations or not.  blkdev_issue_discard now
      allocates a one-page, sector-length payload which is the right thing
      for the common ATA and SCSI implementations.
      
      The mtd implementation of prepare_discard_fn() is replaced with simply
      checking for the request being a discard.
      
      Largely based on a previous patch from Matthew Wilcox <matthew@wil.cx>
      which did the prepare_discard_fn but not the different payload allocation
      yet.
      
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      c15227de
    • Christoph Hellwig's avatar
      block: use normal I/O path for discard requests · 1122a26f
      Christoph Hellwig authored
      
      prepare_discard_fn() was being called in a place where memory allocation
      was effectively impossible.  This makes it inappropriate for all but
      the most trivial translations of Linux's DISCARD operation to the block
      command set.  Additionally adding a payload there makes the ownership
      of the bio backing unclear as it's now allocated by the device driver
      and not the submitter as usual.
      
      It is replaced with QUEUE_FLAG_DISCARD which is used to indicate whether
      the queue supports discard operations or not.  blkdev_issue_discard now
      allocates a one-page, sector-length payload which is the right thing
      for the common ATA and SCSI implementations.
      
      The mtd implementation of prepare_discard_fn() is replaced with simply
      checking for the request being a discard.
      
      Largely based on a previous patch from Matthew Wilcox <matthew@wil.cx>
      which did the prepare_discard_fn but not the different payload allocation
      yet.
      
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      1122a26f
  24. Sep 22, 2009
  25. Aug 03, 2009
  26. May 26, 2009
Loading