1. 20 Aug, 2008 5 commits
    • HighPoint Linux Team's avatar
      SCSI: hptiop: add more PCI device IDs · cdc884a8
      HighPoint Linux Team authored
      commit dd07428b upstream
      
      Add PCI device ID for new adapter models.
      Signed-off-by: default avatarHighPoint Linux Team <linux@highpoint-tech.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      cdc884a8
    • Tim Wright's avatar
      SCSI: block: Fix miscalculation of sg_io timeout in CDROM_SEND_PACKET handler. · 5290b82b
      Tim Wright authored
      commit ad337591 upstream
      
      It seems cdrwtool in the udftools has been unusable on "modern" kernels
      for some time. A Google search reveals many people with the same issue
      but no solution (cdrwtool fails to format the disk). After spending some
      time tracking down the issue, it comes down to the following:
      
      The udftools still use the older CDROM_SEND_PACKET interface to send
      things like FORMAT_UNIT through to the drive. They should really be
      updated, but that's another story. Since most distros are using libata
      now, the cd or dvd burner appears as a SCSI device, and we wind up in
      block/scsi_ioctl.c. Here, the code tries to take the "struct
      cdrom_generic_command" and translate it and stuff it into a "struct
      sg_io_hdr" structure so it can pass it to the modern sg_io() routine
      instead. Unfortunately, there is one error, or rather an omission in the
      translation. The timeout that is passed in in the "struct
      cdrom_generic_command" is in HZ=100 units, and this is modified and
      correctly converted to jiffies by use of clock_t_to_jiffies(). However,
      a little further down, this cgc.timeout value in jiffies is simply
      copied into the sg_io_hdr timeout, which should be in milliseconds.
      Since most modern x86 kernels seems to be getting build with HZ=250, the
      timeout that is passed to sg_io and eventually converted to the
      timeout_per_command member of the scsi_cmnd structure is now four times
      too small. Since cdrwtool tries to set the timeout to one hour for the
      FORMAT_UNIT command, and it takes about 20 minutes to format a 4x CDRW,
      the SCSI error-handler kicks in after the FORMAT_UNIT completes because
      it took longer than the incorrectly-calculated timeout.
      
      [jejb: fix up whitespace]
      Signed-off-by: default avatarTim Wright <timw@splhi.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      5290b82b
    • James Bottomley's avatar
      SCSI: scsi_transport_spi: fix oops in revalidate · e957c8b1
      James Bottomley authored
      commit e8bac9e0 upstream
      
      The class_device->device conversion is causing an oops in revalidate
      because it's assuming that the device_for_each_child iterator will only
      return struct scsi_device children.  The conversion made all former
      class_devices children of the device as well, so this assumption is
      broken.  Fix it.
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      e957c8b1
    • James Bottomley's avatar
      SCSI: ses: fix VPD inquiry overrun · e563ea63
      James Bottomley authored
      commit 671a99c8 upstream
      
      There are a few kerneloops.org reports like this one:
      
      http://www.kerneloops.org/search.php?search=ses_match_to_enclosure
      
      That seem to imply we're running off the end of the VPD inquiry data
      (although at 512 bytes, it should be long enough for just about
      anything).  we should be using correctly sized buffers anyway, so put
      those in and hope this oops goes away.
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      e563ea63
    • KOSAKI Motohiro's avatar
      mlock() fix return values · 84d21376
      KOSAKI Motohiro authored
      commit a477097d upstream
      
      Halesh says:
      
      Please find the below testcase provide to test mlock.
      
      Test Case :
      ===========================
      
      #include <sys/resource.h>
      #include <stdio.h>
      #include <sys/stat.h>
      #include <sys/types.h>
      #include <unistd.h>
      #include <sys/mman.h>
      #include <fcntl.h>
      #include <errno.h>
      #include <stdlib.h>
      
      int main(void)
      {
        int fd,ret, i = 0;
        char *addr, *addr1 = NULL;
        unsigned int page_size;
        struct rlimit rlim;
      
        if (0 != geteuid())
        {
         printf("Execute this pgm as root\n");
         exit(1);
        }
      
        /* create a file */
        if ((fd = open("mmap_test.c",O_RDWR|O_CREAT,0755)) == -1)
        {
         printf("cant create test file\n");
         exit(1);
        }
      
        page_size = sysconf(_SC_PAGE_SIZE);
      
        /* set the MEMLOCK limit */
        rlim.rlim_cur = 2000;
        rlim.rlim_max = 2000;
      
        if ((ret = setrlimit(RLIMIT_MEMLOCK,&rlim)) != 0)
        {
         printf("Cant change limit values\n");
         exit(1);
        }
      
        addr = 0;
        while (1)
        {
        /* map a page into memory each time*/
        if ((addr = (char *) mmap(addr,page_size, PROT_READ |
      PROT_WRITE,MAP_SHARED,fd,0)) == MAP_FAILED)
        {
         printf("cant do mmap on file\n");
         exit(1);
        }
      
        if (0 == i)
          addr1 = addr;
        i++;
        errno = 0;
        /* lock the mapped memory pagewise*/
        if ((ret = mlock((char *)addr, 1500)) == -1)
        {
         printf("errno value is %d\n", errno);
         printf("cant lock maped region\n");
         exit(1);
        }
        addr = addr + page_size;
       }
      }
      ======================================================
      
      This testcase results in an mlock() failure with errno 14 that is EFAULT,
      but it has nowhere been specified that mlock() will return EFAULT.  When I
      tested the same on older kernels like 2.6.18, I got the correct result i.e
      errno 12 (ENOMEM).
      
      I think in source code mlock(2), setting errno ENOMEM has been missed in
      do_mlock() , on mlock_fixup() failure.
      
      SUSv3 requires the following behavior frmo mlock(2).
      
      [ENOMEM]
          Some or all of the address range specified by the addr and
          len arguments does not correspond to valid mapped pages
          in the address space of the process.
      
      [EAGAIN]
          Some or all of the memory identified by the operation could not
          be locked when the call was made.
      
      This rule isn't so nice and slighly strange.  but many people think
      POSIX/SUS compliance is important.
      Reported-by: default avatarHalesh Sadashiv <halesh.sadashiv@ap.sony.com>
      Tested-by: default avatarHalesh Sadashiv <halesh.sadashiv@ap.sony.com>
      Signed-off-by: default avatarKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      84d21376
  2. 06 Aug, 2008 27 commits
  3. 01 Aug, 2008 8 commits