1. 14 Dec, 2009 8 commits
    • Akira Fujita's avatar
      ext4: fix lock order problem in ext4_move_extents() · 52a4345d
      Akira Fujita authored
      (cherry picked from commit fc04cb49)
      
      ext4_move_extents() checks the logical block contiguousness
      of original file with ext4_find_extent() and mext_next_extent().
      Therefore the extent which ext4_ext_path structure indicates
      must not be changed between above functions.
      
      But in current implementation, there is no i_data_sem protection
      between ext4_ext_find_extent() and mext_next_extent().  So the extent
      which ext4_ext_path structure indicates may be overwritten by
      delalloc.  As a result, ext4_move_extents() will exchange wrong blocks
      between original and donor files.  I change the place where
      acquire/release i_data_sem to solve this problem.
      
      Moreover, I changed move_extent_per_page() to start transaction first,
      and then acquire i_data_sem.  Without this change, there is a
      possibility of the deadlock between mmap() and ext4_move_extents():
      
      * NOTE: "A", "B" and "C" mean different processes
      
      A-1: ext4_ext_move_extents() acquires i_data_sem of two inodes.
      
      B:   do_page_fault() starts the transaction (T),
           and then tries to acquire i_data_sem.
           But process "A" is already holding it, so it is kept waiting.
      
      C:   While "A" and "B" running, kjournald2 tries to commit transaction (T)
           but it is under updating, so kjournald2 waits for it.
      
      A-2: Call ext4_journal_start with holding i_data_sem,
           but transaction (T) is locked.
      Signed-off-by: default avatarAkira Fujita <a-fujita@rs.jp.nec.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      52a4345d
    • Akira Fujita's avatar
      ext4: fix the returned block count if EXT4_IOC_MOVE_EXT fails · a4a87a7f
      Akira Fujita authored
      (cherry picked from commit f868a48d)
      
      If the EXT4_IOC_MOVE_EXT ioctl fails, the number of blocks that were
      exchanged before the failure should be returned to the userspace
      caller.  Unfortunately, currently if the block size is not the same as
      the page size, the returned block count that is returned is the
      page-aligned block count instead of the actual block count.  This
      commit addresses this bug.
      Signed-off-by: default avatarAkira Fujita <a-fujita@rs.jp.nec.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      a4a87a7f
    • Theodore Ts'o's avatar
      ext4: avoid divide by zero when trying to mount a corrupted file system · 8ed33ff5
      Theodore Ts'o authored
      (cherry picked from commit 503358ae)
      
      If s_log_groups_per_flex is greater than 31, then groups_per_flex will
      will overflow and cause a divide by zero error.  This can cause kernel
      BUG if such a file system is mounted.
      
      Thanks to Nageswara R Sastry for analyzing the failure and providing
      an initial patch.
      
      http://bugzilla.kernel.org/show_bug.cgi?id=14287Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      8ed33ff5
    • Theodore Ts'o's avatar
      ext4: fix potential buffer head leak when add_dirent_to_buf() returns ENOSPC · 6662a8d0
      Theodore Ts'o authored
      (cherry picked from commit 2de770a4)
      
      Previously add_dirent_to_buf() did not free its passed-in buffer head
      in the case of ENOSPC, since in some cases the caller still needed it.
      However, this led to potential buffer head leaks since not all callers
      dealt with this correctly.  Fix this by making simplifying the freeing
      convention; now add_dirent_to_buf() *never* frees the passed-in buffer
      head, and leaves that to the responsibility of its caller.  This makes
      things cleaner and easier to prove that the code is neither leaking
      buffer heads or calling brelse() one time too many.
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Cc: Curt Wohlgemuth <curtw@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      6662a8d0
    • Yang, Bo's avatar
      SCSI: megaraid_sas: fix 64 bit sense pointer truncation · d10a8f05
      Yang, Bo authored
      commit 7b2519af upstream.
      
      The current sense pointer is cast to a u32 pointer, which can truncate
      on 64 bits.  Fix by using unsigned long instead.
      
      Signed-off-by Bo Yang<bo.yang@lsi.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      d10a8f05
    • Martin Michlmayr's avatar
      SCSI: osd_protocol.h: Add missing #include · 79daedf8
      Martin Michlmayr authored
      commit 08996386 upstream.
      
      include/scsi/osd_protocol.h uses ALIGN() without an #include
      <linux/kernel.h>, leading to:
      | include/scsi/osd_protocol.h:362: error: implicit declaration of function 'ALIGN'
      Signed-off-by: default avatarMartin Michlmayr <tbm@cyrius.com>
      Signed-off-by: default avatarBoaz Harrosh <bharrosh@panasas.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      79daedf8
    • James Bottomley's avatar
      SCSI: scsi_lib_dma: fix bug with dma maps on nested scsi objects · d888b1a2
      James Bottomley authored
      commit d139b9bd upstream.
      
      Some of our virtual SCSI hosts don't have a proper bus parent at the
      top, which can be a problem for doing DMA on them
      
      This patch makes the host device cache a pointer to the physical bus
      device and provides an extra API for setting it (the normal API picks
      it up from the parent).  This patch also modifies the qla2xxx and lpfc
      vport logic to use the new DMA host setting API.
      Acked-By: default avatarJames Smart  <james.smart@emulex.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      d888b1a2
    • Sebastian Andrzej Siewior's avatar
      signal: Fix alternate signal stack check · 98d338a7
      Sebastian Andrzej Siewior authored
      commit 2a855dd0 upstream.
      
      All architectures in the kernel increment/decrement the stack pointer
      before storing values on the stack.
      
      On architectures which have the stack grow down sas_ss_sp == sp is not
      on the alternate signal stack while sas_ss_sp + sas_ss_size == sp is
      on the alternate signal stack.
      
      On architectures which have the stack grow up sas_ss_sp == sp is on
      the alternate signal stack while sas_ss_sp + sas_ss_size == sp is not
      on the alternate signal stack.
      
      The current implementation fails for architectures which have the
      stack grow down on the corner case where sas_ss_sp == sp.This was
      reported as Debian bug #544905 on AMD64.
      Simplified test case: http://download.breakpoint.cc/tc-sig-stack.c
      
      The test case creates the following stack scenario:
         0xn0300	stack top
         0xn0200	alt stack pointer top (when switching to alt stack)
         0xn01ff	alt stack end
         0xn0100	alt stack start == stack pointer
      
      If the signal is sent the stack pointer is pointing to the base
      address of the alt stack and the kernel erroneously decides that it
      has already switched to the alternate stack because of the current
      check for "sp - sas_ss_sp < sas_ss_size"
      
      On parisc (stack grows up) the scenario would be:
         0xn0200	stack pointer
         0xn01ff	alt stack end
         0xn0100	alt stack start = alt stack pointer base
         		    	  	  (when switching to alt stack)
         0xn0000	stack base
      
      This is handled correctly by the current implementation.
      
      [ tglx: Modified for archs which have the stack grow up (parisc) which
        	would fail with the correct implementation for stack grows
        	down. Added a check for sp >= current->sas_ss_sp which is
        	strictly not necessary but makes the code symetric for both
        	variants ]
      Signed-off-by: default avatarSebastian Andrzej Siewior <sebastian@breakpoint.cc>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Roland McGrath <roland@redhat.com>
      Cc: Kyle McMartin <kyle@mcmartin.ca>
      LKML-Reference: <20091025143758.GA6653@Chamillionaire.breakpoint.cc>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      98d338a7
  2. 03 Dec, 2009 1 commit
  3. 02 Dec, 2009 26 commits
  4. 01 Dec, 2009 5 commits