Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
4c5fc2d
HID: playstation: Clamp num_touch_reports
tweej Apr 17, 2026
ebf06f1
media: uvcvideo: Enable VB2_DMABUF for metadata stream
ribalda Mar 9, 2026
4ca970b
media: nxp: imx8-isi: Reduce minimum queued buffers from 2 to 0
Mar 12, 2026
7e8acda
media: i2c: ov8856: free control handler on error in ov8856_init_cont…
AKoskovich Mar 12, 2026
2dfbb1e
media: chips-media: wave5: fix a potential memory leak in wave5_vdi_i…
Jan 25, 2026
c58746d
media: chips-media: wave5: add missing spinlock protection for send_e…
haruki3hhh Jan 31, 2026
42c3376
media: chips-media: wave5: add missing spinlock protection for handle…
haruki3hhh Jan 31, 2026
b22499e
spi: bcm63xx: fix controller deregistration
jhovold Apr 9, 2026
8ed814d
spi: atmel: fix controller deregistration
jhovold Apr 9, 2026
035002f
arm64: dts: lx2160a-cex7/lx2162a-sr-som: fix usd-cd & gpio pinmux
Josua-SR Mar 24, 2026
ae7114d
staging: media: atomisp: Disallow all private IOCTLs
Feb 26, 2026
6bd3cc1
regulator: mt6357: fix OF node reference imbalance
jhovold Apr 8, 2026
6299967
spi: st-ssc4: fix controller deregistration
jhovold Apr 10, 2026
7b24861
regulator: max77650: fix OF node reference imbalance
jhovold Apr 8, 2026
15c6221
media: rc: xbox_remote: heed DMA restrictions
oneukum Feb 11, 2026
5c0b718
media: rc: streamzap: Error handling in probe
oneukum Feb 11, 2026
c2b05fa
media: i2c: imx283: Enter full standby when stopping streaming
jailuthra Feb 14, 2026
0c515fa
regulator: rk808: fix OF node reference imbalance
jhovold Apr 8, 2026
0dfae38
media: videobuf2: Set vma_flags in vb2_dma_sg_mmap
jannau Feb 15, 2026
a14d8c8
media: intel/ipu6: fix error pointer dereference
ethantidmore Mar 7, 2026
3c283ea
media: i2c: imx283: Fix hang when going from large to small resolution
jailuthra Feb 14, 2026
c93086b
regulator: act8945a: fix OF node reference imbalance
jhovold Apr 8, 2026
d09e6c6
regulator: bd9571mwv: fix OF node reference imbalance
jhovold Apr 8, 2026
178fa9a
spi: lantiq-ssc: fix controller deregistration
jhovold Apr 9, 2026
5a50a53
spi: meson-spicc: fix controller deregistration
jhovold Apr 9, 2026
4e16260
spi: qup: fix controller deregistration
jhovold Apr 10, 2026
ea48462
spi: at91-usart: fix controller deregistration
jhovold Apr 9, 2026
3934bc1
media: saa7164: add ioremap return checks and cleanups
blacksanxx Mar 16, 2026
7ae732d
spi: aspeed-smc: fix controller deregistration
jhovold Apr 9, 2026
7abf9e8
platform/x86: hp-wmi: Ignore backlight and FnLock events
VulnX Apr 3, 2026
94ff51a
vsock/virtio: fix MSG_PEEK ignoring skb offset when calculating bytes…
luigix25 Apr 15, 2026
0a68aad
media: pci: zoran: fix potential memory leak in zoran_probe()
Mar 12, 2026
433565b
media: dib8000: avoid division by 0 in dib8000_set_dds()
Feb 6, 2026
dfbe506
media: i2c: imx412: Assert reset GPIO during probe
wenmliu Jan 23, 2026
01ef985
media: staging: imx: request mbus_config in csi_start
tretter Nov 7, 2025
05ff621
media: i2c: ov08d10: fix image vertical start setting
emfend Mar 24, 2026
ba39b5e
media: omap3isp: drop the use count of v4l2 pipeline
Jan 26, 2026
c7debe5
spi: mxs: fix controller deregistration
jhovold Apr 10, 2026
27a2142
spi: dln2: fix controller deregistration
jhovold Apr 9, 2026
65c2a7d
spi: s3c64xx: fix controller deregistration
jhovold Apr 10, 2026
c9633eb
spi: fsl-espi: fix controller deregistration
jhovold Apr 9, 2026
7b4a3fb
spi: omap2-mcspi: fix controller deregistration
jhovold Apr 10, 2026
0f9d6c7
spi: pic32: fix controller deregistration
jhovold Apr 10, 2026
b79583b
spi: mtk-nor: fix controller deregistration
jhovold Apr 10, 2026
1f4eee9
spi: pl022: fix controller deregistration
jhovold Apr 10, 2026
bfa9ebc
spi: sh-hspi: fix controller deregistration
jhovold Apr 10, 2026
5e44a7b
spi: fsl: fix controller deregistration
jhovold Apr 10, 2026
07248ae
spi: bcmbca-hsspi: fix controller deregistration
jhovold Apr 9, 2026
fb5a09c
spi: coldfire-qspi: fix controller deregistration
jhovold Apr 9, 2026
e5346f2
spi: npcm-pspi: fix controller deregistration
jhovold Apr 10, 2026
1c31724
spi: pic32-sqi: fix controller deregistration
jhovold Apr 10, 2026
166ca46
spi: sprd: fix controller deregistration
jhovold Apr 10, 2026
6f7dcb7
spi: rspi: fix controller deregistration
jhovold Apr 10, 2026
09c8c11
spi: img-spfi: fix controller deregistration
jhovold Apr 9, 2026
6bddf0f
spi: imx: fix runtime pm leak on probe deferral
jhovold Apr 21, 2026
297529e
spi: mxic: fix controller deregistration
jhovold Apr 14, 2026
abbce14
spi: orion: fix controller deregistration
jhovold Apr 14, 2026
9f26b95
spi: orion: fix runtime pm leak on unbind
jhovold Apr 21, 2026
f2cac50
spi: orion: fix clock imbalance on registration failure
jhovold Apr 21, 2026
6535984
spi: mpc52xx: fix use-after-free on registration failure
jhovold Apr 21, 2026
f4bb166
spi: mpc52xx: fix controller deregistration
jhovold Apr 14, 2026
9afbe3c
spi: mpc52xx: fix use-after-free on unbind
jhovold Apr 14, 2026
5e6e20c
spi: cadence: fix controller deregistration
jhovold Apr 14, 2026
d8f3c61
spi: cadence: fix unclocked access on unbind
jhovold Apr 21, 2026
86b8251
drm/msm/gem: fix error handling in msm_ioctl_gem_info_get_metadata()
Mar 25, 2026
244d389
drm/i915/psr: Init variable to avoid early exit from et alignment loop
hogander Apr 13, 2026
28cfcf7
drm/amdkfd: Clear VRAM on allocation to prevent stale data exposure
ashetaia-amd Apr 10, 2026
c7c1aeb
drm/amdgpu: Use SMUIO 15.0.0 offsets for TSC upper and lower count.
Mar 31, 2026
bd088ad
drm/amdgpu: gate VM CPU HDP flush on reset lock
Apr 7, 2026
6f92730
drm/amd/pm: fix incorrect FeatureCtrlMask setting on smu v14.0.x
Apr 3, 2026
b7c4c34
drm/amdkfd: Add upper bound check for num_of_nodes
amd-alysaliu Mar 30, 2026
7af378f
drm/amdgpu: Add bounds checking to ib_{get,set}_value
lolzballs Mar 25, 2026
f8eada7
drm/amdgpu/vcn4: Prevent OOB reads when parsing IB
lolzballs Mar 24, 2026
7af70d1
drm/amdgpu/vce: Prevent partial address patches
lolzballs Mar 30, 2026
f6a5eaf
drm/amdgpu/vcn4: Prevent OOB reads when parsing dec msg
lolzballs Mar 25, 2026
e71e84e
drm/amdgpu/vcn3: Prevent OOB reads when parsing dec msg
lolzballs Mar 24, 2026
5e3d6c9
drm/amd/display: Change dither policy for 10 bpc output back to dithe…
kleinerm Mar 21, 2026
923eca4
drm/gem: Fix inconsistent plane dimension calculation in drm_gem_fb_i…
geeky-ashu Apr 20, 2026
d24c6cb
drm/amdkfd: validate SVM ioctl nattr against buffer size
amd-alysaliu Apr 21, 2026
dcfeab9
drm/xe/bo: Fix bo leak on GGTT flag validation in xe_bo_init_locked()
ShuichengLin Apr 8, 2026
b780ffd
drm/xe: Fix dma-buf attachment leak in xe_gem_prime_import()
ShuichengLin Apr 8, 2026
910eeca
drm/xe/bo: Fix bo leak on unaligned size validation in xe_bo_init_loc…
ShuichengLin Apr 8, 2026
60d2eaa
drm/radeon: add missing revision check for CI
alexdeucher Apr 27, 2026
a158b66
drm/amdgpu: zero-initialize GART table on allocation
amd-yangp Apr 27, 2026
d99848f
drm/exynos: remove bridge when component_add fails
osamakader Apr 23, 2026
ea6c458
drm/panel: himax-hx83102: restore MODE_LPM after sending disable cmds
Icenowy Apr 25, 2026
4525848
drm/amdgpu/gfx9: drop unnecessary 64-bit fence flag check in KIQ
jbmoore61 Apr 28, 2026
308582d
drm/panel: boe-tv101wum-nl6: restore MODE_LPM after sending disable cmds
Icenowy May 3, 2026
bbbadbc
drm/amdkfd: Make all TLB-flushes heavy-weight
fxkamd Apr 20, 2026
775c3be
drm/amdgpu/sdma4: replace BUG_ON with WARN_ON in fence emission
jbmoore61 Apr 27, 2026
59c2ac7
drm/amdgpu/pm: add missing revision check for CI
alexdeucher Apr 27, 2026
4bc547e
drm/amdgpu/pm: align Hawaii mclk workaround with radeon
alexdeucher Apr 28, 2026
fb8146a
arm64: dts: ti: k3-am62a7-sk: Fix pin name in comment from M19 to N22
Siddharth-Vadapalli-at-TI Mar 9, 2026
91d1089
sctp: revalidate list cursor after sctp_sendmsg_to_asoc() in SCTP_SEN…
benmap-anthropic May 8, 2026
f27f094
batman-adv: fix integer overflow on buff_pos
m1nds Apr 21, 2026
68c36a7
batman-adv: reject new tp_meter sessions during teardown
JiexunWang Apr 27, 2026
82c8746
batman-adv: stop caching unowned originator pointers in BAT IV
JiexunWang May 3, 2026
5c20f7a
batman-adv: bla: prevent use-after-free when deleting claims
ecsv May 6, 2026
aae4aae
batman-adv: bla: only purge non-released claims
ecsv May 6, 2026
ee3aab3
batman-adv: bla: put backbone reference on failed claim hash insert
ecsv May 6, 2026
4c53600
usb: typec: tcpm: reset internal port states on soft reset AMS
amitsd2 Apr 14, 2026
80546ae
usb: dwc3: Move GUID programming after PHY initialization
selvarasu-g May 13, 2026
510e655
ALSA: hda: cs35l56: Propagate ASP TX source control errors
CassivsGabriellis May 13, 2026
0dba192
ALSA: misc: Use guard() for spin locks
tiwai May 13, 2026
d6f82db
ALSA: core: Serialize deferred fasync state checks
CassivsGabriellis May 13, 2026
d9cc314
ALSA: seq: Notify client and port info changes
tiwai May 13, 2026
22ec71f
ALSA: seq: Fix UMP group 16 filtering
CassivsGabriellis May 13, 2026
69f18f0
Bluetooth: hci_conn: fix potential UAF in create_big_sync
devnexen May 13, 2026
b5a1474
spi: zynq-qspi: Simplify clock handling with devm_clk_get_enabled()
May 13, 2026
59e3333
spi: zynq-qspi: fix controller deregistration
jhovold May 13, 2026
f462f63
spi: tegra20-sflash: fix controller deregistration
jhovold May 14, 2026
6defa76
spi: tegra114: fix controller deregistration
jhovold May 14, 2026
de4aabf
spi: uniphier: Simplify clock handling with devm_clk_get_enabled()
May 14, 2026
46be823
spi: uniphier: fix controller deregistration
jhovold May 14, 2026
6dc4704
mm/hugetlb_cma: round up per_node before logging it
hqsz May 14, 2026
caae665
block: cleanup blkdev_report_zones()
damien-lemoal May 14, 2026
00f3b38
block: reorganize struct blk_zone_wplug
damien-lemoal May 14, 2026
bfb077f
block: fix zone write plug removal
damien-lemoal May 14, 2026
7a520ab
tracefs: Fix default permissions not being applied on initial mount
devnexen May 14, 2026
8f078eb
fbcon: Avoid OOB font access if console rotation fails
tdz May 14, 2026
5479f37
rust: pin-init: fix incorrect accessor reference lifetime
nbdd0121 May 13, 2026
c9fe328
mm/damon/core: disallow time-quota setting zero esz
sjp38 Apr 7, 2026
b53d8a3
mm/damon/core: implement damon_kdamond_pid()
sjp38 Jan 15, 2026
ed17b19
mm/damon/lru_sort: detect and use fresh enabled and kdamond_pid values
sjp38 Apr 19, 2026
3ae720c
mm/damon/reclaim: detect and use fresh enabled and kdamond_pid values
sjp38 Apr 19, 2026
dd17df6
rust: allow `clippy::collapsible_match` globally
ojeda Apr 26, 2026
fcab318
rust: allow `clippy::collapsible_if` globally
ojeda Apr 26, 2026
6d5d9a6
bonding: fix use-after-free due to enslave fail after slave array update
NikAleksandrov Jan 23, 2026
3d24507
io_uring/kbuf: support min length left for incremental buffers
mgjm Apr 23, 2026
e25635e
Bluetooth: L2CAP: Fix null-ptr-deref in l2cap_sock_get_sndtimeo_cb()
fourdim Apr 15, 2026
1f534e9
btrfs: remove fs_info argument from btrfs_sysfs_add_space_info_type()
fdmanana May 15, 2026
b109d4e
btrfs: fix double free in create_space_info_sub_group() error path
lgs2513 May 15, 2026
054d96a
btrfs: fix btrfs_ioctl_space_info() slot_count TOCTOU which can lead …
May 15, 2026
9e8c956
tracing/probes: Limit size of event probe to 3K
rostedt May 15, 2026
985bb7b
batman-adv: stop tp_meter sessions during mesh teardown
JiexunWang May 15, 2026
75ace59
batman-adv: tp_meter: fix tp_num leak on kmalloc failure
ecsv May 15, 2026
3c4d958
vsock: fix buffer size clamping order
nszetei Apr 9, 2026
2fc548a
vsock/virtio: fix length and offset in tap skb for split packets
stefano-garzarella May 8, 2026
68115f6
vsock/virtio: fix empty payload in tap skb for non-linear buffers
stefano-garzarella May 8, 2026
9a39258
vsock/virtio: fix accept queue count leak on transport mismatch
phx0fer Apr 13, 2026
d2268e5
drm/amdgpu/vcn3: Avoid overflow on msg bound check
lolzballs Apr 13, 2026
925091d
drm/amdgpu/vcn4: Avoid overflow on msg bound check
lolzballs Apr 13, 2026
06a6437
Linux 6.12.90
gregkh May 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
VERSION = 6
PATCHLEVEL = 12
SUBLEVEL = 89
SUBLEVEL = 90
EXTRAVERSION =
NAME = Baby Opossum Posse

Expand Down Expand Up @@ -453,6 +453,8 @@ export rust_common_flags := --edition=2021 \
-Wrust_2018_idioms \
-Wunreachable_pub \
-Wclippy::all \
-Aclippy::collapsible_if \
-Aclippy::collapsible_match \
-Wclippy::ignored_unit_patterns \
-Wclippy::mut_mut \
-Wclippy::needless_bitwise_bool \
Expand Down
7 changes: 7 additions & 0 deletions arch/arm64/boot/dts/freescale/fsl-lx2160a-cex7.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@
};

&fspi {
pinctrl-names = "default";
pinctrl-0 = <&fspi_data74_pins>, <&fspi_data30_pins>, <&fspi_dqs_sck_cs10_pins>;
status = "okay";

flash@0 {
Expand All @@ -178,6 +180,11 @@
};
};

&pinmux_i2crv {
pinctrl-names = "default";
pinctrl-0 = <&gpio0_14_12_pins>;
};

&usb0 {
status = "okay";
};
Expand Down
2 changes: 2 additions & 0 deletions arch/arm64/boot/dts/freescale/fsl-lx2160a-clearfog-itx.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
};

&esdhc0 {
pinctrl-names = "default";
pinctrl-0 = <&esdhc0_cd_wp_pins>, <&esdhc0_cmd_data30_clk_vsel_pins>;
sd-uhs-sdr104;
sd-uhs-sdr50;
sd-uhs-sdr25;
Expand Down
24 changes: 24 additions & 0 deletions arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -1717,6 +1717,10 @@
pinctrl-single,bits = <0x0 0x1 0x7>;
};

esdhc0_cd_wp_pins: iic2-sdhc-pins {
pinctrl-single,bits = <0x0 0x6 0x7>;
};

i2c2_scl: i2c2-scl-pins {
pinctrl-single,bits = <0x0 0 (0x7 << 3)>;
};
Expand Down Expand Up @@ -1749,6 +1753,26 @@
pinctrl-single,bits = <0x0 (0x1 << 12) (0x7 << 12)>;
};

fspi_data74_pins: xspi1-data74-pins {
pinctrl-single,bits = <0x0 0x0 (0x7 << 15)>;
};

fspi_data30_pins: xspi1-data30-pins {
pinctrl-single,bits = <0x0 0x0 (0x7 << 18)>;
};

fspi_dqs_sck_cs10_pins: xspi1-base-pins {
pinctrl-single,bits = <0x0 0x0 (0x7 << 21)>;
};

esdhc0_cmd_data30_clk_vsel_pins: sdhc1-base-sdhc-vsel-pins {
pinctrl-single,bits = <0x0 0x0 (0x7 << 24)>;
};

gpio0_14_12_pins: sdhc1-dir-gpio-pins {
pinctrl-single,bits = <0x0 (0x1 << 27) (0x7 << 27)>;
};

i2c6_scl: i2c6-scl-pins {
pinctrl-single,bits = <0x4 0x2 0x7>;
};
Expand Down
2 changes: 2 additions & 0 deletions arch/arm64/boot/dts/freescale/fsl-lx2162a-clearfog.dts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@
};

&esdhc0 {
pinctrl-names = "default";
pinctrl-0 = <&esdhc0_cd_wp_pins>, <&esdhc0_cmd_data30_clk_vsel_pins>;
sd-uhs-sdr104;
sd-uhs-sdr50;
sd-uhs-sdr25;
Expand Down
7 changes: 7 additions & 0 deletions arch/arm64/boot/dts/freescale/fsl-lx2162a-sr-som.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
};

&fspi {
pinctrl-names = "default";
pinctrl-0 = <&fspi_data74_pins>, <&fspi_data30_pins>, <&fspi_dqs_sck_cs10_pins>;
status = "okay";

flash@0 {
Expand Down Expand Up @@ -80,3 +82,8 @@
reg = <0x6f>;
};
};

&pinmux_i2crv {
pinctrl-names = "default";
pinctrl-0 = <&gpio0_14_12_pins>;
};
2 changes: 1 addition & 1 deletion arch/arm64/boot/dts/ti/k3-am62a7-sk.dts
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@

vddshv_sdio_pins_default: vddshv-sdio-default-pins {
pinctrl-single,pins = <
AM62AX_IOPAD(0x07c, PIN_OUTPUT, 7) /* (M19) GPMC0_CLK.GPIO0_31 */
AM62AX_IOPAD(0x07c, PIN_OUTPUT, 7) /* (N22) GPMC0_CLK.GPIO0_31 */
>;
};
};
Expand Down
168 changes: 67 additions & 101 deletions block/blk-zoned.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ static const char *const zone_cond_name[] = {
/*
* Per-zone write plug.
* @node: hlist_node structure for managing the plug using a hash table.
* @bio_list: The list of BIOs that are currently plugged.
* @bio_work: Work struct to handle issuing of plugged BIOs
* @rcu_head: RCU head to free zone write plugs with an RCU grace period.
* @disk: The gendisk the plug belongs to.
* @lock: Spinlock to atomically manipulate the plug.
* @ref: Zone write plug reference counter. A zone write plug reference is
* always at least 1 when the plug is hashed in the disk plug hash table.
* The reference is incremented whenever a new BIO needing plugging is
Expand All @@ -50,27 +55,22 @@ static const char *const zone_cond_name[] = {
* reference is dropped whenever the zone of the zone write plug is reset,
* finished and when the zone becomes full (last write BIO to the zone
* completes).
* @lock: Spinlock to atomically manipulate the plug.
* @flags: Flags indicating the plug state.
* @zone_no: The number of the zone the plug is managing.
* @wp_offset: The zone write pointer location relative to the start of the zone
* as a number of 512B sectors.
* @bio_list: The list of BIOs that are currently plugged.
* @bio_work: Work struct to handle issuing of plugged BIOs
* @rcu_head: RCU head to free zone write plugs with an RCU grace period.
* @disk: The gendisk the plug belongs to.
*/
struct blk_zone_wplug {
struct hlist_node node;
refcount_t ref;
spinlock_t lock;
unsigned int flags;
unsigned int zone_no;
unsigned int wp_offset;
struct bio_list bio_list;
struct work_struct bio_work;
struct rcu_head rcu_head;
struct gendisk *disk;
spinlock_t lock;
refcount_t ref;
unsigned int flags;
unsigned int zone_no;
unsigned int wp_offset;
};

static inline unsigned int disk_zone_wplugs_hash_size(struct gendisk *disk)
Expand All @@ -85,17 +85,17 @@ static inline unsigned int disk_zone_wplugs_hash_size(struct gendisk *disk)
* being executed or the zone write plug bio list is not empty.
* - BLK_ZONE_WPLUG_NEED_WP_UPDATE: Indicates that we lost track of a zone
* write pointer offset and need to update it.
* - BLK_ZONE_WPLUG_UNHASHED: Indicates that the zone write plug was removed
* from the disk hash table and that the initial reference to the zone
* write plug set when the plug was first added to the hash table has been
* dropped. This flag is set when a zone is reset, finished or become full,
* to prevent new references to the zone write plug to be taken for
* newly incoming BIOs. A zone write plug flagged with this flag will be
* freed once all remaining references from BIOs or functions are dropped.
* - BLK_ZONE_WPLUG_DEAD: Indicates that the zone write plug will be
* removed from the disk hash table of zone write plugs when the last
* reference on the zone write plug is dropped. If set, this flag also
* indicates that the initial extra reference on the zone write plug was
* dropped, meaning that the reference count indicates the current number of
* active users (code context or BIOs and requests in flight). This flag is
* set when a zone is reset, finished or becomes full.
*/
#define BLK_ZONE_WPLUG_PLUGGED (1U << 0)
#define BLK_ZONE_WPLUG_NEED_WP_UPDATE (1U << 1)
#define BLK_ZONE_WPLUG_UNHASHED (1U << 2)
#define BLK_ZONE_WPLUG_DEAD (1U << 2)

/**
* blk_zone_cond_str - Return string XXX in BLK_ZONE_COND_XXX.
Expand Down Expand Up @@ -163,7 +163,6 @@ int blkdev_report_zones(struct block_device *bdev, sector_t sector,
unsigned int nr_zones, report_zones_cb cb, void *data)
{
struct gendisk *disk = bdev->bd_disk;
sector_t capacity = get_capacity(disk);
struct disk_report_zones_cb_args args = {
.disk = disk,
.user_cb = cb,
Expand All @@ -173,7 +172,7 @@ int blkdev_report_zones(struct block_device *bdev, sector_t sector,
if (!bdev_is_zoned(bdev) || WARN_ON_ONCE(!disk->fops->report_zones))
return -EOPNOTSUPP;

if (!nr_zones || sector >= capacity)
if (!nr_zones || sector >= get_capacity(disk))
return 0;

return disk->fops->report_zones(disk, sector, nr_zones,
Expand Down Expand Up @@ -480,65 +479,42 @@ static void disk_free_zone_wplug_rcu(struct rcu_head *rcu_head)
mempool_free(zwplug, zwplug->disk->zone_wplugs_pool);
}

static inline void disk_put_zone_wplug(struct blk_zone_wplug *zwplug)
static void disk_free_zone_wplug(struct blk_zone_wplug *zwplug)
{
if (refcount_dec_and_test(&zwplug->ref)) {
WARN_ON_ONCE(!bio_list_empty(&zwplug->bio_list));
WARN_ON_ONCE(zwplug->flags & BLK_ZONE_WPLUG_PLUGGED);
WARN_ON_ONCE(!(zwplug->flags & BLK_ZONE_WPLUG_UNHASHED));

call_rcu(&zwplug->rcu_head, disk_free_zone_wplug_rcu);
}
}

static inline bool disk_should_remove_zone_wplug(struct gendisk *disk,
struct blk_zone_wplug *zwplug)
{
/* If the zone write plug was already removed, we are done. */
if (zwplug->flags & BLK_ZONE_WPLUG_UNHASHED)
return false;
struct gendisk *disk = zwplug->disk;
unsigned long flags;

/* If the zone write plug is still plugged, it cannot be removed. */
if (zwplug->flags & BLK_ZONE_WPLUG_PLUGGED)
return false;
WARN_ON_ONCE(!(zwplug->flags & BLK_ZONE_WPLUG_DEAD));
WARN_ON_ONCE(zwplug->flags & BLK_ZONE_WPLUG_PLUGGED);
WARN_ON_ONCE(!bio_list_empty(&zwplug->bio_list));

/*
* Completions of BIOs with blk_zone_write_plug_bio_endio() may
* happen after handling a request completion with
* blk_zone_write_plug_finish_request() (e.g. with split BIOs
* that are chained). In such case, disk_zone_wplug_unplug_bio()
* should not attempt to remove the zone write plug until all BIO
* completions are seen. Check by looking at the zone write plug
* reference count, which is 2 when the plug is unused (one reference
* taken when the plug was allocated and another reference taken by the
* caller context).
*/
if (refcount_read(&zwplug->ref) > 2)
return false;
spin_lock_irqsave(&disk->zone_wplugs_lock, flags);
hlist_del_init_rcu(&zwplug->node);
atomic_dec(&disk->nr_zone_wplugs);
spin_unlock_irqrestore(&disk->zone_wplugs_lock, flags);

/* We can remove zone write plugs for zones that are empty or full. */
return !zwplug->wp_offset || disk_zone_wplug_is_full(disk, zwplug);
call_rcu(&zwplug->rcu_head, disk_free_zone_wplug_rcu);
}

static void disk_remove_zone_wplug(struct gendisk *disk,
struct blk_zone_wplug *zwplug)
static inline void disk_put_zone_wplug(struct blk_zone_wplug *zwplug)
{
unsigned long flags;
if (refcount_dec_and_test(&zwplug->ref))
disk_free_zone_wplug(zwplug);
}

/* If the zone write plug was already removed, we have nothing to do. */
if (zwplug->flags & BLK_ZONE_WPLUG_UNHASHED)
return;
/*
* Flag the zone write plug as dead and drop the initial reference we got when
* the zone write plug was added to the hash table. The zone write plug will be
* unhashed when its last reference is dropped.
*/
static void disk_mark_zone_wplug_dead(struct blk_zone_wplug *zwplug)
{
lockdep_assert_held(&zwplug->lock);

/*
* Mark the zone write plug as unhashed and drop the extra reference we
* took when the plug was inserted in the hash table.
*/
zwplug->flags |= BLK_ZONE_WPLUG_UNHASHED;
spin_lock_irqsave(&disk->zone_wplugs_lock, flags);
hlist_del_init_rcu(&zwplug->node);
atomic_dec(&disk->nr_zone_wplugs);
spin_unlock_irqrestore(&disk->zone_wplugs_lock, flags);
disk_put_zone_wplug(zwplug);
if (!(zwplug->flags & BLK_ZONE_WPLUG_DEAD)) {
zwplug->flags |= BLK_ZONE_WPLUG_DEAD;
disk_put_zone_wplug(zwplug);
}
}

static void blk_zone_wplug_bio_work(struct work_struct *work);
Expand All @@ -558,18 +534,7 @@ static struct blk_zone_wplug *disk_get_and_lock_zone_wplug(struct gendisk *disk,
again:
zwplug = disk_get_zone_wplug(disk, sector);
if (zwplug) {
/*
* Check that a BIO completion or a zone reset or finish
* operation has not already removed the zone write plug from
* the hash table and dropped its reference count. In such case,
* we need to get a new plug so start over from the beginning.
*/
spin_lock_irqsave(&zwplug->lock, *flags);
if (zwplug->flags & BLK_ZONE_WPLUG_UNHASHED) {
spin_unlock_irqrestore(&zwplug->lock, *flags);
disk_put_zone_wplug(zwplug);
goto again;
}
return zwplug;
}

Expand Down Expand Up @@ -655,14 +620,8 @@ static void disk_zone_wplug_set_wp_offset(struct gendisk *disk,
zwplug->flags &= ~BLK_ZONE_WPLUG_NEED_WP_UPDATE;
zwplug->wp_offset = wp_offset;
disk_zone_wplug_abort(zwplug);

/*
* The zone write plug now has no BIO plugged: remove it from the
* hash table so that it cannot be seen. The plug will be freed
* when the last reference is dropped.
*/
if (disk_should_remove_zone_wplug(disk, zwplug))
disk_remove_zone_wplug(disk, zwplug);
if (!zwplug->wp_offset || disk_zone_wplug_is_full(disk, zwplug))
disk_mark_zone_wplug_dead(zwplug);
}

static unsigned int blk_zone_wp_offset(struct blk_zone *zone)
Expand Down Expand Up @@ -1077,6 +1036,19 @@ static bool blk_zone_wplug_handle_write(struct bio *bio, unsigned int nr_segs)
return true;
}

/*
* If we got a zone write plug marked as dead, then the user is issuing
* writes to a full zone, or without synchronizing with zone reset or
* zone finish operations. In such case, fail the BIO to signal this
* invalid usage.
*/
if (zwplug->flags & BLK_ZONE_WPLUG_DEAD) {
spin_unlock_irqrestore(&zwplug->lock, flags);
disk_put_zone_wplug(zwplug);
bio_io_error(bio);
return true;
}

/* Indicate that this BIO is being handled using zone write plugging. */
bio_set_flag(bio, BIO_ZONE_WRITE_PLUGGING);

Expand Down Expand Up @@ -1145,7 +1117,7 @@ static void blk_zone_wplug_handle_native_zone_append(struct bio *bio)
disk->disk_name, zwplug->zone_no);
disk_zone_wplug_abort(zwplug);
}
disk_remove_zone_wplug(disk, zwplug);
disk_mark_zone_wplug_dead(zwplug);
spin_unlock_irqrestore(&zwplug->lock, flags);

disk_put_zone_wplug(zwplug);
Expand Down Expand Up @@ -1250,14 +1222,8 @@ static void disk_zone_wplug_unplug_bio(struct gendisk *disk,
}

zwplug->flags &= ~BLK_ZONE_WPLUG_PLUGGED;

/*
* If the zone is full (it was fully written or finished, or empty
* (it was reset), remove its zone write plug from the hash table.
*/
if (disk_should_remove_zone_wplug(disk, zwplug))
disk_remove_zone_wplug(disk, zwplug);

if (!zwplug->wp_offset || disk_zone_wplug_is_full(disk, zwplug))
disk_mark_zone_wplug_dead(zwplug);
spin_unlock_irqrestore(&zwplug->lock, flags);
}

Expand Down Expand Up @@ -1451,9 +1417,9 @@ static void disk_destroy_zone_wplugs_hash_table(struct gendisk *disk)
while (!hlist_empty(&disk->zone_wplugs_hash[i])) {
zwplug = hlist_entry(disk->zone_wplugs_hash[i].first,
struct blk_zone_wplug, node);
refcount_inc(&zwplug->ref);
disk_remove_zone_wplug(disk, zwplug);
disk_put_zone_wplug(zwplug);
spin_lock_irq(&zwplug->lock);
disk_mark_zone_wplug_dead(zwplug);
spin_unlock_irq(&zwplug->lock);
}
}

Expand Down
Loading
Loading