1. 21 7月, 2016 1 次提交
  2. 14 7月, 2016 5 次提交
  3. 13 7月, 2016 2 次提交
    • S
      fcoe: convert to kworker · 4b9bc86d
      Sebastian Andrzej Siewior 提交于
      The driver creates its own per-CPU threads which are updated based on
      CPU hotplug events. It is also possible to use kworkers and remove some
      of the kthread infrastrucure.
      
      The code checked ->thread to decide if there is an active per-CPU
      thread. By using the kworker infrastructure this is no longer
      possible (or required). The thread pointer is saved in `kthread' instead
      of `thread' so anything trying to use thread is caught by the
      compiler. Currently only the bnx2fc driver is using struct fcoe_percpu_s
      and the kthread member.
      
      After a CPU went offline, we may still enqueue items on the "offline"
      CPU. This isn't much of a problem. The work will be done on a random
      CPU. The allocated crc_eof_page page won't be cleaned up. It is probably
      expected that the CPU comes up at some point so it should not be a
      problem. The crc_eof_page memory is released of course once the module
      is removed.
      
      This patch was only compile-tested due to -ENODEV.
      
      Cc: Vasu Dev <vasu.dev@intel.com>
      Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: fcoe-devel@open-fcoe.org
      Cc: linux-scsi@vger.kernel.org
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Tested-by: NJohannes Thumshirn <jthumshirn@suse.de>
      Reviewed-by: NJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      4b9bc86d
    • H
      libfc: Update rport reference counting · baa6719f
      Hannes Reinecke 提交于
      Originally libfc would just be initializing the refcount to '1', and
      using the disc_mutex to synchronize if and when the final put should be
      happening.  This has a race condition as the mutex might be delayed,
      causing other threads to access an invalid structure.  This patch
      updates the rport reference counting to increase the reference every
      time 'rport_lookup' is called, and decreases the reference
      correspondingly.  This removes the need to hold 'disc_mutex' when
      removing the structure, and avoids the above race condition.
      Signed-off-by: NHannes Reinecke <hare@suse.com>
      Acked-by: NVasu Dev <vasu.dev@intel.com>
      Reviewed-by: NJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      baa6719f
  4. 01 3月, 2016 1 次提交
  5. 26 2月, 2016 1 次提交
  6. 16 12月, 2015 1 次提交
  7. 10 11月, 2015 2 次提交
  8. 07 9月, 2015 1 次提交
  9. 07 8月, 2015 1 次提交
  10. 04 12月, 2014 1 次提交
  11. 24 11月, 2014 2 次提交
  12. 22 11月, 2014 1 次提交
  13. 12 11月, 2014 2 次提交
  14. 30 9月, 2014 1 次提交
  15. 19 9月, 2014 1 次提交
    • K
      sched, cleanup, treewide: Remove set_current_state(TASK_RUNNING) after schedule() · f139caf2
      Kirill Tkhai 提交于
      schedule(), io_schedule() and schedule_timeout() always return
      with TASK_RUNNING state set, so one more setting is unnecessary.
      
      (All places in patch are visible good, only exception is
       kiblnd_scheduler() from:
      
            drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
      
       Its schedule() is one line above standard 3 lines of unified diff)
      
      No places where set_current_state() is used for mb().
      Signed-off-by: NKirill Tkhai <ktkhai@parallels.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1410529254.3569.23.camel@tkhai
      Cc: Alasdair Kergon <agk@redhat.com>
      Cc: Anil Belur <askb23@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Dave Kleikamp <shaggy@kernel.org>
      Cc: David Airlie <airlied@linux.ie>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Dmitry Eremin <dmitry.eremin@intel.com>
      Cc: Frank Blaschka <blaschka@linux.vnet.ibm.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Isaac Huang <he.huang@intel.com>
      Cc: James E.J. Bottomley <JBottomley@parallels.com>
      Cc: James E.J. Bottomley <jejb@parisc-linux.org>
      Cc: J. Bruce Fields <bfields@fieldses.org>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: Laura Abbott <lauraa@codeaurora.org>
      Cc: Liang Zhen <liang.zhen@intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Masaru Nomura <massa.nomura@gmail.com>
      Cc: Michael Opdenacker <michael.opdenacker@free-electrons.com>
      Cc: Mikael Starvik <starvik@axis.com>
      Cc: Mike Snitzer <snitzer@redhat.com>
      Cc: Neil Brown <neilb@suse.de>
      Cc: Oleg Drokin <green@linuxhacker.ru>
      Cc: Peng Tao <bergwolf@gmail.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Robert Love <robert.w.love@intel.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Trond Myklebust <trond.myklebust@primarydata.com>
      Cc: Ursula Braun <ursula.braun@de.ibm.com>
      Cc: Zi Shen Lim <zlim.lnx@gmail.com>
      Cc: devel@driverdev.osuosl.org
      Cc: dm-devel@redhat.com
      Cc: dri-devel@lists.freedesktop.org
      Cc: fcoe-devel@open-fcoe.org
      Cc: jfs-discussion@lists.sourceforge.net
      Cc: linux390@de.ibm.com
      Cc: linux-afs@lists.infradead.org
      Cc: linux-cris-kernel@axis.com
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-nfs@vger.kernel.org
      Cc: linux-parisc@vger.kernel.org
      Cc: linux-raid@vger.kernel.org
      Cc: linux-s390@vger.kernel.org
      Cc: linux-scsi@vger.kernel.org
      Cc: qla2xxx-upstream@qlogic.com
      Cc: user-mode-linux-devel@lists.sourceforge.net
      Cc: user-mode-linux-user@lists.sourceforge.net
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      f139caf2
  16. 18 4月, 2014 1 次提交
  17. 20 3月, 2014 1 次提交
    • S
      scsi, fcoe: Fix CPU hotplug callback registration · cd45ae38
      Srivatsa S. Bhat 提交于
      Subsystems that want to register CPU hotplug callbacks, as well as perform
      initialization for the CPUs that are already online, often do it as shown
      below:
      
      	get_online_cpus();
      
      	for_each_online_cpu(cpu)
      		init_cpu(cpu);
      
      	register_cpu_notifier(&foobar_cpu_notifier);
      
      	put_online_cpus();
      
      This is wrong, since it is prone to ABBA deadlocks involving the
      cpu_add_remove_lock and the cpu_hotplug.lock (when running concurrently
      with CPU hotplug operations).
      
      Instead, the correct and race-free way of performing the callback
      registration is:
      
      	cpu_notifier_register_begin();
      
      	for_each_online_cpu(cpu)
      		init_cpu(cpu);
      
      	/* Note the use of the double underscored version of the API */
      	__register_cpu_notifier(&foobar_cpu_notifier);
      
      	cpu_notifier_register_done();
      
      Fix the fcoe code in scsi by using this latter form of callback registration.
      
      Cc: Robert Love <robert.w.love@intel.com>
      Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Signed-off-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      cd45ae38
  18. 14 10月, 2013 2 次提交
    • J
      scsi: Convert uses of compare_ether_addr to ether_addr_equal · 6942df7f
      Joe Perches 提交于
      Preliminary to removing compare_ether_addr altogether:
      
      Use the new bool function ether_addr_equal to add
      some clarity and reduce the likelihood for misuse
      of compare_ether_addr for sorting.
      
      Done via cocci script:
      
      $ cat compare_ether_addr.cocci
      @@
      expression a,b;
      @@
      -	!compare_ether_addr(a, b)
      +	ether_addr_equal(a, b)
      
      @@
      expression a,b;
      @@
      -	compare_ether_addr(a, b)
      +	!ether_addr_equal(a, b)
      
      @@
      expression a,b;
      @@
      -	!ether_addr_equal(a, b) == 0
      +	ether_addr_equal(a, b)
      
      @@
      expression a,b;
      @@
      -	!ether_addr_equal(a, b) != 0
      +	!ether_addr_equal(a, b)
      
      @@
      expression a,b;
      @@
      -	ether_addr_equal(a, b) == 0
      +	!ether_addr_equal(a, b)
      
      @@
      expression a,b;
      @@
      -	ether_addr_equal(a, b) != 0
      +	ether_addr_equal(a, b)
      
      @@
      expression a,b;
      @@
      -	!!ether_addr_equal(a, b)
      +	ether_addr_equal(a, b)
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      6942df7f
    • N
      fcoe: Fix missing mutex_unlock in fcoe_sysfs_fcf_add error path · 55d0ac5d
      Neil Horman 提交于
      In this pending patch:
      http://patchwork.open-fcoe.org/patch/104/
      
      Tomas Henzl noted that the error path when fcoe_fcf_device_add fails, was
      missing a mutex_unlock call.
      
      Not sure what staet the integration of the above patch is in, but if you could
      either merge this with it, or apply it on top of what you already have, that
      would be great.  Thanks!
      Signed-off-by: NNeil Horman <nhorman@tuxdriver.com>
      CC: thenzl@redhat.com
      Reported-by: thenzl@redhat.com
      Signed-off-by: NRobert Love <robert.w.love@intel.com>
      55d0ac5d
  19. 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
  20. 27 9月, 2013 2 次提交
  21. 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
  22. 10 7月, 2013 4 次提交