linux-stable/block
Matthew Wilcox (Oracle) 0f2dca5165 block: Remove special-casing of compound pages
commit 1b151e2435 upstream.

The special casing was originally added in pre-git history; reproducing
the commit log here:

> commit a318a92567d77
> Author: Andrew Morton <akpm@osdl.org>
> Date:   Sun Sep 21 01:42:22 2003 -0700
>
>     [PATCH] Speed up direct-io hugetlbpage handling
>
>     This patch short-circuits all the direct-io page dirtying logic for
>     higher-order pages.  Without this, we pointlessly bounce BIOs up to
>     keventd all the time.

In the last twenty years, compound pages have become used for more than
just hugetlb.  Rewrite these functions to operate on folios instead
of pages and remove the special case for hugetlbfs; I don't think
it's needed any more (and if it is, we can put it back in as a call
to folio_test_hugetlb()).

This was found by inspection; as far as I can tell, this bug can lead
to pages used as the destination of a direct I/O read not being marked
as dirty.  If those pages are then reclaimed by the MM without being
dirtied for some other reason, they won't be written out.  Then when
they're faulted back in, they will not contain the data they should.
It'll take a pretty unusual setup to produce this problem with several
races all going the wrong way.

This problem predates the folio work; it could for example have been
triggered by mmaping a THP in tmpfs and using that as the target of an
O_DIRECT read.

Fixes: 800d8c63b2 ("shmem: add huge pages support")
Cc:  <stable@vger.kernel.org>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-01-25 14:52:55 -08:00
..
partitions block: move GENHD_FL_NATIVE_CAPACITY to disk->state 2023-09-19 12:23:02 +02:00
badblocks.c
bdev.c block: move GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE to disk->event_flags 2023-09-19 12:23:02 +02:00
bfq-cgroup.c block, bfq: fix uaf for bfqq in bic_set_bfqq() 2023-02-09 11:26:36 +01:00
bfq-iosched.c block, bfq: fix uaf for bfqq in bic_set_bfqq() 2023-02-09 11:26:36 +01:00
bfq-iosched.h bfq: Get rid of __bio_blkcg() usage 2022-06-09 10:23:19 +02:00
bfq-wf2q.c block/bfq_wf2q: correct weight to ioprio 2022-04-08 14:23:55 +02:00
bio-integrity.c block: bio-integrity: Copy flags when bio_integrity_payload is cloned 2023-03-10 09:39:05 +01:00
bio.c block: Remove special-casing of compound pages 2024-01-25 14:52:55 -08:00
blk-cgroup-rwstat.c
blk-cgroup-rwstat.h
blk-cgroup.c blk-cgroup: bypass blkcg_deactivate_policy after destroying 2023-12-20 15:17:39 +01:00
blk-core.c blk-core: use pr_warn_ratelimited() in bio_check_ro() 2023-11-20 11:08:29 +01:00
blk-crypto-fallback.c
blk-crypto-internal.h blk-mq: release crypto keyslot before reporting I/O complete 2023-05-11 23:00:16 +09:00
blk-crypto.c blk-crypto: make blk_crypto_evict_key() more robust 2023-05-11 23:00:16 +09:00
blk-exec.c
blk-flush.c block: Fix fsync always failed if once failed 2022-01-27 11:05:25 +01:00
blk-integrity.c block: flush the integrity workqueue in blk_integrity_unregister 2021-09-14 20:03:30 -06:00
blk-ioc.c block: fix default IO priority handling again 2022-08-11 13:07:50 +02:00
blk-iocost.c blk-iocost: use spin_lock_irqsave in adjust_inuse_and_calc_cost 2023-07-23 13:46:44 +02:00
blk-iolatency.c block: don't allow the same type rq_qos add more than once 2022-08-17 14:24:24 +02:00
blk-ioprio.c
blk-ioprio.h
blk-lib.c
blk-map.c block-map: add __GFP_ZERO flag for alloc_page in function bio_copy_kern 2022-03-08 19:12:31 +01:00
blk-merge.c blk-mq: release crypto keyslot before reporting I/O complete 2023-05-11 23:00:16 +09:00
blk-mq-cpumap.c
blk-mq-debugfs-zoned.c
blk-mq-debugfs.c blk-mq: don't create hctx debugfs dir until q->debugfs_dir is created 2022-08-17 14:23:12 +02:00
blk-mq-debugfs.h
blk-mq-pci.c
blk-mq-rdma.c
blk-mq-sched.c blk-mq: correct stale comment of .get_budget 2023-03-10 09:39:04 +01:00
blk-mq-sched.h
blk-mq-sysfs.c blk-mq: fix possible memleak when register 'hctx' failed 2022-12-31 13:14:43 +01:00
blk-mq-tag.c blk-mq: avoid to iterate over stale request 2021-09-12 19:32:43 -06:00
blk-mq-tag.h
blk-mq-virtio.c
blk-mq.c blk-mq: release crypto keyslot before reporting I/O complete 2023-05-11 23:00:16 +09:00
blk-mq.h blk-mq: cancel blk-mq dispatch work in both blk_cleanup_queue and disk_release() 2021-12-01 09:04:56 +01:00
blk-pm.c scsi: block: pm: Always set request queue runtime active in blk_post_runtime_resume() 2022-01-27 11:04:15 +01:00
blk-pm.h
blk-rq-qos.c
blk-rq-qos.h block: don't allow the same type rq_qos add more than once 2022-08-17 14:24:24 +02:00
blk-settings.c block: make BLK_DEF_MAX_SECTORS unsigned 2024-01-25 14:52:40 -08:00
blk-stat.c
blk-stat.h
blk-sysfs.c block: fix use-after-free of q->q_usage_counter 2023-10-10 21:59:05 +02:00
blk-throttle.c blk-throttle: fix lockdep warning of "cgroup_mutex or RCU read lock required!" 2023-12-20 15:17:39 +01:00
blk-timeout.c
blk-wbt.c blk-wbt: fix that 'rwb->wc' is always set to 1 in wbt_init() 2022-10-26 12:35:54 +02:00
blk-wbt.h
blk-zoned.c block: Hold invalidate_lock in BLKRESETZONE ioctl 2021-11-18 19:17:15 +01:00
blk.h block: bump max plugged deferred size from 16 to 32 2021-11-18 19:16:16 +01:00
bounce.c
bsg-lib.c
bsg.c scsi: bsg: Fix device unregistration 2021-09-14 00:22:15 -04:00
disk-events.c block: increment diskseq on all media change events 2023-07-23 13:47:20 +02:00
elevator.c block/wbt: fix negative inflight counter when remove scsi device 2022-02-23 12:03:15 +01:00
fops.c block: Don't invalidate pagecache for invalid falloc modes 2024-01-15 18:51:07 +01:00
genhd.c block: add check of 'minors' and 'first_minor' in device_add_disk() 2024-01-25 14:52:39 -08:00
holder.c block: drop unused includes in <linux/genhd.h> 2022-03-16 14:23:46 +01:00
ioctl.c block: add check that partition length needs to be aligned with block size 2024-01-25 14:52:48 -08:00
ioprio.c block: fix default IO priority handling again 2022-08-11 13:07:50 +02:00
Kconfig SCSI misc on 20210902 2021-09-02 15:09:46 -07:00
Kconfig.iosched
keyslot-manager.c blk-crypto: make blk_crypto_evict_key() more robust 2023-05-11 23:00:16 +09:00
kyber-iosched.c kyber: avoid q->disk dereferences in trace points 2021-10-15 21:02:57 -06:00
Makefile block: move CONFIG_BLOCK guard to top Makefile 2022-12-14 11:37:30 +01:00
mq-deadline.c block: mq-deadline: Rename deadline_is_seq_writes() 2023-01-24 07:22:49 +01:00
opal_proto.h
sed-opal.c block: sed-opal: kmalloc the cmd/resp buffers 2022-11-26 09:24:35 +01:00
t10-pi.c