1. 01 Nov, 2012 4 commits
    • Roland Dreier's avatar
      iscsi-target: Fix missed wakeup race in TX thread · d5627acb
      Roland Dreier authored
      The sleeping code in iscsi_target_tx_thread() is susceptible to the classic
      missed wakeup race:
      
       - TX thread finishes handle_immediate_queue() and handle_response_queue(),
         thinks both queues are empty.
       - Another thread adds a queue entry and does wake_up_process(), which does
         nothing because the TX thread is still awake.
       - TX thread does schedule_timeout() and sleeps forever.
      
      In practice this can kill an iSCSI connection if for example an initiator
      does single-threaded writes and the target misses the wakeup window when
      queueing an R2T; in this case the connection will be stuck until the
      initiator loses patience and does some task management operation (or kills
      the connection entirely).
      
      Fix this by converting to wait_event_interruptible(), which does not
      suffer from this sort of race.
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      Cc: Andy Grover <agrover@redhat.com>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      d5627acb
    • Roland Dreier's avatar
      target: Avoid integer overflow in se_dev_align_max_sectors() · 3e03989b
      Roland Dreier authored
      The expression (max_sectors * block_size) might overflow a u32
      (indeed, since iblock sets max_hw_sectors to UINT_MAX, it is
      guaranteed to overflow and end up with a much-too-small result in many
      common cases).  Fix this by doing an equivalent calculation that
      doesn't require multiplication.
      
      While we're touching this code, avoid splitting a printk format across
      two lines and use pr_info(...) instead of printk(KERN_INFO ...).
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      3e03989b
    • Roland Dreier's avatar
      target: Don't return success from module_init() if setup fails · 0d0f9dfb
      Roland Dreier authored
      If the call to core_dev_release_virtual_lun0() fails, then nothing
      sets ret to anything other than 0, so even though everything is
      torn down and freed, target_core_init_configfs() will seem to succeed
      and the module will be loaded.  Fix this by passing the return value
      on up the chain.
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      0d0f9dfb
    • Nicholas Bellinger's avatar
      target: Re-add explict zeroing of INQUIRY bounce buffer memory · dea5f099
      Nicholas Bellinger authored
      This patch fixes a regression in spc_emulate_inquiry() code where the
      local scope bounce buffer was no longer getting it's memory zeroed,
      causing various problems with SCSI initiators that depend upon areas
      of INQUIRY EVPD=0x83 payload having been zeroed.
      
      This bug was introduced with the following v3.7-rc1 patch + CC'ed
      stable commit:
      
      commit ffe7b0e9
      Author: Paolo Bonzini <pbonzini@redhat.com>
      Date:   Fri Sep 7 17:30:38 2012 +0200
      
          target: support zero allocation length in INQUIRY
      
      Go ahead and re-add the missing memset of bounce buffer memory to be
      copied into the outgoing se_cmd descriptor kmapped SGL payload.
      Reported-by: default avatarKelsey Prantis <kelsey.prantis@intel.com>
      Cc: Kelsey Prantis <kelsey.prantis@intel.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Andy Grover <agrover@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      dea5f099
  2. 26 Oct, 2012 5 commits
    • Bernhard Kohl's avatar
      target: reintroduce some obsolete SCSI-2 commands · 1a1ff38c
      Bernhard Kohl authored
      With kernel 3.6 some obsolete SCSI-2 commands including SEEK_10 have
      have been removed by commit 1fd032ee
      "target: move code for CDB emulation".
      
      There are still clients out there which use these old SCSI-2 commands.
      This mainly happens when running VMs with legacy guest systems,
      connected via SCSI command pass-through to iSCSI targets. Make them
      happy and return status GOOD.
      
      Many real SCSI disks or external iSCSI storage devices still support
      these old commands. So let's make LIO backward compatible as well.
      
      This patch adds support for the previously removed SEEK_10 and
      additionally the SEEK_6 and REZERO_UNIT commands.
      Signed-off-by: default avatarBernhard Kohl <bernhard.kohl@nsn.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      1a1ff38c
    • Nicholas Bellinger's avatar
      target: Fix double-free of se_cmd in target_complete_tmr_failure · e13d5fef
      Nicholas Bellinger authored
      Fabric drivers currently expect to internally release se_cmd in the event
      of a TMR failure during target_submit_tmr(), which means the immediate call
      to transport_generic_free_cmd() after TFO->queue_tm_rsp() from within
      target_complete_tmr_failure() workqueue context is wrong.
      
      This is done as some fabrics expect TMR operations to be acknowledged
      before releasing the descriptor, so the assumption that core is releasing
      se_cmd associated TMR memory is incorrect.  This fixes a OOPs where
      transport_generic_free_cmd() was being called more than once.
      
      This bug was originally observed with tcm_qla2xxx fabric ports.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Andy Grover <agrover@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      e13d5fef
    • Roland Dreier's avatar
      qla2xxx: Update target lookup session tables when a target session changes · c8292d1d
      Roland Dreier authored
      It is possible for the target code to change the loop_id or s_id of a
      target session in reaction to an FC fabric change.  However, the
      session structures are stored in tables that are indexed by these two
      keys, and if we just change the session structure but leave the
      pointers to it in the old places in the table, havoc can ensue.  For
      example, a new session might come along that should go in the old slot
      in the table and overwrite the old session pointer.
      
      To handle this, add a new tgt_ops->update_sess() method that also
      updates the "by loop_id" and "by s_id" lookup tables when a session
      changes, so that the keys where a session pointer is stored in these
      tables always matches the keys in the session structure itself.
      
      (nab: Drop unnecessary double inversion with FCF_CONF_COMP_SUPPORTED
            usage)
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      Cc: Chad Dupuis <chad.dupuis@qlogic.com>
      Cc: Arun Easi <arun.easi@qlogic.com>
      Cc: Saurav Kashyap <saurav.kashyap@qlogic.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      c8292d1d
    • Roland Dreier's avatar
      tcm_qla2xxx: Format VPD page 83h SCSI name string according to SPC · c046aa0f
      Roland Dreier authored
      My draft of SPC-4 says the following about the SCSI name string in
      inquiry VPD page 83h:
      
          The SCSI NAME STRING field starts with either:
      
          a) the four UTF-8 characters 'eui.' concatenated with 16, 24, or
             32 hexadecimal digits (i.e., the UTF-8 characters 0 through 9
             and A through F) for an EUI-64 based identifier (see
             7.8.6.5). The first hexadecimal digit shall be the most
             significant four bits of the first byte (i.e., most significant
             byte) of the EUI-64 based identifier;
          b) the four UTF-8 characters 'naa.' concatenated with 16 or 32
             hexadecimal digits for an NAA identifier (see 7.8.6.6). The
             first hexadecimal digit shall be the most significant four bits
             of the first byte (i.e., most significant byte) of the NAA
             identifier; or
          c) the four UTF-8 characters 'iqn.' concatenated with an iSCSI
             Name for an iSCSI-name based identifier (see iSCSI).
      
      However, the .tpg_get_wwn method for tcm_qla2xxx formats the WWN so
      the SCSI name string looks like "52:4a:93:7d:24:5f:b2:12,t,0x0001".
      This patch corrects the code so that VPD 83h gives a SPC-compliant
      SCSI name string like "naa.524a937d245fb212,t,0x0001" while leavig
      other uses alone (so configfs will still work with ':' separated WWNs).
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      Cc: Chad Dupuis <chad.dupuis@qlogic.com>
      Cc: Arun Easi <arun.easi@qlogic.com>
      Cc: Saurav Kashyap <saurav.kashyap@qlogic.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      c046aa0f
    • Nicholas Bellinger's avatar
      qla2xxx: Add missing ->vport_slock while calling qlt_update_vp_map · 29c08cda
      Nicholas Bellinger authored
      All other callers of qlt_update_vp_map() already hold ->vport_slock
      while updating the vp target map, so go ahead and add the missing
      ->vport_slock within qla24xx_disable_vp() code.
      
      Cc: Saurav Kashyap <saurav.kashyap@qlogic.com>
      Cc: Chad Dupuis <chad.dupuis@qlogic.com>
      Cc: Arun Easi <arun.easi@qlogic.com>
      Cc: Andrew Vasquez <andrew.vasquez@qlogic.com>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Roland Dreier <roland@purestorage.com>
      Acked-by: default avatarSaurav Kashyap <saurav.kashyap@qlogic.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      29c08cda
  3. 20 Oct, 2012 9 commits
    • Linus Torvalds's avatar
      Linux 3.7-rc2 · 6f0c0580
      Linus Torvalds authored
      6f0c0580
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux-aarch64 · 198190a1
      Linus Torvalds authored
      Pull arm64 fixes from Catalin Marinas:
       "Main changes:
         - AArch64 Linux compilation fixes following 3.7-rc1 changes
           (MODULES_USE_ELF_RELA, update_vsyscall() prototype)
         - Unnecessary register setting in start_thread() (thanks to Al Viro)
         - ptrace fixes"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux-aarch64:
        arm64: fix alignment padding in assembly code
        arm64: ptrace: use HW_BREAKPOINT_EMPTY type for disabled breakpoints
        arm64: ptrace: make structure padding explicit for debug registers
        arm64: No need to set the x0-x2 registers in start_thread()
        arm64: Ignore memory blocks below PHYS_OFFSET
        arm64: Fix the update_vsyscall() prototype
        arm64: Select MODULES_USE_ELF_RELA
        arm64: Remove duplicate inclusion of mmu_context.h in smp.c
      198190a1
    • Marc Zyngier's avatar
      arm64: fix alignment padding in assembly code · aeed41a9
      Marc Zyngier authored
      An interesting effect of using the generic version of linkage.h
      is that the padding is defined in terms of x86 NOPs, which can have
      even more interesting effects when the assembly code looks like this:
      
      ENTRY(func1)
      	mov	x0, xzr
      ENDPROC(func1)
      	// fall through
      ENTRY(func2)
      	mov	x0, #1
      	ret
      ENDPROC(func2)
      
      Admittedly, the code is not very nice. But having code from another
      architecture doesn't look completely sane either.
      
      The fix is to add arm64's version of linkage.h, which causes the insertion
      of proper AArch64 NOPs.
      Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      aeed41a9
    • Kees Cook's avatar
      use clamp_t in UNAME26 fix · 31fd84b9
      Kees Cook authored
      The min/max call needed to have explicit types on some architectures
      (e.g. mn10300). Use clamp_t instead to avoid the warning:
      
        kernel/sys.c: In function 'override_release':
        kernel/sys.c:1287:10: warning: comparison of distinct pointer types lacks a cast [enabled by default]
      Reported-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      31fd84b9
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 8c1bee68
      Linus Torvalds authored
      Pull perf fixes from Ingo Molnar:
       "Assorted small fixes"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf python: Properly link with libtraceevent
        perf hists browser: Add back callchain folding symbol
        perf tools: Fix build on sparc.
        perf python: Link with libtraceevent
        perf python: Initialize 'page_size' variable
        tools lib traceevent: Fix missed freeing of subargs in free_arg() in filter
        lib tools traceevent: Add back pevent assignment in __pevent_parse_format()
        perf hists browser: Fix off-by-two bug on the first column
        perf tools: Remove warnings on JIT samples for srcline sort key
        perf tools: Fix segfault when using srcline sort key
        perf: Require exclude_guest to use PEBS - kernel side enforcement
        perf tool: Precise mode requires exclude_guest
      8c1bee68
    • Arnaldo Carvalho de Melo's avatar
      perf python: Properly link with libtraceevent · 45bff41a
      Arnaldo Carvalho de Melo authored
      Namhyung Kim reported that the build fails with:
      
        GEN python/perf.so
        gcc: error: python_ext_build/tmp//../../libtraceevent.a: No such file or directory
        error: command 'gcc' failed with exit status 1
        cp: cannot stat `python_ext_build/lib/perf.so': No such file or directory
        make: *** [python/perf.so] Error 1
      
      We need to propagate the TE_PATH variable to the setup.py file.
      Reported-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Link: http://lkml.kernel.org/n/tip-8umiPbm4sxpknKivbjgykhut@git.kernel.org
      [ Fixed superfluous variable build error. ]
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      45bff41a
    • Ingo Molnar's avatar
      Merge tag 'perf-urgent-for-mingo' of... · a448a031
      Ingo Molnar authored
      Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
      
      Pull perf/urgent fixes from Arnaldo Carvalho de Melo:
      
      * The python binding needs to link with libtraceevent and to initialize
        the 'page_size' variable so that mmaping works again.
      
      * The callchain folding character that appears on the TUI just before
        the overhead had disappeared due to recent changes, add it back.
      
      * Intel PEBS in VT-x context uses the DS address as a guest linear address,
        even though its programmed by the host as a host linear address. This either
        results in guest memory corruption and or the hardware faulting and 'crashing'
        the virtual machine.  Therefore we have to disable PEBS on VT-x enter and
        re-enable on VT-x exit, enforcing a strict exclude_guest.
      
        Kernel side enforcement fix by Peter Zijlstra, tooling side fix by David Ahern.
      
      * Fix build on sparc due to UAPI, fix from David Miller.
      
      * Fixes for the srclike sort key for unresolved symbols and when processing
        samples in JITted code, where we don't have an ELF file, just an special
        symbol table, fixes from Namhyung Kim.
      
      * Fix some leaks in libtraceevent, from Steven Rostedt.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      a448a031
    • Linus Torvalds's avatar
      Merge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc · 37820108
      Linus Torvalds authored
      Pull ARM soc fixes from Olof Johansson:
       "A set of fixes and some minor cleanups for -rc2:
      
         - A series from Arnd that fixes warnings in drivers and other code
           included by ARM defconfigs.  Most have been acked by corresponding
           maintainers (and seem quite hard to argue not picking up anyway in
           the few exception cases).
         - A few misc patches from the list for integrator/vt8500/i.MX
         - A batch of fixes to OMAP platforms, fixing:
           - boot problems on beaglebone,
           - regression fixes for local timers
           - clockdomain locking fixes
           - a few boot/sparse warnings
         - For Tegra:
           - Clock rate calculation overflow fix
           - Revert a change that removed timer clocks and a fix for symbol
             name clashes
         - For Renesas:
           - IO accessor / annotation cleanups to remove warnings
         - For Kirkwood/Dove/mvebu:
           - Fixes for device trees for Dove (some minor cleanups, some fixes)
           - Fixes for the mvebu gpio driver
           - Fix build problem for Feroceon due to missing ifdefs
           - Fix lsxl DTS files"
      
      * tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (31 commits)
        ARM: kirkwood: fix buttons on lsxl boards
        ARM: kirkwood: fix LEDs names for lsxl boards
        ARM: Kirkwood: fix disabling CACHE_FEROCEON_L2
        gpio: mvebu: Add missing breaks in mvebu_gpio_irq_set_type
        ARM: dove: Add crypto engine to DT
        ARM: dove: Remove watchdog from DT
        ARM: dove: Restructure SoC device tree descriptor
        ARM: dove: Fix clock names of sata and gbe
        ARM: dove: Fix tauros2 device tree init
        ARM: dove: Add pcie clock support
        ARM: OMAP2+: Allow kernel to boot even if GPMC fails to reserve memory
        ARM: OMAP: clockdomain: Fix locking on _clkdm_clk_hwmod_enable / disable
        ARM: s3c: mark s3c2440_clk_add as __init_refok
        spi/s3c64xx: use correct dma_transfer_direction type
        ARM: OMAP4: devices: fixup OMAP4 DMIC platform device error message
        ARM: OMAP2+: clock data: Add dev-id for the omap-gpmc dummy fck
        ARM: OMAP: resolve sparse warning concerning debug_card_init()
        ARM: OMAP4: Fix twd_local_timer_register regression
        ARM: tegra: add tegra_timer clock
        ARM: tegra: rename tegra system timer
        ...
      37820108
    • David Howells's avatar
      MODSIGN: Move the magic string to the end of a module and eliminate the search · caabe240
      David Howells authored
      Emit the magic string that indicates a module has a signature after the
      signature data instead of before it.  This allows module_sig_check() to
      be made simpler and faster by the elimination of the search for the
      magic string.  Instead we just need to do a single memcmp().
      
      This works because at the end of the signature data there is the
      fixed-length signature information block.  This block then falls
      immediately prior to the magic number.
      
      From the contents of the information block, it is trivial to calculate
      the size of the signature data and thus the size of the actual module
      data.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      caabe240
  4. 19 Oct, 2012 22 commits