1. 14 10月, 2013 1 次提交
  2. 12 10月, 2013 1 次提交
    • R
      libfcoe: Make fcoe_sysfs optional / fix fnic NULL exception · 9d34876f
      Robert Love 提交于
      fnic doesn't use any of the create/destroy/enable/disable interfaces
      either from the (legacy) module paramaters or the (new) fcoe_sysfs
      interfaces. When fcoe_sysfs was introduced fnic wasn't changed since
      it wasn't using the interfaces. libfcoe incorrectly assumed that that
      all of its users were using fcoe_sysfs and when adding and deleting
      FCFs would assume the existance of a fcoe_ctlr_device. fnic was not
      allocating this structure because it doesn't care about the standard
      user interfaces (fnic starts on link only). If/When libfcoe tried to use
      the fcoe_ctlr_device's lock for the first time a NULL pointer exception
      would be triggered.
      
      Since fnic doesn't care about sysfs or user interfaces, the solution
      is to drop libfcoe's assumption that all drivers are using fcoe_sysfs.
      
      This patch accomplishes this by changing some of the structure
      relationships.
      
      We need a way to determine when a LLD is using fcoe_sysfs or not and
      we can do that by checking for the existance of the fcoe_ctlr_device.
      Prior to this patch, it was assumed that the fcoe_ctlr structure was
      allocated with the fcoe_ctlr_device and immediately followed it in
      memory. To reach the fcoe_ctlr_device we would simply go back in memory
      from the fcoe_ctlr to get the fcoe_ctlr_device.
      
      Since fnic doesn't allocate the fcoe_ctlr_device, we cannot keep that
      assumption. This patch adds a pointer from the fcoe_ctlr to the
      fcoe_ctlr_device. For bnx2fc and fcoe we will continue to allocate the
      two structures together, but then we'll set the ctlr->cdev pointer
      to point at the fcoe_ctlr_device. fnic will not change and will continue
      to allocate the fcoe_ctlr itself, and ctlr->cdev will remain NULL.
      
      When libfcoe adds fcoe_fcf's to the fcoe_ctlr it will check if ctlr->cdev
      is set and only if so will it continue to interact with fcoe_sysfs.
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Acked-by: NNeil Horman <nhorman@tuxdriver.com>
      Tested-by: NHiral Patel <hiralpat@cisco.com>
      9d34876f
  3. 05 9月, 2013 6 次提交
    • B
      fcoe: Reduce fcoe_sysfs_fcf_add() stack usage · 1c2c1b4f
      Bart Van Assche 提交于
      This patch fixes the following compiler warning:
      
      drivers/scsi/fcoe/fcoe_ctlr.c: In function fcoe_sysfs_fcf_add:
      drivers/scsi/fcoe/fcoe_ctlr.c:211:1: warning: the frame size of 1480 bytes is larger than 1024 bytes [-Wframe-larger-than=]
      Signed-off-by: NBart Van Assche <bvanassche@acm.org>
      Cc: Neil Horman <nhorman@tuxdriver.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      1c2c1b4f
    • B
      fcoe: Add missing newlines in debug messages · 465b87bf
      Bart Van Assche 提交于
      FCoE debug statements must end in a newline. Add one where it is missing.
      Signed-off-by: NBart Van Assche <bvanassche@acm.org>
      Cc: Neil Horman <nhorman@tuxdriver.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      465b87bf
    • B
      fcoe: Declare fcoe_ctlr_mode_set() static · 41463a88
      Bart Van Assche 提交于
      The function fcoe_ctlr_mode_set() is local, hence declare it static.
      Signed-off-by: NBart Van Assche <bvanassche@acm.org>
      Cc: Neil Horman <nhorman@tuxdriver.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      41463a88
    • N
      fcoe: cleanup return codes from fcoe_rcv · 34bac2ef
      Neil Horman 提交于
      the return codes from fcoe_rcv should be NET_RX_*, not 0 or -1.
      Signed-off-by: NNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      34bac2ef
    • N
      fcoe: make sure fcoe frames are unshared prior to manipulating them · 8b612434
      Neil Horman 提交于
      Based on my last patch I noticed that fcoe_rcv has a simmilar problem, in that
      it manipulates the passed in skb without checking to see if it has other users.
      Making manipulations to a shared skb can result in various corruptions.
      
      Easy fix, just make sure the skb is unshared prior to doing anything with it.
      Signed-off-by: NNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      8b612434
    • N
      fcoe: ensure that skb placed on the fip_recv_list are unshared · c0866286
      Neil Horman 提交于
      Recently had this Oops reported to me on the 3.10 kernel:
      
      [  807.554955] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
      [  807.562799] IP: [<ffffffff814e6fc7>] skb_dequeue+0x47/0x70
      [  807.568296] PGD 20c889067 PUD 20c8b8067 PMD 0
      [  807.572769] Oops: 0002 [#1] SMP
      [  807.655597] Hardware name: Dell Inc. PowerEdge R415/0DDT2D, BIOS 1.8.6 12/06/2011
      [  807.663079] Workqueue: events fcoe_ctlr_recv_work [libfcoe]
      [  807.668656] task: ffff88020b42a160 ti: ffff88020ae6c000 task.ti: ffff88020ae6c000
      [  807.676126] RIP: 0010:[<ffffffff814e6fc7>]  [<ffffffff814e6fc7>] skb_dequeue+0x47/0x70
      [  807.684046] RSP: 0000:ffff88020ae6dd70  EFLAGS: 00010097
      [  807.689349] RAX: 0000000000000246 RBX: ffff8801d04d6700 RCX: 0000000000000000
      [  807.696474] RDX: 0000000000000000 RSI: 0000000000000246 RDI: ffff88020df26434
      [  807.703598] RBP: ffff88020ae6dd88 R08: 00000000000173e0 R09: ffff880216e173e0
      [  807.710723] R10: ffffffff814e5897 R11: ffffea0007413580 R12: ffff88020df26420
      [  807.717847] R13: ffff88020df26434 R14: 0000000000000004 R15: ffff8801d04c42ce
      [  807.724972] FS:  00007fdaab6048c0(0000) GS:ffff880216e00000(0000) knlGS:0000000000000000
      [  807.733049] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      [  807.738785] CR2: 0000000000000008 CR3: 000000020cbc9000 CR4: 00000000000006f0
      [  807.745910] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  807.753033] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      [  807.760156] Stack:
      [  807.762162]  ffff8801d04d6700 0000000000000001 ffff88020df26400 ffff88020ae6de20
      [  807.769586]  ffffffffa0444409 ffff88020b046a00 ffff88020ae6dde8 ffffffff810105be
      [  807.777008]  ffff88020b42a868 0000000000000000 ffff88020df264a8 ffff88020df26348
      [  807.784431] Call Trace:
      [  807.786885]  [<ffffffffa0444409>] fcoe_ctlr_recv_work+0x59/0x9a0 [libfcoe]
      [  807.793755]  [<ffffffff810105be>] ? __switch_to+0x13e/0x4a0
      [  807.799324]  [<ffffffff8107d0e6>] process_one_work+0x176/0x420
      [  807.805151]  [<ffffffff8107dd0b>] worker_thread+0x11b/0x3a0
      [  807.810717]  [<ffffffff8107dbf0>] ? rescuer_thread+0x350/0x350
      [  807.816545]  [<ffffffff810842b0>] kthread+0xc0/0xd0
      [  807.821416]  [<ffffffff810841f0>] ? insert_kthread_work+0x40/0x40
      [  807.827503]  [<ffffffff8160ce2c>] ret_from_fork+0x7c/0xb0
      [  807.832897]  [<ffffffff810841f0>] ? insert_kthread_work+0x40/0x40
      [  807.858500] RIP  [<ffffffff814e6fc7>] skb_dequeue+0x47/0x70
      [  807.864076]  RSP <ffff88020ae6dd70>
      [  807.867558] CR2: 0000000000000008
      
      Looks like the root cause is the fact that the packet recieve function
      fcoe_ctlr_recv enqueues the skb to a sk_buff_head_list prior to ensuring that
      the skb is unshared.  This can happen when multiple packet listeners recieve an
      skb, as the deliver_skb function just increments skb->users for each handler.
      As a result, having multiple users of a single skb results in multiple
      manipulators of its methods, implying list corruption, and the oops recorded
      above.
      
      The fix is pretty easy, just make sure that we clone the skb if its got multiple
      users with the skb_share_check function, like other protocols do.
      Signed-off-by: NNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      c0866286
  4. 10 7月, 2013 5 次提交
  5. 26 6月, 2013 1 次提交
    • R
      fcoe: Use correct API to set vlan tag for FCoE Ethertype skbs · 2884d423
      Robert Love 提交于
      fcoe_xmit was coded such that it would skip the vlan net device/layer
      and instead set some vlan flags and transmit on the real net device.
      The real net device has code that would add the vlan tag for fcoe skbs.
      This avoids some extra processing for data frames and provides a small
      performance improvement.
      
      Since fcoe_xmit was not using the vlan net device, __vlan_put_tag
      within the real net device's xmit routine was ultimately being
      called to set the vlan tag.
      
      With the below change the behavior of __vlan_put_tag changed slightly,
      it now sets the skb->protocol = vlan_proto. vlan_proto was not a field
      being set by fcoe_xmit, so the skb->protocol is now not being set to
      ETH_P_8021Q, as it should be.
      
      This patch converts fcoe_xmit to use the vlan_put_tag routine which
      will tag the skb and fcoe will continue to transmit fcoe skbs on the
      real net device.
      
      For reference, the below change was the one that altered the
      __vlan_put_tag behavior.
      
        commit 86a9bad3
        Author: Patrick McHardy <kaber@trash.net>
        Date:   Fri Apr 19 02:04:30 2013 +0000
      
            net: vlan: add protocol argument to packet tagging functions
      
            Add a protocol argument to the VLAN packet tagging functions. In case of HW
            tagging, we need that protocol available in the ndo_start_xmit functions,
            so it is stored in a new field in the skb. The new field fits into a hole
            (on 64 bit) and doesn't increase the sks's size.
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Acked-by: NNeil Horman <nhorman@tuxdriver.com>
      Acked-by: NJohn Fastabend <john.r.fastabend@intel.com>
      2884d423
  6. 29 5月, 2013 1 次提交
  7. 11 5月, 2013 1 次提交
  8. 30 4月, 2013 1 次提交
  9. 20 4月, 2013 1 次提交
  10. 26 3月, 2013 4 次提交
    • R
      libfcoe: Fix fcoe_sysfs VN2VN mode · 0db0e377
      Robert Love 提交于
      The libfc discovery layer is being initialized in the
      'create' paths for both legacy libfcoe module parameters
      and fcoe_sysfs control interfaces. The problem is that
      for VN2VN mode the discovery layer is initialized as if
      it were in 'fabric' mode and it is not re-configured when
      the mode is changed to 'vn2vn'.
      
      This patch splits out code that needs to be initialized
      once and code that can, and should be, re-configured when
      the mode changes. Additionally this patch makes that change
      so that the discovery layer can be reconfigured to the
      libfcoe implementation when in 'vn2vn' mode.
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Tested-by: NJack Morgan <jack.morgan@intel.com>
      Reviewed-by: NBhanu Prakash Gollapudi <bprakash@broadcom.com>
      0db0e377
    • R
      libfc, fcoe, bnx2fc: Split fc_disc_init into fc_disc_{init, config} · 0807619d
      Robert Love 提交于
      Split discovery initialization in code that is setup once (fcoe_disc_init)
      and code that can be re-configured (fcoe_disc_config).
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Tested-by: NJack Morgan <jack.morgan@intel.com>
      Reviewed-by: NBhanu Prakash Gollapudi <bprakash@broadcom.com>
      0807619d
    • R
      libfc, fcoe, bnx2fc: Always use fcoe_disc_init for discovery layer initialization · 8a9a7138
      Robert Love 提交于
      Currently libfcoe is doing some libfc discovery layer initialization outside of
      libfc. This patch moves this code into libfc and sets up a split in discovery
      (one time) initialization code and (re-configurable) settings that will come in
      the next patch.
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Tested-by: NJack Morgan <jack.morgan@intel.com>
      Reviewed-by: NBhanu Prakash Gollapudi <bprakash@broadcom.com>
      8a9a7138
    • R
      fcoe: Fix deadlock between create and destroy paths · f9c4358e
      Robert Love 提交于
      We can deadlock (s_active and fcoe_config_mutex) if a
      port is being destroyed at the same time one is being created.
      
      [ 4200.503113] ======================================================
      [ 4200.503114] [ INFO: possible circular locking dependency detected ]
      [ 4200.503116] 3.8.0-rc5+ #8 Not tainted
      [ 4200.503117] -------------------------------------------------------
      [ 4200.503118] kworker/3:2/2492 is trying to acquire lock:
      [ 4200.503119]  (s_active#292){++++.+}, at: [<ffffffff8122d20b>] sysfs_addrm_finish+0x3b/0x70
      [ 4200.503127]
      but task is already holding lock:
      [ 4200.503128]  (fcoe_config_mutex){+.+.+.}, at: [<ffffffffa02f3338>] fcoe_destroy_work+0xe8/0x120 [fcoe]
      [ 4200.503133]
      which lock already depends on the new lock.
      
      [ 4200.503135]
      the existing dependency chain (in reverse order) is:
      [ 4200.503136]
      -> #1 (fcoe_config_mutex){+.+.+.}:
      [ 4200.503139]        [<ffffffff810c7711>] lock_acquire+0xa1/0x140
      [ 4200.503143]        [<ffffffff816ca7be>] mutex_lock_nested+0x6e/0x360
      [ 4200.503146]        [<ffffffffa02f11bd>] fcoe_enable+0x1d/0xb0 [fcoe]
      [ 4200.503148]        [<ffffffffa02f127d>] fcoe_ctlr_enabled+0x2d/0x50 [fcoe]
      [ 4200.503151]        [<ffffffffa02ffbe8>] store_ctlr_enabled+0x38/0x90 [libfcoe]
      [ 4200.503154]        [<ffffffff81424878>] dev_attr_store+0x18/0x30
      [ 4200.503157]        [<ffffffff8122b750>] sysfs_write_file+0xe0/0x150
      [ 4200.503160]        [<ffffffff811b334c>] vfs_write+0xac/0x180
      [ 4200.503162]        [<ffffffff811b3692>] sys_write+0x52/0xa0
      [ 4200.503164]        [<ffffffff816d7159>] system_call_fastpath+0x16/0x1b
      [ 4200.503167]
      -> #0 (s_active#292){++++.+}:
      [ 4200.503170]        [<ffffffff810c680f>] __lock_acquire+0x135f/0x1c90
      [ 4200.503172]        [<ffffffff810c7711>] lock_acquire+0xa1/0x140
      [ 4200.503174]        [<ffffffff8122c626>] sysfs_deactivate+0x116/0x160
      [ 4200.503176]        [<ffffffff8122d20b>] sysfs_addrm_finish+0x3b/0x70
      [ 4200.503178]        [<ffffffff8122b2eb>] sysfs_hash_and_remove+0x5b/0xb0
      [ 4200.503180]        [<ffffffff8122f3d1>] sysfs_remove_group+0x61/0x100
      [ 4200.503183]        [<ffffffff814251eb>] device_remove_groups+0x3b/0x60
      [ 4200.503185]        [<ffffffff81425534>] device_remove_attrs+0x44/0x80
      [ 4200.503187]        [<ffffffff81425e97>] device_del+0x127/0x1c0
      [ 4200.503189]        [<ffffffff81425f52>] device_unregister+0x22/0x60
      [ 4200.503191]        [<ffffffffa0300970>] fcoe_ctlr_device_delete+0xe0/0xf0 [libfcoe]
      [ 4200.503194]        [<ffffffffa02f1b5c>] fcoe_interface_cleanup+0x6c/0xa0 [fcoe]
      [ 4200.503196]        [<ffffffffa02f3355>] fcoe_destroy_work+0x105/0x120 [fcoe]
      [ 4200.503198]        [<ffffffff8107ee91>] process_one_work+0x1a1/0x580
      [ 4200.503203]        [<ffffffff81080c6e>] worker_thread+0x15e/0x440
      [ 4200.503205]        [<ffffffff8108715a>] kthread+0xea/0xf0
      [ 4200.503207]        [<ffffffff816d70ac>] ret_from_fork+0x7c/0xb0
      
      [ 4200.503209]
      other info that might help us debug this:
      
      [ 4200.503211]  Possible unsafe locking scenario:
      
      [ 4200.503212]        CPU0                    CPU1
      [ 4200.503213]        ----                    ----
      [ 4200.503214]   lock(fcoe_config_mutex);
      [ 4200.503215]                                lock(s_active#292);
      [ 4200.503218]                                lock(fcoe_config_mutex);
      [ 4200.503219]   lock(s_active#292);
      [ 4200.503221]
       *** DEADLOCK ***
      
      [ 4200.503223] 3 locks held by kworker/3:2/2492:
      [ 4200.503224]  #0:  (fcoe){.+.+.+}, at: [<ffffffff8107ee2b>] process_one_work+0x13b/0x580
      [ 4200.503228]  #1:  ((&port->destroy_work)){+.+.+.}, at: [<ffffffff8107ee2b>] process_one_work+0x13b/0x580
      [ 4200.503232]  #2:  (fcoe_config_mutex){+.+.+.}, at: [<ffffffffa02f3338>] fcoe_destroy_work+0xe8/0x120 [fcoe]
      [ 4200.503236]
      stack backtrace:
      [ 4200.503238] Pid: 2492, comm: kworker/3:2 Not tainted 3.8.0-rc5+ #8
      [ 4200.503240] Call Trace:
      [ 4200.503243]  [<ffffffff816c2f09>] print_circular_bug+0x1fb/0x20c
      [ 4200.503246]  [<ffffffff810c680f>] __lock_acquire+0x135f/0x1c90
      [ 4200.503248]  [<ffffffff810c463a>] ? debug_check_no_locks_freed+0x9a/0x180
      [ 4200.503250]  [<ffffffff810c7711>] lock_acquire+0xa1/0x140
      [ 4200.503253]  [<ffffffff8122d20b>] ? sysfs_addrm_finish+0x3b/0x70
      [ 4200.503255]  [<ffffffff8122c626>] sysfs_deactivate+0x116/0x160
      [ 4200.503258]  [<ffffffff8122d20b>] ? sysfs_addrm_finish+0x3b/0x70
      [ 4200.503260]  [<ffffffff8122d20b>] sysfs_addrm_finish+0x3b/0x70
      [ 4200.503262]  [<ffffffff8122b2eb>] sysfs_hash_and_remove+0x5b/0xb0
      [ 4200.503265]  [<ffffffff8122f3d1>] sysfs_remove_group+0x61/0x100
      [ 4200.503273]  [<ffffffff814251eb>] device_remove_groups+0x3b/0x60
      [ 4200.503275]  [<ffffffff81425534>] device_remove_attrs+0x44/0x80
      [ 4200.503277]  [<ffffffff81425e97>] device_del+0x127/0x1c0
      [ 4200.503279]  [<ffffffff81425f52>] device_unregister+0x22/0x60
      [ 4200.503282]  [<ffffffffa0300970>] fcoe_ctlr_device_delete+0xe0/0xf0 [libfcoe]
      [ 4200.503285]  [<ffffffffa02f1b5c>] fcoe_interface_cleanup+0x6c/0xa0 [fcoe]
      [ 4200.503287]  [<ffffffffa02f3355>] fcoe_destroy_work+0x105/0x120 [fcoe]
      [ 4200.503290]  [<ffffffff8107ee91>] process_one_work+0x1a1/0x580
      [ 4200.503292]  [<ffffffff8107ee2b>] ? process_one_work+0x13b/0x580
      [ 4200.503295]  [<ffffffffa02f3250>] ? fcoe_if_destroy+0x230/0x230 [fcoe]
      [ 4200.503297]  [<ffffffff81080c6e>] worker_thread+0x15e/0x440
      [ 4200.503299]  [<ffffffff81080b10>] ? busy_worker_rebind_fn+0x100/0x100
      [ 4200.503301]  [<ffffffff8108715a>] kthread+0xea/0xf0
      [ 4200.503304]  [<ffffffff81087070>] ? kthread_create_on_node+0x160/0x160
      [ 4200.503306]  [<ffffffff816d70ac>] ret_from_fork+0x7c/0xb0
      [ 4200.503308]  [<ffffffff81087070>] ? kthread_create_on_node+0x160/0x160
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Tested-by: NJack Morgan <jack.morgan@intel.com>
      f9c4358e
  11. 20 2月, 2013 1 次提交
  12. 12 2月, 2013 1 次提交
  13. 29 1月, 2013 2 次提交
    • N
      fcoe: Fix deadlock while deleting FCoE interface with NPIV ports · 94aa743a
      Neerav Parikh 提交于
      This patch fixes following deadlock caused by destroying of
      an FCoE interface with active NPIV ports on that interface.
      
          Call Trace:
          [<ffffffff814b7e88>] schedule+0x64/0x66
          [<ffffffff814b6b4f>] schedule_timeout+0x36/0xe3
          [<ffffffff81070c55>] ? update_curr+0xd6/0x110
          [<ffffffff81071f6b>] ? hrtick_update+0x1b/0x4d
          [<ffffffff81072405>] ? dequeue_task_fair+0x1ca/0x1d9
          [<ffffffff8106a369>] ? need_resched+0x1e/0x28
          [<ffffffff814b7d14>] wait_for_common+0x9b/0xf1
          [<ffffffff8106e7be>] ? try_to_wake_up+0x1e0/0x1e0
          [<ffffffff814b7e22>] wait_for_completion+0x1d/0x1f
          [<ffffffff8105ae82>] flush_workqueue+0x116/0x2a1
          [<ffffffff8105b357>] drain_workqueue+0x66/0x14c
          [<ffffffff8105b8ef>] destroy_workqueue+0x1a/0xcf
          [<ffffffffa009211e>] fc_remove_host+0x154/0x17f [scsi_transport_fc]
          [<ffffffffa00edbb8>] fcoe_if_destroy+0x184/0x1c9 [fcoe]
          [<ffffffffa00edc28>] fcoe_destroy_work+0x2b/0x44 [fcoe]
          [<ffffffff8105a82a>] process_one_work+0x1a8/0x2a4
          [<ffffffffa00edbfd>] ? fcoe_if_destroy+0x1c9/0x1c9 [fcoe]
          [<ffffffff8105c396>] worker_thread+0x1db/0x268
          [<ffffffff810604a3>] ? wake_up_bit+0x2a/0x2a
          [<ffffffff8105c1bb>] ? manage_workers.clone.16+0x1f6/0x1f6
          [<ffffffff8105ffd6>] kthread+0x6f/0x77
          [<ffffffff814c0304>] kernel_thread_helper+0x4/0x10
          [<ffffffff8105ff67>] ? kthread_freezable_should_stop+0x4b/0x4b
      
          Call Trace:
          [<ffffffff814b7e88>] schedule+0x64/0x66
          [<ffffffff814b8041>] schedule_preempt_disabled+0xe/0x10
          [<ffffffff814b70a1>] __mutex_lock_common.clone.5+0x117/0x17a
          [<ffffffff814b7117>] __mutex_lock_slowpath+0x13/0x15
          [<ffffffff814b6f76>] mutex_lock+0x23/0x37
          [<ffffffff8125b890>] ? list_del+0x11/0x30
          [<ffffffffa00edc84>] fcoe_vport_destroy+0x43/0x5f [fcoe]
          [<ffffffffa009130a>] fc_vport_terminate+0x48/0x110 [scsi_transport_fc]
          [<ffffffffa00913ef>] fc_vport_sched_delete+0x1d/0x79 [scsi_transport_fc]
          [<ffffffff8105a82a>] process_one_work+0x1a8/0x2a4
          [<ffffffffa00913d2>] ? fc_vport_terminate+0x110/0x110 [scsi_transport_fc]
          [<ffffffff8105c396>] worker_thread+0x1db/0x268
          [<ffffffff8105c1bb>] ? manage_workers.clone.16+0x1f6/0x1f6
          [<ffffffff8105ffd6>] kthread+0x6f/0x77
          [<ffffffff814c0304>] kernel_thread_helper+0x4/0x10
          [<ffffffff8105ff67>] ? kthread_freezable_should_stop+0x4b/0x4b
          [<ffffffff814c0300>] ? gs_change+0x13/0x13
      
      A prior attempt to fix this issue is posted here:
      http://lists.open-fcoe.org/pipermail/devel/2012-October/012318.html
      or
      http://article.gmane.org/gmane.linux.scsi.open-fcoe.devel/11924
      
      Based on feedback and discussion with Neil Horman it seems that the above patch
      may have a case where the fcoe_vport_destroy() and fcoe_destroy_work() can
      race; hence that patch has been withdrawn with this patch that is trying to
      solve the same problem in a different way.
      
      In the current approach instead of removing the fcoe_config_mutex from the
      vport_delete callback function; I've chosen to delete all the NPIV ports first
      on a given root lport before continuing with the removal of the root lport.
      Signed-off-by: NNeerav Parikh <Neerav.Parikh@intel.com>
      Tested-by: NMarcus Dennis <marcusx.e.dennis@intel.com>
      Acked-by: NNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      94aa743a
    • N
      fcoe: close race on link speed detection in fcoe code · f9184df3
      Neil Horman 提交于
      When creating an fcoe interfce, we call fcoe_link_speed_update before we add the
      lports fcoe interface to the fc_hostlist.  Since network device events like
      NETDEV_CHANGE are only processed if an fcoe interface is found with an
      underlying netdev that matches the netdev of the event.  Since this processing
      in fcoe_device_notification is how link_speed changes get communicated to the
      libfc  code (via fcoe_link_speed_update), we have a race condition - if a
      NETDEV_CHANGE event is sent after the call to fcoe_link_speed_update in
      fcoe_netdev_config, but before we add the interface to the fc_hostlist, we will
      loose the event and attributes like /sys/class/fc_host/hostX/speed will not get
      updated properly.
      
      Fix this by moving the add to the fc_hostlist above the serialized call to
      fcoe_netdev_config, ensuring that we catch netdev envents before we make a
      direct call to fcoe_link_speed_update.
      
      Also use this opportunity to clean up access to the fc_hostlist a bit by
      creating a fcoe_hostlist_del accessor and replacing the cleanup in fcoe_exit to
      use it properly.
      
      Tested by myself successfully
      
      [ Comment over 80 chars broken into multi-line by Robert Love to
        satisfy checkpatch.pl ]
      Signed-off-by: NNeil Horman <nhorman@tuxdriver.com>
      Reviewed-by: NYi Zou <yi.zou@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      f9184df3
  14. 18 12月, 2012 1 次提交
    • A
      random32: rename random32 to prandom · 496f2f93
      Akinobu Mita 提交于
      This renames all random32 functions to have 'prandom_' prefix as follows:
      
        void prandom_seed(u32 seed);	/* rename from srandom32() */
        u32 prandom_u32(void);		/* rename from random32() */
        void prandom_seed_state(struct rnd_state *state, u64 seed);
        				/* rename from prandom32_seed() */
        u32 prandom_u32_state(struct rnd_state *state);
        				/* rename from prandom32() */
      
      The purpose of this renaming is to prevent some kernel developers from
      assuming that prandom32() and random32() might imply that only
      prandom32() was the one using a pseudo-random number generator by
      prandom32's "p", and the result may be a very embarassing security
      exposure.  This concern was expressed by Theodore Ts'o.
      
      And furthermore, I'm going to introduce new functions for getting the
      requested number of pseudo-random bytes.  If I continue to use both
      prandom32 and random32 prefixes for these functions, the confusion
      is getting worse.
      
      As a result of this renaming, "prandom_" is the common prefix for
      pseudo-random number library.
      
      Currently, srandom32() and random32() are preserved because it is
      difficult to rename too many users at once.
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Robert Love <robert.w.love@intel.com>
      Cc: Michel Lespinasse <walken@google.com>
      Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu>
      Cc: David Laight <david.laight@aculab.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Artem Bityutskiy <dedekind1@gmail.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Eilon Greenstein <eilong@broadcom.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      496f2f93
  15. 15 12月, 2012 8 次提交
  16. 05 12月, 2012 1 次提交
    • R
      libfcoe: Save some memory and optimize name lookups · ef60f674
      Robert Love 提交于
      Instead of creating a structure with an enum and a pointer
      to a string, simply allocate an array of strings and use
      the enum values for the indicies.
      
      This means that we do not need to iterate through the list
      of entries when looking up a string name by its enum key.
      
      This will also help with a latter patch that will add
      more fcoe_sysfs attributes that will also use the
      fcoe_enum_name_search macro. One attribute will also do
      a reverse lookup which requires less code when the
      enum-to-string mappings are organized as this patch makes
      them to be.
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Acked-by: NNeil Horman <nhorman@tuxdriver.com>
      ef60f674
  17. 07 10月, 2012 1 次提交
  18. 20 7月, 2012 3 次提交
    • N
      [SCSI] fcoe: Cleanup locking on fcoe_percpu_receive_thread · 95fdd5e9
      Neil Horman 提交于
      Noticed that we can shuffle the code around in fcoe_percpu_receive_thread a bit
      and avoid taking the fcoe_rx_list lock twice per iteration.  This should improve
      throughput somewhat.  With this change we take the lock, and check for new
      frames in a single critical section.  Only if the list is empty do we drop the
      lock and re-acquire it after being signaled to wake up.
      
      Change Notes:
      v2) did some further cleanup on the patch by replacing the 2nd call of
      spin_lock/splice_init with a goto to the top of the outer loop.  This allows me
      to change the inner while loop to an if conditional and remove the sencond check
      of kthread_should_stop.  Based on suggestion from Vasu Dev.
      Signed-off-by: NNeil Horman <nhorman@tuxdriver.com>
      Acked-by: NVasu Dev <vasu.dev@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      95fdd5e9
    • R
      [SCSI] fcoe: Remove redundant 'less than zero' check · 902a45af
      Robert Love 提交于
      strtoul returns an 'unsigned long' so there is no
      reason to check if the value is less than zero.
      
      strtoul already checks for the '-' character deep
      in its bowels. It will return an error if the user
      has provided a negative value and fcoe_str_to_dev_loss
      will return that error to its caller.
      
      This patch fixes the following Coverity reported warning:
      
      CID 703581 -  NO_EFFECT Unsigned compared against 0 - This
      less-than-zero comparison of an unsigned value is never true. "*val < 0UL".
      drivers/scsi/fcoe/fcoe_sysfs.c:105
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      902a45af
    • M
      [SCSI] libfcoe: Fix section mismatch · 87098bdd
      Mark Rustad 提交于
      Recent changes to add fcoe_sysfs caused libfcoe_init to call fcoe_transport_exit
      in a module initialization routine. The change resulted in the below error. This
      patch removes the __exit keyword from the fcoe_transport_exit definition such
      that it may be called from an __init routine.
      
      WARNING: drivers/scsi/fcoe/libfcoe.o(.init.text+0x21): Section mismatch in reference from the function init_module() to the function .exit.text:fcoe_transp
      exit()
      The function __init init_module() references
      a function __exit fcoe_transport_exit().
      This is often seen when error handling in the init function
      uses functionality in the exit path.
      The fix is often to remove the __exit annotation of
      fcoe_transport_exit() so it may be used outside an exit section.
      Signed-off-by: NMark Rustad <mark.d.rustad@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      87098bdd