From: Greg Kroah-Hartman Date: Mon, 15 Nov 2021 14:04:11 +0000 (+0100) Subject: drop some block patches from 5.14 and 5.10 X-Git-Tag: v5.4.160~49 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6d8312c4a052e6da830bf057550d3fc08f139646;p=thirdparty%2Fkernel%2Fstable-queue.git drop some block patches from 5.14 and 5.10 --- diff --git a/queue-5.10/block-hold-invalidate_lock-in-blkdiscard-ioctl.patch b/queue-5.10/block-hold-invalidate_lock-in-blkdiscard-ioctl.patch deleted file mode 100644 index 1284ecb185b..00000000000 --- a/queue-5.10/block-hold-invalidate_lock-in-blkdiscard-ioctl.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 7607c44c157d343223510c8ffdf7206fdd2a6213 Mon Sep 17 00:00:00 2001 -From: Shin'ichiro Kawasaki -Date: Tue, 9 Nov 2021 19:47:22 +0900 -Subject: block: Hold invalidate_lock in BLKDISCARD ioctl - -From: Shin'ichiro Kawasaki - -commit 7607c44c157d343223510c8ffdf7206fdd2a6213 upstream. - -When BLKDISCARD ioctl and data read race, the data read leaves stale -page cache. To avoid the stale page cache, hold invalidate_lock of the -block device file mapping. The stale page cache is observed when -blktests test case block/009 is repeated hundreds of times. - -This patch can be applied back to the stable kernel version v5.15.y -with slight patch edit. Rework is required for older stable kernels. - -Fixes: 351499a172c0 ("block: Invalidate cache on discard v2") -Signed-off-by: Shin'ichiro Kawasaki -Cc: stable@vger.kernel.org # v5.15 -Reviewed-by: Jan Kara -Link: https://lore.kernel.org/r/20211109104723.835533-2-shinichiro.kawasaki@wdc.com -Signed-off-by: Jens Axboe -Signed-off-by: Greg Kroah-Hartman ---- - block/ioctl.c | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - ---- a/block/ioctl.c -+++ b/block/ioctl.c -@@ -121,6 +121,7 @@ static int blk_ioctl_discard(struct bloc - uint64_t range[2]; - uint64_t start, len; - struct request_queue *q = bdev_get_queue(bdev); -+ struct inode *inode = bdev->bd_inode; - int err; - - if (!(mode & FMODE_WRITE)) -@@ -143,12 +144,17 @@ static int blk_ioctl_discard(struct bloc - if (start + len > i_size_read(bdev->bd_inode)) - return -EINVAL; - -+ filemap_invalidate_lock(inode->i_mapping); - err = truncate_bdev_range(bdev, mode, start, start + len - 1); - if (err) -- return err; -+ goto fail; - -- return blkdev_issue_discard(bdev, start >> 9, len >> 9, -- GFP_KERNEL, flags); -+ err = blkdev_issue_discard(bdev, start >> 9, len >> 9, -+ GFP_KERNEL, flags); -+ -+fail: -+ filemap_invalidate_unlock(inode->i_mapping); -+ return err; - } - - static int blk_ioctl_zeroout(struct block_device *bdev, fmode_t mode, diff --git a/queue-5.10/block-hold-invalidate_lock-in-blkresetzone-ioctl.patch b/queue-5.10/block-hold-invalidate_lock-in-blkresetzone-ioctl.patch deleted file mode 100644 index 7b272279575..00000000000 --- a/queue-5.10/block-hold-invalidate_lock-in-blkresetzone-ioctl.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 86399ea071099ec8ee0a83ac9ad67f7df96a50ad Mon Sep 17 00:00:00 2001 -From: Shin'ichiro Kawasaki -Date: Thu, 11 Nov 2021 17:52:38 +0900 -Subject: block: Hold invalidate_lock in BLKRESETZONE ioctl - -From: Shin'ichiro Kawasaki - -commit 86399ea071099ec8ee0a83ac9ad67f7df96a50ad upstream. - -When BLKRESETZONE ioctl and data read race, the data read leaves stale -page cache. The commit e5113505904e ("block: Discard page cache of zone -reset target range") added page cache truncation to avoid stale page -cache after the ioctl. However, the stale page cache still can be read -during the reset zone operation for the ioctl. To avoid the stale page -cache completely, hold invalidate_lock of the block device file mapping. - -Fixes: e5113505904e ("block: Discard page cache of zone reset target range") -Signed-off-by: Shin'ichiro Kawasaki -Cc: stable@vger.kernel.org # v5.15 -Reviewed-by: Jan Kara -Reviewed-by: Ming Lei -Link: https://lore.kernel.org/r/20211111085238.942492-1-shinichiro.kawasaki@wdc.com -Signed-off-by: Jens Axboe -Signed-off-by: Greg Kroah-Hartman ---- - block/blk-zoned.c | 15 +++++---------- - 1 file changed, 5 insertions(+), 10 deletions(-) - ---- a/block/blk-zoned.c -+++ b/block/blk-zoned.c -@@ -365,9 +365,10 @@ int blkdev_zone_mgmt_ioctl(struct block_ - op = REQ_OP_ZONE_RESET; - - /* Invalidate the page cache, including dirty pages. */ -+ filemap_invalidate_lock(bdev->bd_inode->i_mapping); - ret = blkdev_truncate_zone_range(bdev, mode, &zrange); - if (ret) -- return ret; -+ goto fail; - break; - case BLKOPENZONE: - op = REQ_OP_ZONE_OPEN; -@@ -385,15 +386,9 @@ int blkdev_zone_mgmt_ioctl(struct block_ - ret = blkdev_zone_mgmt(bdev, op, zrange.sector, zrange.nr_sectors, - GFP_KERNEL); - -- /* -- * Invalidate the page cache again for zone reset: writes can only be -- * direct for zoned devices so concurrent writes would not add any page -- * to the page cache after/during reset. The page cache may be filled -- * again due to concurrent reads though and dropping the pages for -- * these is fine. -- */ -- if (!ret && cmd == BLKRESETZONE) -- ret = blkdev_truncate_zone_range(bdev, mode, &zrange); -+fail: -+ if (cmd == BLKRESETZONE) -+ filemap_invalidate_unlock(bdev->bd_inode->i_mapping); - - return ret; - } diff --git a/queue-5.10/block-hold-invalidate_lock-in-blkzeroout-ioctl.patch b/queue-5.10/block-hold-invalidate_lock-in-blkzeroout-ioctl.patch deleted file mode 100644 index 99cdcb82194..00000000000 --- a/queue-5.10/block-hold-invalidate_lock-in-blkzeroout-ioctl.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 35e4c6c1a2fc2eb11b9306e95cda1fa06a511948 Mon Sep 17 00:00:00 2001 -From: Shin'ichiro Kawasaki -Date: Tue, 9 Nov 2021 19:47:23 +0900 -Subject: block: Hold invalidate_lock in BLKZEROOUT ioctl - -From: Shin'ichiro Kawasaki - -commit 35e4c6c1a2fc2eb11b9306e95cda1fa06a511948 upstream. - -When BLKZEROOUT ioctl and data read race, the data read leaves stale -page cache. To avoid the stale page cache, hold invalidate_lock of the -block device file mapping. The stale page cache is observed when -blktests test case block/009 is modified to call "blkdiscard -z" command -and repeated hundreds of times. - -This patch can be applied back to the stable kernel version v5.15.y. -Rework is required for older stable kernels. - -Fixes: 22dd6d356628 ("block: invalidate the page cache when issuing BLKZEROOUT") -Signed-off-by: Shin'ichiro Kawasaki -Cc: stable@vger.kernel.org # v5.15 -Reviewed-by: Jan Kara -Link: https://lore.kernel.org/r/20211109104723.835533-3-shinichiro.kawasaki@wdc.com -Signed-off-by: Jens Axboe -Signed-off-by: Greg Kroah-Hartman ---- - block/ioctl.c | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - ---- a/block/ioctl.c -+++ b/block/ioctl.c -@@ -162,6 +162,7 @@ static int blk_ioctl_zeroout(struct bloc - { - uint64_t range[2]; - uint64_t start, end, len; -+ struct inode *inode = bdev->bd_inode; - int err; - - if (!(mode & FMODE_WRITE)) -@@ -184,12 +185,17 @@ static int blk_ioctl_zeroout(struct bloc - return -EINVAL; - - /* Invalidate the page cache, including dirty pages */ -+ filemap_invalidate_lock(inode->i_mapping); - err = truncate_bdev_range(bdev, mode, start, end); - if (err) -- return err; -+ goto fail; - -- return blkdev_issue_zeroout(bdev, start >> 9, len >> 9, GFP_KERNEL, -- BLKDEV_ZERO_NOUNMAP); -+ err = blkdev_issue_zeroout(bdev, start >> 9, len >> 9, GFP_KERNEL, -+ BLKDEV_ZERO_NOUNMAP); -+ -+fail: -+ filemap_invalidate_unlock(inode->i_mapping); -+ return err; - } - - static int put_ushort(unsigned short __user *argp, unsigned short val) diff --git a/queue-5.14/block-hold-invalidate_lock-in-blkdiscard-ioctl.patch b/queue-5.14/block-hold-invalidate_lock-in-blkdiscard-ioctl.patch deleted file mode 100644 index 4b7c3ce1084..00000000000 --- a/queue-5.14/block-hold-invalidate_lock-in-blkdiscard-ioctl.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 7607c44c157d343223510c8ffdf7206fdd2a6213 Mon Sep 17 00:00:00 2001 -From: Shin'ichiro Kawasaki -Date: Tue, 9 Nov 2021 19:47:22 +0900 -Subject: block: Hold invalidate_lock in BLKDISCARD ioctl - -From: Shin'ichiro Kawasaki - -commit 7607c44c157d343223510c8ffdf7206fdd2a6213 upstream. - -When BLKDISCARD ioctl and data read race, the data read leaves stale -page cache. To avoid the stale page cache, hold invalidate_lock of the -block device file mapping. The stale page cache is observed when -blktests test case block/009 is repeated hundreds of times. - -This patch can be applied back to the stable kernel version v5.15.y -with slight patch edit. Rework is required for older stable kernels. - -Fixes: 351499a172c0 ("block: Invalidate cache on discard v2") -Signed-off-by: Shin'ichiro Kawasaki -Cc: stable@vger.kernel.org # v5.15 -Reviewed-by: Jan Kara -Link: https://lore.kernel.org/r/20211109104723.835533-2-shinichiro.kawasaki@wdc.com -Signed-off-by: Jens Axboe -Signed-off-by: Greg Kroah-Hartman ---- - block/ioctl.c | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - ---- a/block/ioctl.c -+++ b/block/ioctl.c -@@ -112,6 +112,7 @@ static int blk_ioctl_discard(struct bloc - uint64_t range[2]; - uint64_t start, len; - struct request_queue *q = bdev_get_queue(bdev); -+ struct inode *inode = bdev->bd_inode; - int err; - - if (!(mode & FMODE_WRITE)) -@@ -134,12 +135,17 @@ static int blk_ioctl_discard(struct bloc - if (start + len > i_size_read(bdev->bd_inode)) - return -EINVAL; - -+ filemap_invalidate_lock(inode->i_mapping); - err = truncate_bdev_range(bdev, mode, start, start + len - 1); - if (err) -- return err; -+ goto fail; - -- return blkdev_issue_discard(bdev, start >> 9, len >> 9, -- GFP_KERNEL, flags); -+ err = blkdev_issue_discard(bdev, start >> 9, len >> 9, -+ GFP_KERNEL, flags); -+ -+fail: -+ filemap_invalidate_unlock(inode->i_mapping); -+ return err; - } - - static int blk_ioctl_zeroout(struct block_device *bdev, fmode_t mode, diff --git a/queue-5.14/block-hold-invalidate_lock-in-blkresetzone-ioctl.patch b/queue-5.14/block-hold-invalidate_lock-in-blkresetzone-ioctl.patch deleted file mode 100644 index 61a75b986dd..00000000000 --- a/queue-5.14/block-hold-invalidate_lock-in-blkresetzone-ioctl.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 86399ea071099ec8ee0a83ac9ad67f7df96a50ad Mon Sep 17 00:00:00 2001 -From: Shin'ichiro Kawasaki -Date: Thu, 11 Nov 2021 17:52:38 +0900 -Subject: block: Hold invalidate_lock in BLKRESETZONE ioctl - -From: Shin'ichiro Kawasaki - -commit 86399ea071099ec8ee0a83ac9ad67f7df96a50ad upstream. - -When BLKRESETZONE ioctl and data read race, the data read leaves stale -page cache. The commit e5113505904e ("block: Discard page cache of zone -reset target range") added page cache truncation to avoid stale page -cache after the ioctl. However, the stale page cache still can be read -during the reset zone operation for the ioctl. To avoid the stale page -cache completely, hold invalidate_lock of the block device file mapping. - -Fixes: e5113505904e ("block: Discard page cache of zone reset target range") -Signed-off-by: Shin'ichiro Kawasaki -Cc: stable@vger.kernel.org # v5.15 -Reviewed-by: Jan Kara -Reviewed-by: Ming Lei -Link: https://lore.kernel.org/r/20211111085238.942492-1-shinichiro.kawasaki@wdc.com -Signed-off-by: Jens Axboe -Signed-off-by: Greg Kroah-Hartman ---- - block/blk-zoned.c | 15 +++++---------- - 1 file changed, 5 insertions(+), 10 deletions(-) - ---- a/block/blk-zoned.c -+++ b/block/blk-zoned.c -@@ -429,9 +429,10 @@ int blkdev_zone_mgmt_ioctl(struct block_ - op = REQ_OP_ZONE_RESET; - - /* Invalidate the page cache, including dirty pages. */ -+ filemap_invalidate_lock(bdev->bd_inode->i_mapping); - ret = blkdev_truncate_zone_range(bdev, mode, &zrange); - if (ret) -- return ret; -+ goto fail; - break; - case BLKOPENZONE: - op = REQ_OP_ZONE_OPEN; -@@ -449,15 +450,9 @@ int blkdev_zone_mgmt_ioctl(struct block_ - ret = blkdev_zone_mgmt(bdev, op, zrange.sector, zrange.nr_sectors, - GFP_KERNEL); - -- /* -- * Invalidate the page cache again for zone reset: writes can only be -- * direct for zoned devices so concurrent writes would not add any page -- * to the page cache after/during reset. The page cache may be filled -- * again due to concurrent reads though and dropping the pages for -- * these is fine. -- */ -- if (!ret && cmd == BLKRESETZONE) -- ret = blkdev_truncate_zone_range(bdev, mode, &zrange); -+fail: -+ if (cmd == BLKRESETZONE) -+ filemap_invalidate_unlock(bdev->bd_inode->i_mapping); - - return ret; - } diff --git a/queue-5.14/block-hold-invalidate_lock-in-blkzeroout-ioctl.patch b/queue-5.14/block-hold-invalidate_lock-in-blkzeroout-ioctl.patch deleted file mode 100644 index 1c1a28c9991..00000000000 --- a/queue-5.14/block-hold-invalidate_lock-in-blkzeroout-ioctl.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 35e4c6c1a2fc2eb11b9306e95cda1fa06a511948 Mon Sep 17 00:00:00 2001 -From: Shin'ichiro Kawasaki -Date: Tue, 9 Nov 2021 19:47:23 +0900 -Subject: block: Hold invalidate_lock in BLKZEROOUT ioctl - -From: Shin'ichiro Kawasaki - -commit 35e4c6c1a2fc2eb11b9306e95cda1fa06a511948 upstream. - -When BLKZEROOUT ioctl and data read race, the data read leaves stale -page cache. To avoid the stale page cache, hold invalidate_lock of the -block device file mapping. The stale page cache is observed when -blktests test case block/009 is modified to call "blkdiscard -z" command -and repeated hundreds of times. - -This patch can be applied back to the stable kernel version v5.15.y. -Rework is required for older stable kernels. - -Fixes: 22dd6d356628 ("block: invalidate the page cache when issuing BLKZEROOUT") -Signed-off-by: Shin'ichiro Kawasaki -Cc: stable@vger.kernel.org # v5.15 -Reviewed-by: Jan Kara -Link: https://lore.kernel.org/r/20211109104723.835533-3-shinichiro.kawasaki@wdc.com -Signed-off-by: Jens Axboe -Signed-off-by: Greg Kroah-Hartman ---- - block/ioctl.c | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - ---- a/block/ioctl.c -+++ b/block/ioctl.c -@@ -153,6 +153,7 @@ static int blk_ioctl_zeroout(struct bloc - { - uint64_t range[2]; - uint64_t start, end, len; -+ struct inode *inode = bdev->bd_inode; - int err; - - if (!(mode & FMODE_WRITE)) -@@ -175,12 +176,17 @@ static int blk_ioctl_zeroout(struct bloc - return -EINVAL; - - /* Invalidate the page cache, including dirty pages */ -+ filemap_invalidate_lock(inode->i_mapping); - err = truncate_bdev_range(bdev, mode, start, end); - if (err) -- return err; -+ goto fail; - -- return blkdev_issue_zeroout(bdev, start >> 9, len >> 9, GFP_KERNEL, -- BLKDEV_ZERO_NOUNMAP); -+ err = blkdev_issue_zeroout(bdev, start >> 9, len >> 9, GFP_KERNEL, -+ BLKDEV_ZERO_NOUNMAP); -+ -+fail: -+ filemap_invalidate_unlock(inode->i_mapping); -+ return err; - } - - static int put_ushort(unsigned short __user *argp, unsigned short val)