Skip to content

Commit 709192d

Browse files
hoeppnerjaxboe
authored andcommitted
s390/dasd: Fix zero write for FBA devices
A discard request that writes zeros using the global kernel internal ZERO_PAGE will fail for machines with more than 2GB of memory due to the location of the ZERO_PAGE. Fix this by using a driver owned global zero page allocated with GFP_DMA flag set. Fixes: 28b841b ("s390/dasd: Add discard support for FBA devices") Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com> Reviewed-by: Stefan Haberland <sth@linux.ibm.com> Cc: <stable@vger.kernel.org> # 4.14+ Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent fd04358 commit 709192d

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

drivers/s390/block/dasd_fba.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
MODULE_LICENSE("GPL");
4141

4242
static struct dasd_discipline dasd_fba_discipline;
43+
static void *dasd_fba_zero_page;
4344

4445
struct dasd_fba_private {
4546
struct dasd_fba_characteristics rdc_data;
@@ -270,7 +271,7 @@ static void ccw_write_zero(struct ccw1 *ccw, int count)
270271
ccw->cmd_code = DASD_FBA_CCW_WRITE;
271272
ccw->flags |= CCW_FLAG_SLI;
272273
ccw->count = count;
273-
ccw->cda = (__u32) (addr_t) page_to_phys(ZERO_PAGE(0));
274+
ccw->cda = (__u32) (addr_t) dasd_fba_zero_page;
274275
}
275276

276277
/*
@@ -830,6 +831,11 @@ dasd_fba_init(void)
830831
int ret;
831832

832833
ASCEBC(dasd_fba_discipline.ebcname, 4);
834+
835+
dasd_fba_zero_page = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
836+
if (!dasd_fba_zero_page)
837+
return -ENOMEM;
838+
833839
ret = ccw_driver_register(&dasd_fba_driver);
834840
if (!ret)
835841
wait_for_device_probe();
@@ -841,6 +847,7 @@ static void __exit
841847
dasd_fba_cleanup(void)
842848
{
843849
ccw_driver_unregister(&dasd_fba_driver);
850+
free_page((unsigned long)dasd_fba_zero_page);
844851
}
845852

846853
module_init(dasd_fba_init);

0 commit comments

Comments
 (0)