Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752602AbdF0O30 (ORCPT ); Tue, 27 Jun 2017 10:29:26 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56330 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752563AbdF0OPD (ORCPT ); Tue, 27 Jun 2017 10:15:03 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Ross Zwisler , Dan Williams , Andrew Morton , Linus Torvalds Subject: [PATCH 4.11 13/58] fs/dax.c: fix inefficiency in dax_writeback_mapping_range() Date: Tue, 27 Jun 2017 16:12:16 +0200 Message-Id: <20170627141113.946129064@linuxfoundation.org> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170627141113.402913097@linuxfoundation.org> References: <20170627141113.402913097@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1150 Lines: 37 4.11-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jan Kara commit 1eb643d02b21412e603b42cdd96010a2ac31c05f upstream. 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. Link: http://lkml.kernel.org/r/20170619124531.21491-1-jack@suse.cz Fixes: 9973c98ecfda3 ("dax: add support for fsync/sync") Signed-off-by: Jan Kara Reviewed-by: Ross Zwisler Cc: Dan Williams Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- fs/dax.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/dax.c +++ b/fs/dax.c @@ -875,6 +875,7 @@ int dax_writeback_mapping_range(struct a if (ret < 0) return ret; } + start_index = indices[pvec.nr - 1] + 1; } return 0; }