diff mbox

dax: Fix inefficiency in dax_writeback_mapping_range()

Message ID 20170619124531.21491-1-jack@suse.cz (mailing list archive)
State Accepted
Commit 1eb643d02b21
Headers show

Commit Message

Jan Kara June 19, 2017, 12:45 p.m. UTC
dax_writeback_mapping_range() fails to update iteration index when
searching radix tree for entries needing cache flushing. Thus each
pagevec worth of entries is searched starting from the start which is
inefficient and prone to livelocks. Update index properly.

CC: stable@vger.kernel.org
Fixes: 9973c98ecfda3a1dfcab981665b5f1e39bcde64a
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/dax.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Ross Zwisler June 19, 2017, 4:34 p.m. UTC | #1
On Mon, Jun 19, 2017 at 02:45:31PM +0200, Jan Kara wrote:
> dax_writeback_mapping_range() fails to update iteration index when
> searching radix tree for entries needing cache flushing. Thus each
> pagevec worth of entries is searched starting from the start which is
> inefficient and prone to livelocks. Update index properly.
> 
> CC: stable@vger.kernel.org
> Fixes: 9973c98ecfda3a1dfcab981665b5f1e39bcde64a
> Signed-off-by: Jan Kara <jack@suse.cz>

Yep, this seems good, thanks.

Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
diff mbox

Patch

diff --git a/fs/dax.c b/fs/dax.c
index 2a6889b3585f..9187f3b07f3e 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -859,6 +859,7 @@  int dax_writeback_mapping_range(struct address_space *mapping,
 			if (ret < 0)
 				goto out;
 		}
+		start_index = indices[pvec.nr - 1] + 1;
 	}
 out:
 	put_dax(dax_dev);