stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Heinz Mauelshagen <heinzm@redhat.com>,
	Mike Snitzer <snitzer@redhat.com>,
	Sasha Levin <alexander.levin@microsoft.com>
Subject: [PATCH 4.14 086/109] dm raid: fix raid set size revalidation
Date: Fri, 16 Mar 2018 16:23:55 +0100	[thread overview]
Message-ID: <20180316152334.604059087@linuxfoundation.org> (raw)
In-Reply-To: <20180316152329.844663293@linuxfoundation.org>

4.14-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Heinz Mauelshagen <heinzm@redhat.com>


[ Upstream commit 61e06e2c3ebd986050958513bfa40dceed756f8f ]

The raid set size is being revalidated unconditionally before a
reshaping conversion is started.  MD requires the size to only be
reduced in case of a stripe removing (i.e. shrinking) reshape but not
when growing because the raid array has to stay small until after the
growing reshape finishes.

Fix by avoiding the size revalidation in preresume unless a shrinking
reshape is requested.

Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/md/dm-raid.c |   30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -675,15 +675,11 @@ static struct raid_type *get_raid_type_b
 	return NULL;
 }
 
-/*
- * Conditionally change bdev capacity of @rs
- * in case of a disk add/remove reshape
- */
-static void rs_set_capacity(struct raid_set *rs)
+/* Adjust rdev sectors */
+static void rs_set_rdev_sectors(struct raid_set *rs)
 {
 	struct mddev *mddev = &rs->md;
 	struct md_rdev *rdev;
-	struct gendisk *gendisk = dm_disk(dm_table_get_md(rs->ti->table));
 
 	/*
 	 * raid10 sets rdev->sector to the device size, which
@@ -692,8 +688,16 @@ static void rs_set_capacity(struct raid_
 	rdev_for_each(rdev, mddev)
 		if (!test_bit(Journal, &rdev->flags))
 			rdev->sectors = mddev->dev_sectors;
+}
 
-	set_capacity(gendisk, mddev->array_sectors);
+/*
+ * Change bdev capacity of @rs in case of a disk add/remove reshape
+ */
+static void rs_set_capacity(struct raid_set *rs)
+{
+	struct gendisk *gendisk = dm_disk(dm_table_get_md(rs->ti->table));
+
+	set_capacity(gendisk, rs->md.array_sectors);
 	revalidate_disk(gendisk);
 }
 
@@ -1674,8 +1678,11 @@ static void do_table_event(struct work_s
 	struct raid_set *rs = container_of(ws, struct raid_set, md.event_work);
 
 	smp_rmb(); /* Make sure we access most actual mddev properties */
-	if (!rs_is_reshaping(rs))
+	if (!rs_is_reshaping(rs)) {
+		if (rs_is_raid10(rs))
+			rs_set_rdev_sectors(rs);
 		rs_set_capacity(rs);
+	}
 	dm_table_event(rs->ti->table);
 }
 
@@ -3845,11 +3852,10 @@ static int raid_preresume(struct dm_targ
 		mddev->resync_min = mddev->recovery_cp;
 	}
 
-	rs_set_capacity(rs);
-
 	/* Check for any reshape request unless new raid set */
 	if (test_and_clear_bit(RT_FLAG_RESHAPE_RS, &rs->runtime_flags)) {
 		/* Initiate a reshape. */
+		rs_set_rdev_sectors(rs);
 		mddev_lock_nointr(mddev);
 		r = rs_start_reshape(rs);
 		mddev_unlock(mddev);
@@ -3878,6 +3884,10 @@ static void raid_resume(struct dm_target
 	mddev->ro = 0;
 	mddev->in_sync = 0;
 
+	/* Only reduce raid set size before running a disk removing reshape. */
+	if (mddev->delta_disks < 0)
+		rs_set_capacity(rs);
+
 	/*
 	 * Keep the RAID set frozen if reshape/rebuild flags are set.
 	 * The RAID set is unfrozen once the next table load/resume,

  parent reply	other threads:[~2018-03-16 15:37 UTC|newest]

Thread overview: 132+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-16 15:22 [PATCH 4.14 000/109] 4.14.28-stable review Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 001/109] [PATCH] net: phy: fix resume handling Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 002/109] net: phy: Restore phy_resume() locking assumption Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 003/109] x86: Treat R_X86_64_PLT32 as R_X86_64_PC32 Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 004/109] ASoC: sun4i-i2s: Fix RX slot number of SUN8I Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 005/109] ASoC: sgtl5000: Fix suspend/resume Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 006/109] ASoC: wm_adsp: For TLV controls only register TLV get/set Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 007/109] ASoC: rt5651: Fix regcache sync errors on resume Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 008/109] usb: host: xhci-rcar: add support for r8a77965 Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 009/109] xhci: Fix front USB ports on ASUS PRIME B350M-A Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 010/109] xhci: fix endpoint context tracer output Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 011/109] serial: sh-sci: prevent lockup on full TTY buffers Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 012/109] tty/serial: atmel: add new version check for usart Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 013/109] uas: fix comparison for error code Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 014/109] staging: comedi: fix comedi_nsamples_left Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 015/109] staging: android: ashmem: Fix lockdep issue during llseek Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 016/109] USB: storage: Add JMicron bridge 152d:2567 to unusual_devs.h Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 017/109] usbip: vudc: fix null pointer dereference on udc->lock Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 018/109] usb: quirks: add control message delay for 1b1c:1b20 Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 019/109] usb: usbmon: Read text within supplied buffer size Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 020/109] usb: gadget: f_fs: Fix use-after-free in ffs_fs_kill_sb() Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 021/109] usb: dwc3: Fix lock-up on ID change during system suspend/resume Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 022/109] serial: 8250_pci: Add Brainboxes UC-260 4 port serial device Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 023/109] serial: core: mark port as initialized in autoconfig Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 024/109] earlycon: add reg-offset to physical address before mapping Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 025/109] dm mpath: fix passing integrity data Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 026/109] [PATCH] Revert "btrfs: use proper endianness accessors for super_copy" Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 030/109] HID: multitouch: Only look at non touch fields in first packet of a frame Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 031/109] HID: elo: clear BTN_LEFT mapping Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 032/109] iwlwifi: mvm: rs: dont override the rate history in the search cycle Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 033/109] ARM: dts: koelsch: Move cec_clock to root node Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 034/109] clk: meson: gxbb: fix wrong clock for SARADC/SANA Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 035/109] ARM: dts: exynos: Correct Trats2 panel reset line Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 036/109] drm/amdgpu: fix get_max_engine_clock_in_mhz Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 037/109] staging: rtl8822be: fix missing null check on dev_alloc_skb return Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 038/109] typec: tcpm: fusb302: Resolve out of order messaging events Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 040/109] sched: Stop switched_to_rt() from sending IPIs to offline CPUs Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 041/109] sched: Stop resched_cpu() " Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 042/109] crypto: ecc - Fix NULL pointer deref. on no default_rng Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 043/109] crypto: cavium - fix memory leak on info Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 044/109] test_firmware: fix setting old custom fw path back on exit Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 045/109] net: ieee802154: adf7242: Fix bug if defined DEBUG Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 046/109] rtc: brcmstb-waketimer: fix error handling in brcmstb_waketmr_probe() Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 047/109] net: xfrm: allow clearing socket xfrm policies Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 048/109] mtd: nand: fix interpretation of NAND_CMD_NONE in nand_command[_lp]() Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 049/109] net: thunderx: Set max queue count taking XDP_TX into account Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 050/109] ARM: dts: am335x-pepper: Fix the audio CODECs reset pin Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 051/109] ARM: dts: omap3-n900: " Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 052/109] mtd: nand: ifc: update bufnum mask for ver >= 2.0.0 Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 053/109] userns: Dont fail follow_automount based on s_user_ns Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 054/109] xfrm: Fix xfrm_replay_overflow_offload_esn Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 055/109] leds: pm8058: Silence pointer to integer size warning Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 056/109] clk: ti: clkctrl: add support for retrying failed init Greg Kroah-Hartman
2018-03-19  3:44   ` Dan Rue
2018-03-19  6:57     ` Tero Kristo
2018-03-19  7:24       ` Greg Kroah-Hartman
2018-03-19 16:42       ` Sasha Levin
2018-03-16 15:23 ` [PATCH 4.14 057/109] power: supply: ab8500_charger: Fix an error handling path Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 058/109] power: supply: ab8500_charger: Bail out in case of error in ab8500_charger_init_hw_registers() Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 059/109] drm/etnaviv: make THERMAL selectable Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 061/109] iio: health: max30102: Add power enable parameter to get_temp function Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 062/109] ath10k: update tdls teardown state to target Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 063/109] cpufreq: Fix governor module removal race Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 064/109] dmaengine: bcm2835-dma: Use vchan_terminate_vdesc() instead of desc_free Greg Kroah-Hartman
2018-03-16 18:46   ` Dan Rue
2018-03-17 14:32     ` Vinod Koul
2018-03-18 10:24       ` Greg Kroah-Hartman
2018-03-18 10:44         ` Greg Kroah-Hartman
2018-03-19  3:08           ` Vinod Koul
2018-03-19  7:14             ` Peter Ujfalusi
2018-03-19  7:23               ` Vinod Koul
2018-03-20  4:46                 ` Vinod Koul
2018-03-16 15:23 ` [PATCH 4.14 065/109] dmaengine: amba-pl08x: " Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 067/109] scsi: ses: dont ask for diagnostic pages repeatedly during probe Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 068/109] pwm: stmpe: Fix wrong register offset for hwpwm=2 case Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 069/109] drm/sun4i: Fix format mask in DE2 driver Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 070/109] pinctrl: sh-pfc: r8a7791: Add can_clk function Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 071/109] pinctrl: sh-pfc: r8a7795-es1: Fix MOD_SEL1 bit[25:24] to 0x3 when using STP_ISEN_1_D Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 072/109] perf annotate: Fix unnecessary memory allocation for s390x Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 073/109] perf annotate: Fix objdump comment parsing for Intel mov dissassembly Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 074/109] iwlwifi: mvm: avoid dumping assert log when device is stopped Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 075/109] drm/amdgpu:fix virtual dce bug Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 076/109] clk: qcom: msm8916: fix mnd_width for codec_digcodec Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 077/109] mwifiex: cfg80211: do not change virtual interface during scan processing Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 078/109] ath10k: fix invalid STS_CAP_OFFSET_MASK Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 080/109] spi: sun6i: disable/unprepare clocks on remove Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 081/109] bnxt_en: Dont print "Link speed -1 no longer supported" messages Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 082/109] scsi: core: scsi_get_device_flags_keyed(): Always return device flags Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 083/109] scsi: devinfo: apply to HP XP the same flags as Hitachi VSP Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 084/109] scsi: dh: add new rdac devices Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 085/109] media: vsp1: Prevent suspending and resuming DRM pipelines Greg Kroah-Hartman
2018-03-16 15:23 ` Greg Kroah-Hartman [this message]
2018-03-16 15:23 ` [PATCH 4.14 087/109] media: cpia2: Fix a couple off by one bugs Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 088/109] media: davinci: vpif_capture: add NULL check on devm_kzalloc return value Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 089/109] virtio_net: Disable interrupts if napi_complete_done rescheduled napi Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 090/109] net: sched: drop qdisc_reset from dev_graft_qdisc Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 091/109] veth: set peer GSO values Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 092/109] drm/amdkfd: Fix memory leaks in kfd topology Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 093/109] powerpc/modules: Dont try to restore r2 after a sibling call Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 094/109] powerpc/64: Dont trace irqs-off at interrupt return to soft-disabled context Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 095/109] arm64: dts: renesas: salvator-common: Add EthernetAVB PHY reset Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 096/109] agp/intel: Flush all chipset writes after updating the GGTT Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 097/109] mac80211_hwsim: enforce PS_MANUAL_POLL to be set after PS_ENABLED Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 098/109] mac80211: remove BUG() when interface type is invalid Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 100/109] ASoC: nuc900: Fix a loop timeout test Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 101/109] mmc: mmc_test: Ensure command queue is disabled for testing Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 102/109] Fix misannotated out-of-line _copy_to_user() Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 103/109] ipvlan: add L2 check for packets arriving via virtual devices Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 104/109] rcutorture/configinit: Fix build directory error message Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 105/109] locking/locktorture: Fix num reader/writer corner cases Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 106/109] ima: relax requiring a file signature for new files with zero length Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 107/109] IB/mlx5: revisit -Wmaybe-uninitialized warning Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 108/109] dmaengine: qcom_hidma: check pending interrupts Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 109/109] drm/i915/glk: Disable Guc and HuC on GLK Greg Kroah-Hartman
2018-03-16 19:40 ` [PATCH 4.14 000/109] 4.14.28-stable review Naresh Kamboju
2018-03-18 10:26   ` Greg Kroah-Hartman
2018-03-17 14:46 ` Guenter Roeck
2018-03-18 10:25   ` Greg Kroah-Hartman
2018-03-18 10:24 ` Greg Kroah-Hartman
2018-03-18 11:14   ` Greg Kroah-Hartman
2018-03-18 22:39     ` Guenter Roeck
2018-03-19  7:39       ` Greg Kroah-Hartman
2018-03-19  8:19     ` Dan Rue
2018-03-19 18:13 ` Kash Pande
2018-03-19 18:20   ` Guenter Roeck
2018-03-26 17:54     ` Kash Pande
2018-03-27  6:28       ` Greg Kroah-Hartman
2018-03-27  6:37         ` Guenter Roeck
2018-03-27  7:28           ` Greg Kroah-Hartman
2018-03-27  8:33           ` Thomas Backlund
2018-03-27  8:45             ` Greg Kroah-Hartman
2018-03-27 10:23               ` Guenter Roeck

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=20180316152334.604059087@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=alexander.levin@microsoft.com \
    --cc=heinzm@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=snitzer@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).