mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: alexander.levin@verizon.com
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Cc: Mike Christie <mchristi@redhat.com>,
	Nicholas Bellinger <nab@linux-iscsi.org>,
	alexander.levin@verizon.com
Subject: [PATCH AUTOSEL for 4.4 049/101] target: fix ALUA transition timeout handling
Date: Thu, 7 Dec 2017 15:50:23 +0000	[thread overview]
Message-ID: <20171207155005.5852-49-alexander.levin@verizon.com> (raw)
In-Reply-To: <20171207155005.5852-1-alexander.levin@verizon.com>

From: Mike Christie <mchristi@redhat.com>

[ Upstream commit d7175373f2745ed4abe5b388d5aabd06304f801e ]

The implicit transition time tells initiators the min time
to wait before timing out a transition. We currently schedule
the transition to occur in tg_pt_gp_implicit_trans_secs
seconds so there is no room for delays. If
core_alua_do_transition_tg_pt_work->core_alua_update_tpg_primary_metadata
needs to write out info to a remote file, then the initiator can
easily time out the operation.

Signed-off-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 drivers/target/target_core_alua.c | 23 ++++++++---------------
 include/target/target_core_base.h |  2 +-
 2 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
index 3dad73448ea5..8eec0162acb1 100644
--- a/drivers/target/target_core_alua.c
+++ b/drivers/target/target_core_alua.c
@@ -1010,7 +1010,7 @@ static void core_alua_queue_state_change_ua(struct t10_alua_tg_pt_gp *tg_pt_gp)
 static void core_alua_do_transition_tg_pt_work(struct work_struct *work)
 {
 	struct t10_alua_tg_pt_gp *tg_pt_gp = container_of(work,
-		struct t10_alua_tg_pt_gp, tg_pt_gp_transition_work.work);
+		struct t10_alua_tg_pt_gp, tg_pt_gp_transition_work);
 	struct se_device *dev = tg_pt_gp->tg_pt_gp_dev;
 	bool explicit = (tg_pt_gp->tg_pt_gp_alua_access_status ==
 			 ALUA_STATUS_ALTERED_BY_EXPLICIT_STPG);
@@ -1073,13 +1073,12 @@ static int core_alua_do_transition_tg_pt(
 	/*
 	 * Flush any pending transitions
 	 */
-	if (!explicit && tg_pt_gp->tg_pt_gp_implicit_trans_secs &&
-	    atomic_read(&tg_pt_gp->tg_pt_gp_alua_access_state) ==
+	if (!explicit && atomic_read(&tg_pt_gp->tg_pt_gp_alua_access_state) ==
 	    ALUA_ACCESS_STATE_TRANSITION) {
 		/* Just in case */
 		tg_pt_gp->tg_pt_gp_alua_pending_state = new_state;
 		tg_pt_gp->tg_pt_gp_transition_complete = &wait;
-		flush_delayed_work(&tg_pt_gp->tg_pt_gp_transition_work);
+		flush_work(&tg_pt_gp->tg_pt_gp_transition_work);
 		wait_for_completion(&wait);
 		tg_pt_gp->tg_pt_gp_transition_complete = NULL;
 		return 0;
@@ -1114,15 +1113,9 @@ static int core_alua_do_transition_tg_pt(
 	atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt);
 	spin_unlock(&dev->t10_alua.tg_pt_gps_lock);
 
-	if (!explicit && tg_pt_gp->tg_pt_gp_implicit_trans_secs) {
-		unsigned long transition_tmo;
-
-		transition_tmo = tg_pt_gp->tg_pt_gp_implicit_trans_secs * HZ;
-		schedule_delayed_work(&tg_pt_gp->tg_pt_gp_transition_work,
-				      transition_tmo);
-	} else {
+	schedule_work(&tg_pt_gp->tg_pt_gp_transition_work);
+	if (explicit) {
 		tg_pt_gp->tg_pt_gp_transition_complete = &wait;
-		schedule_delayed_work(&tg_pt_gp->tg_pt_gp_transition_work, 0);
 		wait_for_completion(&wait);
 		tg_pt_gp->tg_pt_gp_transition_complete = NULL;
 	}
@@ -1690,8 +1683,8 @@ struct t10_alua_tg_pt_gp *core_alua_allocate_tg_pt_gp(struct se_device *dev,
 	mutex_init(&tg_pt_gp->tg_pt_gp_md_mutex);
 	spin_lock_init(&tg_pt_gp->tg_pt_gp_lock);
 	atomic_set(&tg_pt_gp->tg_pt_gp_ref_cnt, 0);
-	INIT_DELAYED_WORK(&tg_pt_gp->tg_pt_gp_transition_work,
-			  core_alua_do_transition_tg_pt_work);
+	INIT_WORK(&tg_pt_gp->tg_pt_gp_transition_work,
+		  core_alua_do_transition_tg_pt_work);
 	tg_pt_gp->tg_pt_gp_dev = dev;
 	atomic_set(&tg_pt_gp->tg_pt_gp_alua_access_state,
 		ALUA_ACCESS_STATE_ACTIVE_OPTIMIZED);
@@ -1799,7 +1792,7 @@ void core_alua_free_tg_pt_gp(
 	dev->t10_alua.alua_tg_pt_gps_counter--;
 	spin_unlock(&dev->t10_alua.tg_pt_gps_lock);
 
-	flush_delayed_work(&tg_pt_gp->tg_pt_gp_transition_work);
+	flush_work(&tg_pt_gp->tg_pt_gp_transition_work);
 
 	/*
 	 * Allow a struct t10_alua_tg_pt_gp_member * referenced by
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 8555321306fb..9982a2bcb880 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -299,7 +299,7 @@ struct t10_alua_tg_pt_gp {
 	struct list_head tg_pt_gp_lun_list;
 	struct se_lun *tg_pt_gp_alua_lun;
 	struct se_node_acl *tg_pt_gp_alua_nacl;
-	struct delayed_work tg_pt_gp_transition_work;
+	struct work_struct tg_pt_gp_transition_work;
 	struct completion *tg_pt_gp_transition_complete;
 };
 
-- 
2.11.0

  parent reply	other threads:[~2017-12-07 16:44 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07 15:50 [PATCH AUTOSEL for 4.4 001/101] usb: phy: isp1301: Add OF device ID table alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 002/101] md-cluster: free md_cluster_info if node leave cluster alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 003/101] userfaultfd: shmem: __do_fault requires VM_FAULT_NOPAGE alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 004/101] userfaultfd: selftest: vm: allow to build in vm/ directory alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 005/101] net: initialize msg.msg_flags in recvfrom alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 008/101] net: bcmgenet: reserved phy revisions must be checked first alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 007/101] net: bcmgenet: correct MIB access of UniMAC RUNT counters alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 006/101] net: bcmgenet: correct the RBUF_OVFL_CNT and RBUF_ERR_CNT MIB values alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 009/101] net: bcmgenet: power down internal phy if open or resume fails alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 011/101] NFSD: fix nfsd_minorversion(.., NFSD_AVAIL) alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 012/101] NFSD: fix nfsd_reset_versions for NFSv4 alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 010/101] net: bcmgenet: Power up the internal PHY before probing the MII alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 016/101] writeback: fix memory leak in wb_queue_work() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 017/101] net: wimax/i2400m: fix NULL-deref at probe alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 014/101] drm/omap: fix dmabuf mmap for dma_alloc'ed buffers alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 015/101] netfilter: bridge: honor frag_max_size when refragmenting alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 013/101] Input: i8042 - add TUXEDO BU1406 (N24_25BU) to the nomux list alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 020/101] mlxsw: reg: Fix SPVM max record count alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 021/101] mlxsw: reg: Fix SPVMLR " alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 018/101] dmaengine: Fix array index out of bounds warning in __get_unmap_pool() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 019/101] net: Resend IGMP memberships upon peer notification alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 025/101] scsi: hpsa: limit outstanding rescans alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 023/101] openrisc: fix issue handling 8 byte get_user calls alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 022/101] intel_th: pci: Add Gemini Lake support alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 024/101] scsi: hpsa: update check for logical volume status alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 026/101] fjes: Fix wrong netdevice feature flags alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 029/101] sched/deadline: Throttle a constrained deadline task activated after the deadline alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 027/101] drm/radeon/si: add dpm quirk for Oland alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 028/101] sched/deadline: Make sure the replenishment timer fires in the next period alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 031/101] mmc: mediatek: Fixed bug where clock frequency could be set wrong alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 032/101] drm/radeon: reinstate oland workaround for sclk alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 030/101] sched/deadline: Use deadline instead of period when calculating overflow alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 033/101] afs: Fix missing put_page() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 037/101] afs: Migrate vlocation fields to 64-bit alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 034/101] afs: Populate group ID from vnode status alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 036/101] afs: Flush outstanding writes when an fd is closed alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 035/101] afs: Adjust mode bits processing alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 041/101] afs: Fix page leak in afs_write_begin() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 039/101] afs: Fix the maths in afs_fs_store_data() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 038/101] afs: Prevent callback expiry timer overflow alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 040/101] afs: Populate and use client modification time alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 042/101] afs: Fix afs_kill_pages() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 044/101] perf symbols: Fix symbols__fixup_end heuristic for corner cases alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 043/101] net/mlx4_core: Avoid delays during VF driver device shutdown alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 045/101] efi/esrt: Cleanup bad memory map log messages alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 046/101] NFSv4.1 respect server's max size in CREATE_SESSION alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 047/101] btrfs: add missing memset while reading compressed inline extents alexander.levin
2017-12-07 15:50 ` alexander.levin [this message]
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 048/101] target: Use system workqueue for ALUA transitions alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 052/101] fbdev: controlfb: Add missing modes to fix out of bounds access alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 053/101] video: udlfb: Fix read EDID timeout alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 051/101] sfc: don't warn on successful change of MAC alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 050/101] target: fix race during implicit transition work flushes alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 057/101] ASoC: cs42l56: Fix reset GPIO name in example DT binding alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 056/101] rtc: pcf8563: fix output clock rate alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 055/101] video: fbdev: au1200fb: Return an error code if a memory allocation fails alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 054/101] video: fbdev: au1200fb: Release some resources " alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 058/101] dmaengine: ti-dma-crossbar: Correct am335x/am43xx mux value type alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 061/101] netfilter: ipvs: Fix inappropriate output of procfs alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 059/101] PCI/PME: Handle invalid data when reading Root Status alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 060/101] powerpc/powernv/cpufreq: Fix the frequency read by /proc/cpuinfo alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 063/101] powerpc/ipic: Fix status get and status clear alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 062/101] powerpc/opal: Fix EBUSY bug in acquiring tokens alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 065/101] target/iscsi: Fix a race condition in iscsit_add_reject_from_cmd() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 064/101] platform/x86: sony-laptop: Fix error handling in sony_nc_setup_rfkill() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 066/101] iscsi-target: fix memory leak in lio_target_tiqn_addtpg() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 067/101] target:fix condition return in core_pr_dump_initiator_port() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 068/101] target/file: Do not return error for UNMAP if length is zero alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 069/101] arm-ccn: perf: Prevent module unload while PMU is in use alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 071/101] mm: Handle 0 flags in _calc_vm_trans() macro alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 072/101] clk: mediatek: add the option for determining PLL source clock alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 070/101] crypto: tcrypt - fix buffer lengths in test_aead_speed() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 073/101] clk: imx6: refine hdmi_isfr's parent to make HDMI work on i.MX6 SoCs w/o VPU alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 074/101] clk: tegra: Fix cclk_lp divisor register alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 076/101] thermal/drivers/step_wise: Fix temperature regulation misbehavior alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 075/101] ppp: Destroy the mutex when cleanup alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 077/101] GFS2: Take inode off order_write list when setting jdata flag alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 081/101] xfs: fix log block underflow during recovery cycle verification alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 080/101] l2tp: cleanup l2tp_tunnel_delete calls alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 078/101] bcache: explicitly destroy mutex while exiting alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 085/101] scsi: hpsa: destroy sas transport properties before scsi_host alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 083/101] PCI: Detach driver before procfs & sysfs teardown on device remove alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 084/101] scsi: hpsa: cleanup sas_phy structures in sysfs when unloading alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 082/101] xfs: fix incorrect extent state in xfs_bmap_add_extent_unwritten_real alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 087/101] tty fix oops when rmmod 8250 alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 086/101] powerpc/perf/hv-24x7: Fix incorrect comparison in memord alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 089/101] pinctrl: adi2: Fix Kconfig build problem alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 088/101] dmaengine: rcar-dmac: use TCRB instead of TCR for residue alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 092/101] vt6655: Fix a possible sleep-in-atomic bug in vt6655_suspend alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 093/101] ASoC: samsung: i2s: disable secondary DAI until it gets fixed alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 090/101] raid5: Set R5_Expanded on parity devices as well as data alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 091/101] scsi: scsi_devinfo: Add REPORTLUN2 to EMC SYMMETRIX blacklist entry alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 096/101] scsi: bfa: integer overflow in debugfs alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 097/101] udf: Avoid overflow when session starts at large offset alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 094/101] scsi: sd: change manage_start_stop to bool in sysfs interface alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 095/101] scsi: sd: change allow_restart " alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 098/101] macvlan: Only deliver one copy of the frame to the macvlan interface alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 101/101] ath9k: fix tx99 potential info leak alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 099/101] RDMA/cma: Avoid triggering undefined behavior alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 100/101] IB/ipoib: Grab rtnl lock on heavy flush when calling ndo_open/stop alexander.levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171207155005.5852-49-alexander.levin@verizon.com \
    --to=alexander.levin@verizon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchristi@redhat.com \
    --cc=nab@linux-iscsi.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®