1. 21 Apr, 2008 16 commits
    • Akinobu Mita's avatar
      block: fix blk_register_queue() return value · fb199746
      Akinobu Mita authored
      blk_register_queue() returns -ENXIO when queue->request_fn is NULL.  But there
      are some block drivers that call blk_register_queue() via add_disk() with
      queue->request_fn == NULL.  (For example, brd, loop)
      
      Although no one checks return value of blk_register_queue(), this patch makes
      it return 0 instead of -ENXIO when queue->request_fn is NULL,
      
      Also this patch adds warning when blk_register_queue() and
      blk_unregister_queue() are called with queue == NULL rather than ignore
      invalid usage silently.
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      fb199746
    • Andi Kleen's avatar
      block: fix memory hotplug and bouncing in block layer · 2472892a
      Andi Kleen authored
      Only noticed this while hacking something else, no test case.
      
      blk_max_low_pfn is initialized once at bootup by the block layer from
      max_low_pfn.  But max_low_pfn is not necessarily constant over the runtime of
      the system when you consider memory hotplug.  What could happen if that
      someone adds memory later the block layer wouldn't get updated and then start
      bouncing memory unnecessarily.
      
      Also on 64bit blk_max_low_pfn actually isn't needed because it just disables
      bouncing essentially and there is no highmem.  And nobody can pass pfns >
      max_low_pfn to the block layer, because those wouldn't have a struct page and
      I suspect block layer wouldn't be very happy without that.
      
      So set BLK_BOUNCE_HIGH to infinity (-1ULL) on 64bit.  That avoids the problem
      of having to update it on memory hotadd.
      
      On 32bit I kept the same behaviour because at least on i386
      memory hotadd only adds HIGHMEM, never lowmem.
      
      BLK_BOUNCE_ANY is always set to infinity on both 32 and 64bit.
      Signed-off-by: default avatarAndi Kleen <ak@suse.de>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Acked-by: default avatarYasunori Goto <y-goto@jp.fujitsu.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      2472892a
    • Harvey Harrison's avatar
      block: replace remaining __FUNCTION__ occurrences · cece9339
      Harvey Harrison authored
      __FUNCTION__ is gcc-specific, use __func__
      Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      cece9339
    • Nick Andrew's avatar
      Kconfig: clean up block/Kconfig help descriptions · ee86418d
      Nick Andrew authored
      Modify the help descriptions of block/Kconfig for clarity, accuracy and
      consistency.
      
      Refactor the BLOCK description a bit.  The wording "This permits ...  to be
      removed" isn't quite right; the block layer is removed when the option is
      disabled, whereas most descriptions talk about what happens when the option is
      enabled.  Reformat the list of what is affected by disabling the block layer.
      
      Add more examples of large block devices to LBD and strive for technical
      accuracy; block devices of size _exactly_ 2TB require CONFIG_LBD, not only
      "bigger than 2TB".  Also try to say (perhaps not very clearly) that the config
      option is only needed when you want to have individual block devices of size
      >= 2TB, for example if you had 3 x 1TB disks in your computer you'd have a
      total storage size of 3TB but you wouldn't need the option unless you want to
      aggregate those disks into a RAID or LVM.
      
      Improve terminology and grammar on BLK_DEV_IO_TRACE.
      
      I also added the boilerplate "If unsure, say N" to most options.
      
      Precisely say "2TB and larger" for LSF.
      
      Indent the help text for BLK_DEV_BSG by 2 spaces in accordance with the
      standard.
      Signed-off-by: default avatarNick Andrew <nick@nick-andrew.net>
      Cc: "Randy.Dunlap" <rdunlap@xenotime.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      ee86418d
    • scameron@beardog.cca.cpqcorp.net's avatar
      cciss: fix warning oops on rmmod of driver · 6195057f
      scameron@beardog.cca.cpqcorp.net authored
      * Fix oops on cciss rmmod due to calling pci_free_consistent with
        irqs disabled.
      Signed-off-by: default avatarStephen M. Cameron <scameron@beardog.cca.cpqcorp.net>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      6195057f
    • scameron@beardog.cca.cpqcorp.net's avatar
      cciss: Fix race between disk-adding code and interrupt handler · e14ac670
      scameron@beardog.cca.cpqcorp.net authored
      Fix race condition between cciss_init_one(), cciss_update_drive_info(),
      and cciss_check_queues().
      Signed-off-by: default avatarStephen M. Cameron <scameron@beardog.cca.cpqcorp.net>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      e14ac670
    • FUJITA Tomonori's avatar
      block: move the padding adjustment to blk_rq_map_sg · f18573ab
      FUJITA Tomonori authored
      blk_rq_map_user adjusts bi_size of the last bio. It breaks the rule
      that req->data_len (the true data length) is equal to sum(bio). It
      broke the scsi command completion code.
      
      commit e97a294e was introduced to fix
      the above issue. However, the partial completion code doesn't work
      with it. The commit is also a layer violation (scsi mid-layer should
      not know about the block layer's padding).
      
      This patch moves the padding adjustment to blk_rq_map_sg (suggested by
      James). The padding works like the drain buffer. This patch breaks the
      rule that req->data_len is equal to sum(sg), however, the drain buffer
      already broke it. So this patch just restores the rule that
      req->data_len is equal to sub(bio) without breaking anything new.
      
      Now when a low level driver needs padding, blk_rq_map_user and
      blk_rq_map_user_iov guarantee there's enough room for padding.
      blk_rq_map_sg can safely extend the last entry of a scatter list.
      
      blk_rq_map_sg must extend the last entry of a scatter list only for a
      request that got through bio_copy_user_iov. This patches introduces
      new REQ_COPY_USER flag.
      Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: Tejun Heo <htejun@gmail.com>
      Cc: Mike Christie <michaelc@cs.wisc.edu>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      f18573ab
    • FUJITA Tomonori's avatar
      block: add bio_copy_user_iov support to blk_rq_map_user_iov · afdc1a78
      FUJITA Tomonori authored
      With this patch, blk_rq_map_user_iov uses bio_copy_user_iov when a low
      level driver needs padding or a buffer in sg_iovec isn't aligned. That
      is, it uses temporary kernel buffers instead of mapping user pages
      directly.
      
      When a LLD needs padding, later blk_rq_map_sg needs to extend the last
      entry of a scatter list. bio_copy_user_iov guarantees that there is
      enough space for padding by using temporary kernel buffers instead of
      user pages.
      
      blk_rq_map_user_iov needs buffers in sg_iovec to be aligned. The
      comment in blk_rq_map_user_iov indicates that drivers/scsi/sg.c also
      needs buffers in sg_iovec to be aligned. Actually, drivers/scsi/sg.c
      works with unaligned buffers in sg_iovec (it always uses temporary
      kernel buffers).
      Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: Tejun Heo <htejun@gmail.com>
      Cc: Mike Christie <michaelc@cs.wisc.edu>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      afdc1a78
    • FUJITA Tomonori's avatar
      block: convert bio_copy_user to bio_copy_user_iov · c5dec1c3
      FUJITA Tomonori authored
      This patch enables bio_copy_user to take struct sg_iovec (renamed
      bio_copy_user_iov). bio_copy_user uses bio_copy_user_iov internally as
      bio_map_user uses bio_map_user_iov.
      
      The major changes are:
      
      - adds sg_iovec array to struct bio_map_data
      
      - adds __bio_copy_iov that copy data between bio and
      sg_iovec. bio_copy_user_iov and bio_uncopy_user use it.
      Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: Tejun Heo <htejun@gmail.com>
      Cc: Mike Christie <michaelc@cs.wisc.edu>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      c5dec1c3
    • Laurent Vivier's avatar
      loop: manage partitions in disk image · 476a4813
      Laurent Vivier authored
      This patch allows to use loop device with partitionned disk image.
      
      Original behavior of loop is not modified.
      
      A new parameter is introduced to define how many partition we want to be
      able to manage per loop device. This parameter is "max_part".
      
      For instance, to manage 63 partitions / loop device, we will do:
      # modprobe loop max_part=63
      # ls -l /dev/loop?*
      brw-rw---- 1 root disk 7,   0 2008-03-05 14:55 /dev/loop0
      brw-rw---- 1 root disk 7,  64 2008-03-05 14:55 /dev/loop1
      brw-rw---- 1 root disk 7, 128 2008-03-05 14:55 /dev/loop2
      brw-rw---- 1 root disk 7, 192 2008-03-05 14:55 /dev/loop3
      brw-rw---- 1 root disk 7, 256 2008-03-05 14:55 /dev/loop4
      brw-rw---- 1 root disk 7, 320 2008-03-05 14:55 /dev/loop5
      brw-rw---- 1 root disk 7, 384 2008-03-05 14:55 /dev/loop6
      brw-rw---- 1 root disk 7, 448 2008-03-05 14:55 /dev/loop7
      
      And to attach a raw partitionned disk image, the original losetup is used:
      
      # losetup -f etch.img
      # ls -l /dev/loop?*
      brw-rw---- 1 root disk 7,   0 2008-03-05 14:55 /dev/loop0
      brw-rw---- 1 root disk 7,   1 2008-03-05 14:57 /dev/loop0p1
      brw-rw---- 1 root disk 7,   2 2008-03-05 14:57 /dev/loop0p2
      brw-rw---- 1 root disk 7,   5 2008-03-05 14:57 /dev/loop0p5
      brw-rw---- 1 root disk 7,  64 2008-03-05 14:55 /dev/loop1
      brw-rw---- 1 root disk 7, 128 2008-03-05 14:55 /dev/loop2
      brw-rw---- 1 root disk 7, 192 2008-03-05 14:55 /dev/loop3
      brw-rw---- 1 root disk 7, 256 2008-03-05 14:55 /dev/loop4
      brw-rw---- 1 root disk 7, 320 2008-03-05 14:55 /dev/loop5
      brw-rw---- 1 root disk 7, 384 2008-03-05 14:55 /dev/loop6
      brw-rw---- 1 root disk 7, 448 2008-03-05 14:55 /dev/loop7
      # mount /dev/loop0p1 /mnt
      # ls /mnt
      bench  cdrom  home        lib         mnt   root     srv  usr
      bin    dev    initrd      lost+found  opt   sbin     sys  var
      boot   etc    initrd.img  media       proc  selinux  tmp  vmlinuz
      # umount /mnt
      # losetup -d /dev/loop0
      
      Of course, the same behavior can be done using kpartx on a loop device,
      but modifying loop avoids to stack several layers of block device (loop +
      device mapper), this is a very light modification (40% of modifications
      are to manage the new parameter).
      Signed-off-by: default avatarLaurent Vivier <Laurent.Vivier@bull.net>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      476a4813
    • Thomas Bogendoerfer's avatar
      cdrom: use kmalloced buffers instead of buffers on stack · 22a9189f
      Thomas Bogendoerfer authored
      If cdrom commands are issued to a scsi drive in most cases the buffer will be
      filled via dma.  This leads to bad stack corruption on non coherent platforms,
      because the buffers are neither cache line aligned nor is the size a multiple
      of the cache line size.  Using kmalloced buffers avoids this.
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      22a9189f
    • Akinobu Mita's avatar
      cdrom: make unregister_cdrom() return void · 0a0c4114
      Akinobu Mita authored
      Now unregister_cdrom() always returns 0.
      Make it return void and update all callers that check the return value.
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Cc: Adrian McMenamin <adrian@mcmen.demon.co.uk>
      Cc: Borislav Petkov <petkovbb@gmail.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      0a0c4114
    • Akinobu Mita's avatar
      cdrom: use list_head for cdrom_device_info list · 7fd097d4
      Akinobu Mita authored
      Use list_head for cdrom_device_info list instead of opencoded
      singly list handling.
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      7fd097d4
    • Akinobu Mita's avatar
      cdrom: protect cdrom_device_info list by mutex · 032d8d90
      Akinobu Mita authored
      This patch protects the list of cdrom_device_info by cdrom_mutex
      when the file in /proc/sys/dev/cdrom/ is written.
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      032d8d90
    • Akinobu Mita's avatar
      cdrom: cleanup hardcoded error-code · 3c3f4e01
      Akinobu Mita authored
      This patch eliminates hardcoded return value of register_cdrom().
      
      It also changes the return value to -EINVAL.
      It is more appropriate than -2 (-ENOENT) because it is only
      happen invalid usage of register_cdrom() by broken cdrom driver.
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      3c3f4e01
    • Akinobu Mita's avatar
      cdrom: remove ifdef CONFIG_SYSCTL · 17672cf0
      Akinobu Mita authored
      This patch removes #ifdef for CONFIG_SYSCTL by defining empty
      cdrom_sysctl_register and cdrom_sysctl_unregister when CONFIG_SYSCTL
      is not defined.
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      17672cf0
  2. 19 Apr, 2008 4 commits
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of... · 3925e6fc
      Linus Torvalds authored
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6:
        security: fix up documentation for security_module_enable
        Security: Introduce security= boot parameter
        Audit: Final renamings and cleanup
        SELinux: use new audit hooks, remove redundant exports
        Audit: internally use the new LSM audit hooks
        LSM/Audit: Introduce generic Audit LSM hooks
        SELinux: remove redundant exports
        Netlink: Use generic LSM hook
        Audit: use new LSM hooks instead of SELinux exports
        SELinux: setup new inode/ipc getsecid hooks
        LSM: Introduce inode_getsecid and ipc_getsecid hooks
      3925e6fc
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.26 · 334d0945
      Linus Torvalds authored
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.26: (1090 commits)
        [NET]: Fix and allocate less memory for ->priv'less netdevices
        [IPV6]: Fix dangling references on error in fib6_add().
        [NETLABEL]: Fix NULL deref in netlbl_unlabel_staticlist_gen() if ifindex not found
        [PKT_SCHED]: Fix datalen check in tcf_simp_init().
        [INET]: Uninline the __inet_inherit_port call.
        [INET]: Drop the inet_inherit_port() call.
        SCTP: Initialize partial_bytes_acked to 0, when all of the data is acked.
        [netdrvr] forcedeth: internal simplifications; changelog removal
        phylib: factor out get_phy_id from within get_phy_device
        PHY: add BCM5464 support to broadcom PHY driver
        cxgb3: Fix __must_check warning with dev_dbg.
        tc35815: Statistics cleanup
        natsemi: fix MMIO for PPC 44x platforms
        [TIPC]: Cleanup of TIPC reference table code
        [TIPC]: Optimized initialization of TIPC reference table
        [TIPC]: Remove inlining of reference table locking routines
        e1000: convert uint16_t style integers to u16
        ixgb: convert uint16_t style integers to u16
        sb1000.c: make const arrays static
        sb1000.c: stop inlining largish static functions
        ...
      334d0945
    • James Morris's avatar
      security: fix up documentation for security_module_enable · 7cea51be
      James Morris authored
      security_module_enable() can only be called during kernel init.
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      7cea51be
    • Ahmed S. Darwish's avatar
      Security: Introduce security= boot parameter · 076c54c5
      Ahmed S. Darwish authored
      Add the security= boot parameter. This is done to avoid LSM
      registration clashes in case of more than one bult-in module.
      
      User can choose a security module to enable at boot. If no
      security= boot parameter is specified, only the first LSM
      asking for registration will be loaded. An invalid security
      module name will be treated as if no module has been chosen.
      
      LSM modules must check now if they are allowed to register
      by calling security_module_enable(ops) first. Modify SELinux
      and SMACK to do so.
      
      Do not let SMACK register smackfs if it was not chosen on
      boot. Smackfs assumes that smack hooks are registered and
      the initial task security setup (swapper->security) is done.
      Signed-off-by: default avatarAhmed S. Darwish <darwish.07@gmail.com>
      Acked-by: default avatarJames Morris <jmorris@namei.org>
      076c54c5
  3. 18 Apr, 2008 20 commits