1. 30 6月, 2011 3 次提交
  2. 25 5月, 2011 1 次提交
  3. 01 5月, 2011 3 次提交
  4. 30 4月, 2011 1 次提交
    • D
      ethtool: Call ethtool's get/set_settings callbacks with cleaned data · 8ae6daca
      David Decotigny 提交于
      This makes sure that when a driver calls the ethtool's
      get/set_settings() callback of another driver, the data passed to it
      is clean. This guarantees that speed_hi will be zeroed correctly if
      the called callback doesn't explicitely set it: we are sure we don't
      get a corrupted speed from the underlying driver. We also take care of
      setting the cmd field appropriately (ETHTOOL_GSET/SSET).
      
      This applies to dev_ethtool_get_settings(), which now makes sure it
      sets up that ethtool command parameter correctly before passing it to
      drivers. This also means that whoever calls dev_ethtool_get_settings()
      does not have to clean the ethtool command parameter. This function
      also becomes an exported symbol instead of an inline.
      
      All drivers visible to make allyesconfig under x86_64 have been
      updated.
      Signed-off-by: NDavid Decotigny <decot@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8ae6daca
  5. 15 3月, 2011 1 次提交
  6. 01 3月, 2011 3 次提交
  7. 13 2月, 2011 6 次提交
    • B
      [SCSI] libfcoe: Move common code from fcoe to libfcoe module · 8597ae8b
      Bhanu Prakash Gollapudi 提交于
      To facilitate LLDDs to reuse the code, skb queue related functions are moved to
      libfcoe, so that both fcoe and bnx2fc drivers can use them. The common structures
      fcoe_port, fcoe_percpu_s are moved to libfcoe. fcoe_port will now have an
      opaque pointer that points to corresponding driver's interface structure.
      Also, fcoe_start_io and fcoe_fc_crc are moved to libfcoe.
      
      As part of this change, fixed fcoe_start_io to return ENOMEM if
      skb_clone fails.
      Signed-off-by: NBhanu Prakash Gollapudi <bprakash@broadcom.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      8597ae8b
    • T
      [SCSI] fcoe: use dedicated workqueue instead of system_wq · 2ca32b48
      Tejun Heo 提交于
      fcoe uses the system_wq to destroy ports and the work items need to be
      flushed before the driver is unloaded.  As the work items free the
      containing data structure, they can't be flushed directly.  The
      workqueue should be flushed instead.
      
      Also, the destruction works can be chained - ie. destruction of a port
      may lead to destruction of another port where the work item for the
      former queues the work for the latter.  Currently, the depth of chain
      can be at most two and fcoe_exit() makes sure everything is complete
      by calling flush_scheduled_work() twice.
      
      With commit c8efcc25 (workqueue: allow chained queueing during
      destruction), destroy_workqueue() can take care of chained works on
      workqueue destruction.  Add and use fcoe_wq instead.  Simply
      destroying fcoe_wq on driver unload takes care of flushing.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      2ca32b48
    • Y
      [SCSI] fcoe: convert fcoe.ko to become an fcoe transport provider driver · 78a58246
      Yi Zou 提交于
      Remove the existing sysfs entry points of the fcoe.ko module parameters that
      are used to create/destroy/enable/disable an FCoE instance, rather, use the
      newly added fcoe transport code to attach itself as an FCoE transport provider
      when fcoe.ko gets loaded. There is no functionality change on the logic of
      fcoe interacts with upper libfc and lower netdev. The fcoe transport only acts
      as thin layer to provide a unified interface for all fcoe transport providers
      so all FCoE instances on any network interfaces from all vendors can be
      managed through the same Open-FCoE.org's user space tool package, which also
      has full DCB support.
      Signed-off-by: NYi Zou <yi.zou@intel.com>
      Signed-off-by: NBhanu Prakash Gollapudi <bprakash@broadcom.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      78a58246
    • Y
      [SCSI] fcoe: prepare fcoe for using fcoe transport · 8ca86f84
      Yi Zou 提交于
      Prepare the fcoe to convert it to use the newly added fcoe transport, making
      it as the default fcoe transport provider for libfcoe. This patch is to rename
      some of the variables to avoid any confusing names later as now there are
      several transports in the same file.
      Signed-off-by: NYi Zou <yi.zou@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      8ca86f84
    • V
      [SCSI] fcoe: drop FCoE LOGO in FIP mode · 52ee8321
      Vasu Dev 提交于
      Allowing FCoE LOGO followed by CVL in this case prevents
      FIP login back to the FCF and then keeps lport offline,
      only FIP LOGO and CLV needs to be processed while in
      FIP mode, therefore this patch drops FCoE LOGO in FIP mode.
      
      Added fcoe_filter_frames() to filter out above mentioned LOGO
      in fcoe rx path along with other existing filtering in code
      for bad CRC frames. Adding separate fcoe_filter_frames function
      helped with better code indentations and if needed then same
      will allow adding more filters at one place in future.
      
      This LOGO drop is added after FCP frames passed up to avoid
      any additional checks on fast path for this.
      Signed-off-by: NVasu Dev <vasu.dev@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      52ee8321
    • R
      [SCSI] fcoe: Fix module reference count for vports · 7287fb91
      Robert Love 提交于
      vports are not grabbing module references but are
      releasing them. This causes the module reference count
      to decrement too many times and it wraps around past 0.
      
      The solution is to do a module_put() in
      fcoe_interface_release() so that the reference is only
      released when the fcoe_interface is released. There is a
      one-to-one relationship between the N_Port and the
      fcoe_interface, so the module reference will only be
      dropped when the N_Port is destroyed
      
      To create symetry in the code this patch moves the
      try_module_get() call into fcoe_interface_create(). This
      means that only the N_Port will grab a reference to the
      module when its corresponding fcoe_interface is created.
      
      This patch also makes it so that the fcoe_interface_create()
      routine encodes any error codes in the fcoe_interface
      pointer returned. This way its caller, fcoe_create(), can
      return an accurate error code.
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Tested-by: NRoss Brattain <ross.b.brattain@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      7287fb91
  8. 22 12月, 2010 1 次提交
    • Y
      [SCSI] libfc: fix NULL pointer dereference bug in fc_fcp_pkt_release · 80e736f8
      Yi Zou 提交于
      This happens when then tearing down the fcoe interface with active I/O.
      The back trace shows dead000000200200 in RAX, i.e., LIST_POISON2, indicating
      that the fsp is already being dequeued, which is probably why no complaining
      was seen in fc_fcp_destroy() about outstanding fsp not freed, since we dequeue
      it in the end of fc_io_compl() before releasing it. The bug is due to the
      fact that we have already destroyed lport's scsi_pkt_pool while on-going i/o
      is still accessing it through fc_fcp_pkt_release(), like this trace or the
      similar code path from scsi-ml to fc_eh_abort, etc. This is fixed by moving
      the fc_fcp_destroy() after lport is detached from scsi-ml since fc_fcp_destroy
      is supposed to called only once where no lport lock is taken, otherwise the
      fc_fcp_pkt_release() would have to grab the lport lock.
      
       BUG: unable to handle kernel NULL pointer dereference at (null)
       .......
       RIP: 0010:[<0000000000000000>]
       [<(null)>] (null)
       RSP: 0018:ffff8803270f7b88  EFLAGS: 00010282
       RAX: dead000000200200 RBX: ffff880197d2fbc0 RCX: 0000000000005908
       RDX: ffff880195ea6d08 RSI: 0000000000000282 RDI: ffff880180f4fec0
       RBP: ffff8803270f7bc0 R08: ffff880197d2fbe0 R09: 0000000000000000
       R10: ffff88032867f090 R11: 0000000000000000 R12: ffff880195ea6d08
       R13: 0000000000000282 R14: ffff880180f4fec0 R15: 0000000000000000
       FS:  0000000000000000(0000) GS:ffff8801b5820000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
       CR2: 0000000000000000 CR3: 00000001a6eae000 CR4: 00000000000006e0
       DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
       DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
       Process fc_rport_eq (pid: 5278, threadinfo ffff8803270f6000, task ffff880326254ab0)
       Stack:
       ffffffffa02c39ca ffff8803270f7ba0 ffff88019331cbc0 ffff880197d2fbc0
       0000000000000000 ffff8801a8c895e0 ffff8801a8c895e0 ffff8803270f7c10
       ffffffffa02c4962 ffff8803270f7be0 ffffffff814c94ab ffff8803270f7c10
       Call Trace:
       [<ffffffffa02c39ca>] ? fc_io_compl+0x10a/0x530 [libfc]
       [<ffffffffa02c4962>] fc_fcp_complete_locked+0x72/0x150 [libfc]
       [<ffffffff814c94ab>] ? _spin_unlock_bh+0x1b/0x20
       [<ffffffffa02b98ff>] ? fc_exch_done+0x3f/0x60 [libfc]
       [<ffffffffa02c4a8f>] fc_fcp_retry_cmd+0x4f/0x60 [libfc]
       [<ffffffffa02c6150>] fc_fcp_recv+0x9b0/0xc30 [libfc]
       [<ffffffff8106ba7a>] ? _call_console_drivers+0x4a/0x80
       [<ffffffff8107d5ec>] ? lock_timer_base+0x3c/0x70
       [<ffffffff8107e06b>] ? try_to_del_timer_sync+0x7b/0xe0
       [<ffffffffa02b9dcf>] fc_exch_mgr_reset+0x1df/0x250 [libfc]
       [<ffffffffa02c57a0>] ? fc_fcp_recv+0x0/0xc30 [libfc]
       [<ffffffffa02c1042>] fc_rport_work+0xf2/0x4e0 [libfc]
       [<ffffffff8109203e>] ? prepare_to_wait+0x4e/0x80
       [<ffffffffa02c0f50>] ? fc_rport_work+0x0/0x4e0 [libfc]
       [<ffffffff8108c6c0>] worker_thread+0x170/0x2a0
       [<ffffffff81091d50>] ? autoremove_wake_function+0x0/0x40
       [<ffffffff8108c550>] ? worker_thread+0x0/0x2a0
       [<ffffffff810919e6>] kthread+0x96/0xa0
       [<ffffffff810141ca>] child_rip+0xa/0x20
       [<ffffffff81091950>] ? kthread+0x0/0xa0
       [<ffffffff810141c0>] ? child_rip+0x0/0x20
       Code:
       Bad RIP value.
      
       RIP
       [<(null)>] (null)
       RSP <ffff8803270f7b88>
       CR2: 0000000000000000
      Signed-off-by: NYi Zou <yi.zou@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      80e736f8
  9. 26 10月, 2010 2 次提交
    • R
      [SCSI] fcoe: Fix broken NPIV with correction to MAC validation · 0ee31cb5
      Robert Love 提交于
      A previous patch attempted to validate the destination
      MAC address of a FCoE frame by checking that MAC
      address against the received port's MAC address. The
      implementation seems fine on the surface, but any
      VN_Ports added using the NPIV feature will have their
      own MAC addresses and these MACs were not being checked,
      which prevented any NPIV VN_Ports from receiving frames.
      
      In other words, the following patch has broken NPIV.
      
      519e5135
       [SCSI] fcoe: adds src and dest mac address
                    checking for fcoe frames
      
      Part of the offending patch is correct, but the part
      that broke NPIV was attempting to satisfy FC-BB-5
      section D.5, 2.1-
      
      (discard frames that) "contain a destination MAC
      address/destination N_Port_ID pair that was not
      assigned by an FCF to one of the VN_Ports on the ENode"
      
      The language does _not_ say to compare the destination
      FC-MAP/destination N_Port_ID, but instead to compare
      the destination MAC address/destination N_Port_ID.
      
      >From the FC-BB-5 specification,
      
      "A properly formed FPMA is one in which the 24 most
      significant bits equal the Fabric’s FC-MAP value and
      the least significant 24 bits equal the N_Port_ID
      assigned to the VN_Port by the FCF."
      
      This means that we need to compare the FC Frame's
      destination FCID against the embedded FCID in the
      destination MAC address. This patch checks the lower
      24 bits of the destination MAC address against
      destination FCID in the Fibre Channel frame.
      
      For MAC validation the first line of defense is the
      hardware MAC filtering. Each VN_Port will have a
      unicast MAC addresses added to the hardware's
      filtering table. The Ethernet driver should drop any
      MACs not destined for a programmed MAC. This patch
      adds a second line of defense that very specfically
      compares an element in the FC frame against an element
      in the Ethernet header, which is appropriate for the
      FCoE layer.
      
      Many alternative approaches were considered, including
      a LLD callback from libfc. The second most reasonable
      approach seemed to be walking the list of NPIV ports
      and check each of their MAC addresses against the
      destination MAC address of the received frame. The
      problem with this approach was that it is likely that
      performance would suffer with the more NPIV ports added
      to the system since every received frame would need to
      walk this list, comparing each entry's MAC.
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      0ee31cb5
    • V
      [SCSI] fcoe: set default FIP mode as FIP_MODE_FABRIC · 3067817a
      Vasu Dev 提交于
      Since sometimes current FIP_MODE_AUTO mode falls back to non-FIP
      mode while DCB link still getting ready in fabric mode with
      its peer switch, it falls back after few libfc flogi retries
      and that is not we want while working with FIP enabled
      switches in FABRIC mode, therefore sets default as FIP_MODE_FABRIC
      as discussed and agreed before in this mail thread
      http://www.open-fcoe.org/pipermail/devel/2010-August/010511.htmlSigned-off-by: NVasu Dev <vasu.dev@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      3067817a
  10. 28 7月, 2010 8 次提交
    • V
      [SCSI] Revert "[SCSI] fcoe: Fix using VLAN ID in creating lport's WWWN/WWPN" · cf4aebca
      Vasu Dev 提交于
      This reverts commit cc0136c2.
      
      That commit introduced vlan id info to WWPN but WWPN needs to
      remain static as an unique port identifier in the fabric, therefore
      variable fabric vlan id info doesn't need to be coded inside WWPN.
      
      After this revert, port arg to fcoe_wwn_from_mac is always zero
      but still leaving it as-is okay to later allow users to use NAA 2
      scheme with this additional port arg.
      
      Note with this patch, existing zoning using WWPN would require
      re-zoning this time only and later no more re-zoning due to any
      vlan id changes.
      Signed-off-by: NVasu Dev <vasu.dev@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      cf4aebca
    • Y
      [SCSI] fcoe: fix offload feature flag change from netdev · 54a5b21d
      Yi Zou 提交于
      Currently, when FCoE netdev feature flags are toggled by the LLD, lport's
      corresponding flags are not updated. This causes the fc_fcp to still try to
      offload the I/O. This patch adds support of NETDEV_FEAT_CHANGE event in fcoe
      netdev device notification callback so we can update the lport offload flags
      appropriately.
      Signed-off-by: NYi Zou <yi.zou@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      54a5b21d
    • J
      [SCSI] fcoe: config via separate create_vn2vn module parameter · 1dd454d9
      Joe Eykholt 提交于
      Add module parameter create_vn2vn that behaves like the create
      parameter except that the new instance is created in FIP vn2vn mode.
      
      This can be replaced once we change create to allow modifying
      per-instance attributes before starting the instance.
      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>
      1dd454d9
    • J
      [SCSI] fcoe libfcoe: use correct FC-MAP for VN2VN mode · cd229e42
      Joe Eykholt 提交于
      In VN2VN mode, map_dest means to use the default VN2VN OUI.
      Change code that uses the default FCoE OUI to use the one
      set in the fcoe_ctlr struct.
      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>
      cd229e42
    • J
      [SCSI] libfcoe: fcoe: fnic: add FIP VN2VN point-to-multipoint support · e10f8c66
      Joe Eykholt 提交于
      The FC-BB-6 committee is proposing a new FIP usage model called
      VN_port to VN_port mode.  It allows VN_ports to discover each other
      over a loss-free L2 Ethernet without any FCF or Fibre-channel fabric
      services.  This is point-to-multipoint.  There is also a variant
      of this called point-to-point which provides for making sure there
      is just one pair of ports operating over the Ethernet fabric.
      
      We add these new states:  VNMP_START, _PROBE1, _PROBE2, _CLAIM, and _UP.
      These usually go quickly in that sequence.  After waiting a random
      amount of time up to 100 ms in START, we select a pseudo-random
      proposed locally-unique port ID and send out probes in states PROBE1
      and PROBE2, 100 ms apart.  If no probe responses are heard, we
      proceed to CLAIM state 400 ms later and send a claim notification.
      We wait another 400 ms to receive claim responses, which give us
      a list of the other nodes on the network, including their FC-4
      capabilities.  After another 400 ms we go to VNMP_UP state and
      should start interoperating with any of the nodes for whic we
      receivec claim responses.  More details are in the spec.j
      
      Add the new mode as FIP_MODE_VN2VN.  The driver must specify
      explicitly that it wants to operate in this mode.  There is
      no automatic detection between point-to-multipoint and fabric
      mode, and the local port initialization is affected, so it isn't
      anticipated that there will ever be any such automatic switchover.
      
      It may eventually be possible to have both fabric and VN2VN
      modes on the same L2 network, which may be done by two separate
      local VN_ports (lports).
      
      When in VN2VN mode, FIP replaces libfc's fabric-oriented discovery
      module with its own simple code that adds remote ports as they
      are discovered from incoming claim notifications and responses.
      These hooks are placed by fcoe_disc_init().
      
      A linear list of discovered vn_ports is maintained under the
      fcoe_ctlr struct.  It is expected to be short for now, and
      accessed infrequently.  It is kept under RCU for lock-ordering
      reasons.  The lport and/or rport mutexes may be held when we
      need to lookup a fcoe_vnport during an ELS send.
      
      Change fcoe_ctlr_encaps() to lookup the destination vn_port in
      the list of peers for the destination MAC address of the
      FIP-encapsulated frame.
      
      Add a new function fcoe_disc_init() to initialize just the
      discovery portion of libfcoe for VN2VN mode.
      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>
      e10f8c66
    • J
      [SCSI] libfcoe: fcoe: fnic: change fcoe_ctlr_init interface to specify mode · 3d902ac0
      Joe Eykholt 提交于
      There are three modes that libfcoe currently supports, and a new one
      is coming.  Change the fcoe_ctlr_init() interface to add the mode
      desired.  This should not change any functionality.
      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>
      3d902ac0
    • V
      [SCSI] fcoe: adds src and dest mac address checking for fcoe frames · 519e5135
      Vasu Dev 提交于
      This is  per FC-BB-5 Annex-D recommendation and per that
      if address checking fails then drop the frame.
      
      FIP code paths are already doing this so only needed for fcoe
      frames.
      
      The src address checking is limited to only fip mode since
      this might break non-fip mode used in p2p due to used OUI
      based addressing in some p2p code paths, going forward FIP
      will be the only mode, therefore limited this to only FIP
      mode so that it won't break non-fip p2p mode for now.
      
      -v2
      Removes FCOE packet type checking since fcoe_rcv is
      registered to receive only FCoE type packets from netdev
      and it is already checked by netdev.
      Signed-off-by: NVasu Dev <vasu.dev@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      519e5135
    • V
      [SCSI] fcoe: cleans up fcoe_disable and fcoe_enable · 9d4cbc05
      Vasu Dev 提交于
      The fc_fabric_logoff and fc_fabric_login are redundant
      here after recently added fcoe_ctlr_link_down/up to
      these functions, therefore this patch removes logoff
      and login to only use link down and up here. This works
      best for their current usages with fcoe DCB link down or up.
      
      This also works well to avoid EIO errors when fcoe DCB link
      goes down as lport state moves out of ready quickly from
      fcoe_ctlr_link_down and that allows re-queuing timed out IOs
      for this case also.
      Signed-off-by: NVasu Dev <vasu.dev@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      9d4cbc05
  11. 08 7月, 2010 1 次提交
    • E
      net: fix 64 bit counters on 32 bit arches · 28172739
      Eric Dumazet 提交于
      There is a small possibility that a reader gets incorrect values on 32
      bit arches. SNMP applications could catch incorrect counters when a
      32bit high part is changed by another stats consumer/provider.
      
      One way to solve this is to add a rtnl_link_stats64 param to all
      ndo_get_stats64() methods, and also add such a parameter to
      dev_get_stats().
      
      Rule is that we are not allowed to use dev->stats64 as a temporary
      storage for 64bit stats, but a caller provided area (usually on stack)
      
      Old drivers (only providing get_stats() method) need no changes.
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      28172739
  12. 17 6月, 2010 1 次提交
  13. 25 5月, 2010 1 次提交
  14. 17 5月, 2010 4 次提交
    • V
      [SCSI] fcoe: fix fcoe module ref counting · 15af974d
      Vasu Dev 提交于
      Currently fcoe module ref count is used for tracking
      active fcoe instances, it means each fcoe instance create
      increments the count while destroy dec the count.
      
      The dec is done only if fcoe instance is destroyed from
      /sysfs but not if destroyed due to NETDEV_UNREGISTER event.
      So this patch moves only module_put doing dec to common
      fcoe_if_destroy function, so that dec would occur on ever
      fcoe instance destroy.
      Signed-off-by: NVasu Dev <vasu.dev@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      15af974d
    • V
      [SCSI] fcoe: fix a circular locking issue with rtnl and sysfs mutex · 34ce27bc
      Vasu Dev 提交于
      Currently rtnl mutex is grabbed during fcoe create, destroy, enable
      and disable operations while sysfs s_active read mutex is already
      held, but simultaneously other networking events could try grabbing
      write s_active mutex while rtnl is already held and that is causing
      circular lock warning, its detailed log pasted at end.
      
      In this log, the rtnl was held before write s_active during device
      renaming but there are more such cases as Joe reported another
      instance with tg3 open at:-
      http://www.open-fcoe.org/pipermail/devel/2010-February/008263.html
      
      This patch fixes this issue by not waiting for rtnl mutex during
      fcoe ops, that means if rtnl mutex is not immediately available
      then restart_syscall() to allow others waiting in line to
      grab s_active along with rtnl mutex to finish their work first
      under these mutex.
      
      Currently rtnl mutex was grabbed twice during fcoe_destroy call flow,
      second grab was from fcoe_if_destroy called from fcoe_destroy after
      dropping rtnl mutex before calling fcoe_if_destroy, so instead made
      fcoe_if_destroy always called with rtnl mutex held to have this mutex
      grabbed only once in this code path.
      
      However left matching rtnl_unlock as-is in its original place as it was
      dropped there for good reason since very next call causes synchronous
      fip worker flush and if rtnl mutex is still held before flush
      then that would cause new circular warning between fip->recv_work and
      rtnl mutex, I've added detailed comment for this on fcoe_if_destroy
      calling and rtnl muxtes unlocking.
      
      =======================================================
      [ INFO: possible circular locking dependency detected ]
      2.6.33.1linux-stable-2.6.33 #1
      -------------------------------------------------------
      fcoemon/18823 is trying to acquire lock:
      (fcoe_config_mutex){+.+.+.}, at: [<ffffffffa02ba5fc>] fcoe_create+0x27/0x4f7
      [fcoe]
      
      but task is already holding lock:
      (s_active){++++.+}, at: [<ffffffff8115ef93>] sysfs_get_active_two+0x31/0x48
      
      which lock already depends on the new lock.
      
      the existing dependency chain (in reverse order) is:
      
      -> #2 (s_active){++++.+}:
         [<ffffffff81077bdb>] __lock_acquire+0xb73/0xd2b
         [<ffffffff81077e60>] lock_acquire+0xcd/0xf1
         [<ffffffff8115e5df>] sysfs_deactivate+0x8b/0xe0
         [<ffffffff8115edfb>] sysfs_addrm_finish+0x36/0x55
         [<ffffffff8115d0cc>] sysfs_hash_and_remove+0x53/0x6a
         [<ffffffff8115f353>] sysfs_remove_link+0x21/0x23
         [<ffffffff812b6c93>] device_rename+0x99/0xcb
         [<ffffffff8138dbf0>] dev_change_name+0xd5/0x1d2
         [<ffffffff8138deee>] dev_ifsioc+0x201/0x2ac
         [<ffffffff8138e4ba>] dev_ioctl+0x521/0x632
         [<ffffffff81379e43>] sock_do_ioctl+0x3d/0x47
         [<ffffffff8137a254>] sock_ioctl+0x213/0x222
         [<ffffffff81114614>] vfs_ioctl+0x32/0xa6
         [<ffffffff81114b94>] do_vfs_ioctl+0x490/0x4d6
         [<ffffffff81114c30>] sys_ioctl+0x56/0x79
         [<ffffffff81009b42>] system_call_fastpath+0x16/0x1b
      
      -> #1 (rtnl_mutex){+.+.+.}:
         [<ffffffff81077bdb>] __lock_acquire+0xb73/0xd2b
         [<ffffffff81077e60>] lock_acquire+0xcd/0xf1
         [<ffffffff8142f343>] __mutex_lock_common+0x4b/0x383
         [<ffffffff8142f73f>] mutex_lock_nested+0x3e/0x43
         [<ffffffff813959f9>] rtnl_lock+0x17/0x19
         [<ffffffff8138ccae>] register_netdevice_notifier+0x1e/0x19b
         [<ffffffffa02580c1>] 0xffffffffa02580c1
         [<ffffffff81002069>] do_one_initcall+0x5e/0x15e
         [<ffffffff81084094>] sys_init_module+0xd8/0x23a
         [<ffffffff81009b42>] system_call_fastpath+0x16/0x1b
      
      -> #0 (fcoe_config_mutex){+.+.+.}:
         [<ffffffff81077a85>] __lock_acquire+0xa1d/0xd2b
         [<ffffffff81077e60>] lock_acquire+0xcd/0xf1
         [<ffffffff8142f343>] __mutex_lock_common+0x4b/0x383
         [<ffffffff8142f73f>] mutex_lock_nested+0x3e/0x43
         [<ffffffffa02ba5fc>] fcoe_create+0x27/0x4f7 [fcoe]
         [<ffffffff810635b1>] param_attr_store+0x27/0x35
         [<ffffffff81063619>] module_attr_store+0x26/0x2a
         [<ffffffff8115dae3>] sysfs_write_file+0x108/0x144
         [<ffffffff81107bd1>] vfs_write+0xae/0x10b
         [<ffffffff81107cee>] sys_write+0x4a/0x6e
         [<ffffffff81009b42>] system_call_fastpath+0x16/0x1b
      
      other info that might help us debug this:
      
      3 locks held by fcoemon/18823:
      #0:  (&buffer->mutex){+.+.+.}, at: [<ffffffff8115da17>]
      sysfs_write_file+0x3c/0x144
      #1:  (s_active){++++.+}, at: [<ffffffff8115ef86>]
      sysfs_get_active_two+0x24/0x48
      #2:  (s_active){++++.+}, at: [<ffffffff8115ef93>]
      sysfs_get_active_two+0x31/0x48
      
      stack backtrace:
      Pid: 18823, comm: fcoemon Tainted: G        W  2.6.33.1linux-stable-2.6.33 #1
      Call Trace:
      [<ffffffff81076c38>] print_circular_bug+0xa8/0xb6
      [<ffffffff81077a85>] __lock_acquire+0xa1d/0xd2b
      [<ffffffffa02ba5fc>] ? fcoe_create+0x27/0x4f7 [fcoe]
      [<ffffffff81077e60>] lock_acquire+0xcd/0xf1
      [<ffffffffa02ba5fc>] ? fcoe_create+0x27/0x4f7 [fcoe]
      [<ffffffffa02ba5fc>] ? fcoe_create+0x27/0x4f7 [fcoe]
      [<ffffffff8142f343>] __mutex_lock_common+0x4b/0x383
      [<ffffffffa02ba5fc>] ? fcoe_create+0x27/0x4f7 [fcoe]
      [<ffffffff8106ac70>] ? cpu_clock+0x43/0x5e
      [<ffffffff81074e12>] ? lockstat_clock+0x11/0x13
      [<ffffffff81074e40>] ? lock_release_holdtime+0x2c/0x127
      [<ffffffff8115ef93>] ? sysfs_get_active_two+0x31/0x48
      [<ffffffff8142f73f>] mutex_lock_nested+0x3e/0x43
      [<ffffffffa02ba5fc>] fcoe_create+0x27/0x4f7 [fcoe]
      [<ffffffff810635b1>] param_attr_store+0x27/0x35
      [<ffffffff81063619>] module_attr_store+0x26/0x2a
      [<ffffffff8115dae3>] sysfs_write_file+0x108/0x144
      [<ffffffff81107bd1>] vfs_write+0xae/0x10b
      [<ffffffff81076596>] ? trace_hardirqs_on_caller+0x125/0x150
      [<ffffffff81107cee>] sys_write+0x4a/0x6e
      [<ffffffff81009b42>] system_call_fastpath+0x16/0x1b
      Signed-off-by: NVasu Dev <vasu.dev@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      34ce27bc
    • R
      [SCSI] fcoe: move link speed checking into its own routine · 5e4f8fe7
      Robert Love 提交于
      It doesn't make sense to update the link speed in the is_link_ok()
      routine. Move it to it's own routine and acquire the device speed
      when we're configuring the device initially as well as if there are
      any netdev events received.
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      5e4f8fe7
    • V
      [SCSI] fcoe: fixes wrong error exit in fcoe_create · 721cafaf
      Vasu Dev 提交于
      fcoe_create exits using out_nodev label when module is not
      yet LIVE but this exit path unlocks the rtnl_lock though
      rtnl lock was not held in this case.
      
      So this patch replaces out_nodev with out_nomod to exit
      w/o unlocking rtnl_lock.
      Signed-off-by: NVasu Dev <vasu.dev@intel.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      721cafaf
  15. 12 4月, 2010 4 次提交