1. 21 Apr, 2008 10 commits
    • 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 26 commits