Skip to content

Commit f9ed72d

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe: "Two fixes in this pull request: - The writeback regression fix from Tejun, which has been weeks in the making. This fixes a case where we would sometimes not issue writeback when we should have. - An older fix for a memory corruption issue in mtip32xx. It was deferred since we wanted a better fix for this (driver should not have to handle that case), but given the timing, it's better to put the simple fix in for 4.2 release" * 'for-linus' of git://git.kernel.dk/linux-block: mtip32x: fix regression introduced by blk-mq per-hctx flush writeback: sync_inodes_sb() must write out I_DIRTY_TIME inodes and always call wait_sb_inodes()
2 parents f5db4b3 + 74c9c91 commit f9ed72d

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

drivers/block/mtip32xx/mtip32xx.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3756,6 +3756,14 @@ static int mtip_init_cmd(void *data, struct request *rq, unsigned int hctx_idx,
37563756
struct mtip_cmd *cmd = blk_mq_rq_to_pdu(rq);
37573757
u32 host_cap_64 = readl(dd->mmio + HOST_CAP) & HOST_CAP_64;
37583758

3759+
/*
3760+
* For flush requests, request_idx starts at the end of the
3761+
* tag space. Since we don't support FLUSH/FUA, simply return
3762+
* 0 as there's nothing to be done.
3763+
*/
3764+
if (request_idx >= MTIP_MAX_COMMAND_SLOTS)
3765+
return 0;
3766+
37593767
cmd->command = dmam_alloc_coherent(&dd->pdev->dev, CMD_DMA_ALLOC_SZ,
37603768
&cmd->command_dma, GFP_KERNEL);
37613769
if (!cmd->command)

fs/fs-writeback.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -844,14 +844,15 @@ static void bdi_split_work_to_wbs(struct backing_dev_info *bdi,
844844
struct wb_iter iter;
845845

846846
might_sleep();
847-
848-
if (!bdi_has_dirty_io(bdi))
849-
return;
850847
restart:
851848
rcu_read_lock();
852849
bdi_for_each_wb(wb, bdi, &iter, next_blkcg_id) {
853-
if (!wb_has_dirty_io(wb) ||
854-
(skip_if_busy && writeback_in_progress(wb)))
850+
/* SYNC_ALL writes out I_DIRTY_TIME too */
851+
if (!wb_has_dirty_io(wb) &&
852+
(base_work->sync_mode == WB_SYNC_NONE ||
853+
list_empty(&wb->b_dirty_time)))
854+
continue;
855+
if (skip_if_busy && writeback_in_progress(wb))
855856
continue;
856857

857858
base_work->nr_pages = wb_split_bdi_pages(wb, nr_pages);
@@ -899,8 +900,7 @@ static void bdi_split_work_to_wbs(struct backing_dev_info *bdi,
899900
{
900901
might_sleep();
901902

902-
if (bdi_has_dirty_io(bdi) &&
903-
(!skip_if_busy || !writeback_in_progress(&bdi->wb))) {
903+
if (!skip_if_busy || !writeback_in_progress(&bdi->wb)) {
904904
base_work->auto_free = 0;
905905
base_work->single_wait = 0;
906906
base_work->single_done = 0;
@@ -2275,8 +2275,12 @@ void sync_inodes_sb(struct super_block *sb)
22752275
};
22762276
struct backing_dev_info *bdi = sb->s_bdi;
22772277

2278-
/* Nothing to do? */
2279-
if (!bdi_has_dirty_io(bdi) || bdi == &noop_backing_dev_info)
2278+
/*
2279+
* Can't skip on !bdi_has_dirty() because we should wait for !dirty
2280+
* inodes under writeback and I_DIRTY_TIME inodes ignored by
2281+
* bdi_has_dirty() need to be written out too.
2282+
*/
2283+
if (bdi == &noop_backing_dev_info)
22802284
return;
22812285
WARN_ON(!rwsem_is_locked(&sb->s_umount));
22822286

0 commit comments

Comments
 (0)