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,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Christoph Hellwig <hch@lst.de>, Mike Snitzer <snitzer@redhat.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Ilya Dryomov <idryomov@gmail.com>, Jens Axboe <axboe@fb.com>
Subject: [PATCH 4.9 103/103] block: get rid of blk_integrity_revalidate()
Date: Thu, 11 May 2017 16:13:12 +0200	[thread overview]
Message-ID: <20170511141218.421019161@linuxfoundation.org> (raw)
In-Reply-To: <20170511141210.778405364@linuxfoundation.org>

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

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

From: Ilya Dryomov <idryomov@gmail.com>

commit 19b7ccf8651df09d274671b53039c672a52ad84d upstream.

Commit 25520d55cdb6 ("block: Inline blk_integrity in struct gendisk")
introduced blk_integrity_revalidate(), which seems to assume ownership
of the stable pages flag and unilaterally clears it if no blk_integrity
profile is registered:

    if (bi->profile)
            disk->queue->backing_dev_info->capabilities |=
                    BDI_CAP_STABLE_WRITES;
    else
            disk->queue->backing_dev_info->capabilities &=
                    ~BDI_CAP_STABLE_WRITES;

It's called from revalidate_disk() and rescan_partitions(), making it
impossible to enable stable pages for drivers that support partitions
and don't use blk_integrity: while the call in revalidate_disk() can be
trivially worked around (see zram, which doesn't support partitions and
hence gets away with zram_revalidate_disk()), rescan_partitions() can
be triggered from userspace at any time.  This breaks rbd, where the
ceph messenger is responsible for generating/verifying CRCs.

Since blk_integrity_{un,}register() "must" be used for (un)registering
the integrity profile with the block layer, move BDI_CAP_STABLE_WRITES
setting there.  This way drivers that call blk_integrity_register() and
use integrity infrastructure won't interfere with drivers that don't
but still want stable pages.

Fixes: 25520d55cdb6 ("block: Inline blk_integrity in struct gendisk")
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Mike Snitzer <snitzer@redhat.com>
Tested-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
[idryomov@gmail.com: backport to < 4.11: bdi is embedded in queue]
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 block/blk-integrity.c     |   19 ++-----------------
 block/partition-generic.c |    1 -
 fs/block_dev.c            |    1 -
 include/linux/genhd.h     |    2 --
 4 files changed, 2 insertions(+), 21 deletions(-)

--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -417,7 +417,7 @@ void blk_integrity_register(struct gendi
 	bi->tuple_size = template->tuple_size;
 	bi->tag_size = template->tag_size;
 
-	blk_integrity_revalidate(disk);
+	disk->queue->backing_dev_info.capabilities |= BDI_CAP_STABLE_WRITES;
 }
 EXPORT_SYMBOL(blk_integrity_register);
 
@@ -430,26 +430,11 @@ EXPORT_SYMBOL(blk_integrity_register);
  */
 void blk_integrity_unregister(struct gendisk *disk)
 {
-	blk_integrity_revalidate(disk);
+	disk->queue->backing_dev_info.capabilities &= ~BDI_CAP_STABLE_WRITES;
 	memset(&disk->queue->integrity, 0, sizeof(struct blk_integrity));
 }
 EXPORT_SYMBOL(blk_integrity_unregister);
 
-void blk_integrity_revalidate(struct gendisk *disk)
-{
-	struct blk_integrity *bi = &disk->queue->integrity;
-
-	if (!(disk->flags & GENHD_FL_UP))
-		return;
-
-	if (bi->profile)
-		disk->queue->backing_dev_info.capabilities |=
-			BDI_CAP_STABLE_WRITES;
-	else
-		disk->queue->backing_dev_info.capabilities &=
-			~BDI_CAP_STABLE_WRITES;
-}
-
 void blk_integrity_add(struct gendisk *disk)
 {
 	if (kobject_init_and_add(&disk->integrity_kobj, &integrity_ktype,
--- a/block/partition-generic.c
+++ b/block/partition-generic.c
@@ -447,7 +447,6 @@ rescan:
 
 	if (disk->fops->revalidate_disk)
 		disk->fops->revalidate_disk(disk);
-	blk_integrity_revalidate(disk);
 	check_disk_size_change(disk, bdev);
 	bdev->bd_invalidated = 0;
 	if (!get_capacity(disk) || !(state = check_partition(disk, bdev)))
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1165,7 +1165,6 @@ int revalidate_disk(struct gendisk *disk
 
 	if (disk->fops->revalidate_disk)
 		ret = disk->fops->revalidate_disk(disk);
-	blk_integrity_revalidate(disk);
 	bdev = bdget_disk(disk, 0);
 	if (!bdev)
 		return ret;
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -731,11 +731,9 @@ static inline void part_nr_sects_write(s
 #if defined(CONFIG_BLK_DEV_INTEGRITY)
 extern void blk_integrity_add(struct gendisk *);
 extern void blk_integrity_del(struct gendisk *);
-extern void blk_integrity_revalidate(struct gendisk *);
 #else	/* CONFIG_BLK_DEV_INTEGRITY */
 static inline void blk_integrity_add(struct gendisk *disk) { }
 static inline void blk_integrity_del(struct gendisk *disk) { }
-static inline void blk_integrity_revalidate(struct gendisk *disk) { }
 #endif	/* CONFIG_BLK_DEV_INTEGRITY */
 
 #else /* CONFIG_BLOCK */

  parent reply	other threads:[~2017-05-11 14:24 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-11 14:11 [PATCH 4.9 000/103] 4.9.28-stable review Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 001/103] 9p: fix a potential acl leak Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 002/103] drm/sti: fix GDP size to support up to UHD resolution Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 003/103] hwmon: (it87) Fix pwm4 detection for IT8620 and IT8628 Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 004/103] tpm: fix RC value check in tpm2_seal_trusted Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 005/103] tmp: use pdev for parent device in tpm_chip_alloc Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 008/103] cpupower: Fix turbo frequency reporting for pre-Sandy Bridge cores Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 009/103] powerpc/mm: Fixup wrong LPCR_VRMASD value Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 010/103] powerpc/powernv: Fix opal_exit tracepoint opcode Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 011/103] powerpc/ftrace: Fix confusing help text for DISABLE_MPROFILE_KERNEL Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 012/103] powerpc: Correctly disable latent entropy GCC plugin on prom_init.o Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 013/103] perf/x86/intel/pt: Add format strings for PTWRITE and power event tracing Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 014/103] power: supply: bq24190_charger: Fix irq trigger to IRQF_TRIGGER_FALLING Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 015/103] power: supply: bq24190_charger: Call set_mode_host() on pm_resume() Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 016/103] power: supply: bq24190_charger: Install irq_handler_thread() at end of probe() Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 017/103] power: supply: bq24190_charger: Call power_supply_changed() for relevant component Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 018/103] power: supply: bq24190_charger: Dont read fault register outside irq_handle_thread() Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 019/103] power: supply: bq24190_charger: Handle fault before status on interrupt Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 020/103] arm64: dts: r8a7795: Mark EthernetAVB device node disabled Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 021/103] arm: dts: qcom: Fix ipq board clock rates Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 022/103] arm64: Improve detection of user/non-user mappings in set_pte(_at) Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 023/103] leds: ktd2692: avoid harmless maybe-uninitialized warning Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 024/103] ARM: dts: NSP: GPIO reboot open-source Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 025/103] ARM: OMAP5 / DRA7: Fix HYP mode boot for thumb2 build Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 026/103] ARM: dts: sun7i: lamobo-r1: Fix CPU port RGMII settings Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 027/103] mwifiex: debugfs: Fix (sometimes) off-by-1 SSID print Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 028/103] mwifiex: remove redundant dma padding in AMSDU Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 029/103] mwifiex: Avoid skipping WEP key deletion for AP Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 031/103] iwlwifi: mvm: dont restart HW if suspend fails with unified image Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 032/103] iwlwifi: mvm: overwrite skb info later Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 033/103] iwlwifi: pcie: dont increment / decrement a bool Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 035/103] iwlwifi: pcie: fix the set of DMA memory mask Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 036/103] iwlwifi: mvm: fix reorder timer re-arming Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 037/103] iwlwifi: mvm: Use aux queue for offchannel frames in dqa Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 038/103] iwlwifi: mvm/pcie: adjust A-MSDU tx_cmd length in PCIe Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 039/103] iwlwifi: mvm: fix pending frame counter calculation Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 040/103] iwlwifi: mvm: fix references to first_agg_queue in DQA mode Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 041/103] iwlwifi: mvm: synchronize firmware DMA paging memory Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 042/103] iwlwifi: mvm: writing zero bytes to debugfs causes a crash Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 043/103] x86/ioapic: Restore IO-APIC irq_chip retrigger callback Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 045/103] x86/mpx: Re-add MPX to selftests Makefile Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 046/103] clk: Make x86/ conditional on CONFIG_COMMON_CLK Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 047/103] kprobes/x86: Fix kernel panic when certain exception-handling addresses are probed Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 048/103] x86/platform/intel-mid: Correct MSI IRQ line for watchdog device Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 052/103] usb: dwc2: host: use msleep() for long delay Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 053/103] usb: host: ehci-exynos: Decrese node refcount on exynos_ehci_get_phy() error paths Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 054/103] usb: host: ohci-exynos: " Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 055/103] usb: chipidea: Only read/write OTGSC from one place Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 056/103] usb: chipidea: Handle extcon events properly Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 057/103] USB: serial: keyspan_pda: fix receive sanity checks Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 058/103] USB: serial: digi_acceleport: fix incomplete rx sanity check Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 059/103] USB: serial: ssu100: fix control-message error handling Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 060/103] USB: serial: io_edgeport: fix epic-descriptor handling Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 061/103] USB: serial: ti_usb_3410_5052: fix control-message error handling Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 062/103] USB: serial: ark3116: fix open " Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 063/103] USB: serial: ftdi_sio: fix latency-timer " Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 064/103] USB: serial: quatech2: fix control-message " Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 065/103] USB: serial: mct_u232: fix modem-status " Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 066/103] USB: serial: io_edgeport: fix descriptor " Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 067/103] USB: serial: sierra: fix bogus alternate-setting assumption Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 068/103] clk: rockchip: add "," to mux_pll_src_apll_dpll_gpll_usb480m_p on rk3036 Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 069/103] phy: qcom-usb-hs: Add depends on EXTCON Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 070/103] serial: 8250_omap: Fix probe and remove for PM runtime Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 071/103] scsi: qla2xxx: Fix crash in qla2xxx_eh_abort on bad ptr Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 072/103] scsi: mac_scsi: Fix MAC_SCSI=m option when SCSI=m Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 073/103] scsi: scsi_dh_emc: return success in clariion_std_inquiry() Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 074/103] scsi: smartpqi: fix time handling Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 075/103] MIPS: R2-on-R6 MULTU/MADDU/MSUBU emulation bugfix Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 076/103] brcmfmac: Ensure pointer correctly set if skb data location changes Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 077/103] brcmfmac: Make skb header writable before use Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 078/103] staging/lustre/llite: move root_squash from sysfs to debugfs Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 079/103] staging: wlan-ng: add missing byte order conversion Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 080/103] staging: emxx_udc: remove incorrect __init annotations Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 081/103] ALSA: hda - Fix deadlock of controller device lock at unbinding Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 082/103] sparc64: fix fault handling in NGbzero.S and GENbzero.S Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 083/103] macsec: dynamically allocate space for sglist Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 084/103] tcp: do not underestimate skb->truesize in tcp_trim_head() Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 085/103] bpf: enhance verifier to understand stack pointer arithmetic Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 086/103] bpf, arm64: fix jit branch offset related to ldimm64 Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 087/103] tcp: fix wraparound issue in tcp_lp Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 088/103] net: ipv6: Do not duplicate DAD on link up Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 090/103] tcp: do not inherit fastopen_req from parent Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 091/103] ipv4, ipv6: ensure raw socket message is big enough to hold an IP header Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 092/103] rtnetlink: NUL-terminate IFLA_PHYS_PORT_NAME string Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 093/103] ipv6: initialize route null entry in addrconf_init() Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 094/103] ipv6: reorder ip6_route_dev_notifier after ipv6_dev_notf Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 095/103] bnxt_en: allocate enough space for ->ntp_fltr_bmap Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 096/103] bpf: dont let ldimm64 leak map addresses on unprivileged Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 097/103] net: mdio-mux: bcm-iproc: call mdiobus_free() in error path Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 098/103] f2fs: sanity check segment count Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 099/103] xen: Revert commits da72ff5bfcb0 and 72a9b186292d Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 100/103] wlcore: Pass win_size taken from ieee80211_sta to FW Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 101/103] wlcore: Add RX_BA_WIN_SIZE_CHANGE_EVENT event Greg Kroah-Hartman
2017-05-11 14:13 ` Greg Kroah-Hartman [this message]
2017-05-11 21:09 ` [PATCH 4.9 000/103] 4.9.28-stable review Guenter Roeck
2017-05-12  6:20   ` Greg Kroah-Hartman
2017-05-12 15:24 ` Shuah Khan
2017-05-13  2:47 ` 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=20170511141218.421019161@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=axboe@fb.com \
    --cc=dan.j.williams@intel.com \
    --cc=hch@lst.de \
    --cc=idryomov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --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).