1. 28 7月, 2010 3 次提交
  2. 17 5月, 2010 1 次提交
    • R
      [SCSI] libfc: Move the port_id into lport · 7b2787ec
      Robert Love 提交于
      This patch creates a port_id member in struct fc_lport.
      This allows libfc to just deal with fc_lport instances
      instead of calling into the fc_host to get the port_id.
      
      This change helps in only using symbols necessary for
      operation from the libfc structures. libfc still needs
      to change the fc_host_port_id() if the port_id changes
      so the presentation layer (scsi_transport_fc) can provide
      the user with the correct value, but libfc shouldn't
      rely on the presentation layer for operational values.
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      7b2787ec
  3. 12 4月, 2010 2 次提交
  4. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  5. 05 12月, 2009 4 次提交
    • J
      [SCSI] libfc fcoe: increase ELS and CT timeouts · b94f8951
      Joe Eykholt 提交于
      The FC-LS spec. says ELS timeouts should be 2 x R_A_TOV.
      The FC-GS spec. says CT timeouts should be 3 x R_A_TOV.
      
      We've been using E_D_TOV for both of those.
      
      Change for all ELS and CT requests except FLOGI, which we
      leave at 2 seconds (using E_D_TOV).  One could argue that
      R_A_TOV is locally determined until after FLOGI succeeds.
      
      This does change FLOGI for vports which becomes FDISC.
      This does not change the REC/SRR timeout which is 2 seconds.
      Signed-off-by: NJoe Eykholt <jeykholt@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      b94f8951
    • R
      [SCSI] libfc: Formatting cleanups across libfc · 3a3b42bf
      Robert Love 提交于
      This patch makes a variety of cleanup changes to all libfc files.
      
      This patch adds kernel-doc headers to all functions lacking them
      and attempts to better format existing headers. It also add kernel-doc
      headers to structures.
      
      This patch ensures that the current naming conventions for local ports,
      remote ports and remote port private data is upheld in the following
      manner.
      
      struct               instance (i.e. variable name)
      --------------------------------------------------
      fc_lport                      lport
      fc_rport                      rport
      fc_rport_libfc_priv           rpriv
      fc_rport_priv                 rdata
      
      I also renamed dns_rp and ptp_rp to dns_rdata and ptp_rdata
      respectively.
      
      I used emacs 'indent-region' and 'tabify' on all libfc files
      to correct spacing alignments.
      
      I feel sorry for anyone attempting to review this patch.
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      3a3b42bf
    • R
      [SCSI] libfc: Add libfc/fc_libfc.[ch] for libfc internal routines · 8866a5d9
      Robert Love 提交于
      include/scsi/libfc.h is currently loaded with common code
      shared between libfc's sub-modules as well as shared between
      libfc and fcoe. Previous patches attempted to move out
      non-common code. This patch creates two files for common
      libfc routines that will not be shared with fcoe, fnic or
      any other LLDs.
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      8866a5d9
    • C
      [SCSI] libfc: fix memory corruption caused by double frees and bad error handling · 8f550f93
      Chris Leech 提交于
      I was running into several different panics under stress, which I traced down
      to a few different possible slab corruption issues in error handling paths.
      I have not yet looked into why these exchange sends fail, but with these
      fixes my test system is much more stable under stress than before.
      
      fc_elsct_send() could fail and either leave the passed in frame intact
      (failure in fc_ct/els_fill) or the frame could have been freed if the
      failure was is fc_exch_seq_send().  The caller had no way of knowing, and
      there was a potential double free in the error handling in fc_fcp_rec().
      
      Make fc_elsct_send() always free the frame before returning, and remove the
      fc_frame_free() call in fc_fcp_rec().
      
      While fc_exch_seq_send() did always consume the frame, there were double free
      bugs in the error handling of fc_fcp_cmd_send() and fc_fcp_srr() as well.
      
      Numerous calls to error handling routines (fc_disc_error(),
      fc_lport_error(), fc_rport_error_retry() ) were passing in a frame pointer that
      had already been freed in the case of an error.  I have changed the call
      sites to pass in a NULL pointer, but there may be more appropriate error
      codes to use.
      
      Question:  Why do these error routines take a frame pointer anyway?  I
      understand passing in a pointer encoded error to the response handlers, but
      the error routines take no action on a valid pointer and should never be
      called that way.
      Signed-off-by: NChris Leech <christopher.leech@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      8f550f93
  6. 11 9月, 2009 24 次提交
  7. 22 6月, 2009 1 次提交
  8. 27 4月, 2009 2 次提交
    • A
      [SCSI] libfc: Track rogue remote ports · b4c6f546
      Abhijeet Joglekar 提交于
      Rogue ports are currently not tracked on any list. The only reference
      to them is through any outstanding exchanges pending on the rogue ports.
      If the module is removed while a retry is set on a rogue port
      (say a Plogi retry for instance), this retry is not cancelled because there
      is no reference to the rogue port in the discovery rports list. Thus the
      local port can clean itself up, delete the exchange pool, and then the
      rogue port timeout can fire and try to start up another exchange.
      
      This patch tracks the rogue ports in a new list disc->rogue_rports. Creating
      a new list instead of using the disc->rports list keeps remote port code
      change to a minimum.
      
      1)  Whenever a rogue port is created, it is immediately added to the
      disc->rogue_rports list.
      
      2) When the rogues port goes to ready, it is removed from the rogue list
      and the real remote port is added to the disc->rports list
      
      3) The removal of the rogue from the disc->rogue_rports list is done in
      the context of the fc_rport_work() workQ thread in discovery callback.
      
      4) Real rports are removed from the disc->rports list like before. Lookup
      is done only in the real rports list. This avoids making large changes
      to the remote port code.
      
      5) In fc_disc_stop_rports, the rogues list is traversed in addition to the
      real list to stop the rogue ports and issue logoffs on them. This way, rogue
      ports get cleaned up when the local port goes away.
      
      6) rogue remote ports are not removed from the list right away, but
      removed late in fc_rport_work() context, multiple threads can find the same
      remote port in the list and call rport_logoff(). Rport_logoff() only
      continues with the logoff if port is not in NONE state, thus preventing
      multiple logoffs and multiple list deletions.
      
      7) Since the rport is removed from the disc list at a later stage
      (in the disc callback), incoming frames can find the rport even if
      rport_logoff() has been called on the rport. When rport_logoff() is called,
      the rport state is set to NONE, and we are trying to cancel all exchanges
      and retries on that port. While in this state, if an incoming
      Plogi/Prli/Logo or other frames match the rport, we should not reply
      because the rport is in the NONE state. Just drop the frame, since the
      rport will be deleted soon in the disc callback (fc_rport_work)
      
      8)  In fc_disc_single(), remove rport lookup and call to fc_disc_del_target.
      fc_disc_single() is called from recv_rscn_req() where rport lookup
      and rport_logoff is already done.
      Signed-off-by: NAbhijeet Joglekar <abjoglek@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      b4c6f546
    • A
      [SCSI] libfc: Hold disc mutex while processing gpn ft resp · 0d228c0f
      Abhijeet Joglekar 提交于
      gpn_ft_resp processing currently does not hold the discovery lock.
      disc_done() thus gets called from gpn_ft_resp or from gpn_ft_parse
      without the lock held. This then sets disc->pending to zero or calls
      gpn_ft_req() without disc_lock held.
      
      - Hold disc mutex during gpn_ft resp processing
      - In disc_done, release the disc mutex while calling lport callback
      Signed-off-by: NAbhijeet Joglekar <abjoglek@cisco.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      0d228c0f
  9. 10 3月, 2009 1 次提交
    • R
      [SCSI] libfc, fcoe: Fix kerneldoc comments · 34f42a07
      Robert Love 提交于
      1) Added '()' for function names in kerneldoc comments
      
      2) Changed comment bookends from '**/' to '*/'. The comment on the the
         mailing list was that '**/' "is consistently unconventional.  Not
         wrong, just odd." The Documentation/kernel-doc-nano-HOWTO.txt
         states that kerneldoc comment blocks should end with '**/' but most
         (if not all) instance I found under drivers/scsi/ were only using
         the '*/' so I converted to that style.
      
      3) Removed incorrect linebreaks in kerneldoc comments where found
      
      4) Removed a few unnecessary blank comment lines in kerneldoc comment
         blocks
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      34f42a07
  10. 07 3月, 2009 1 次提交