From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753476AbcG3VCa (ORCPT ); Sat, 30 Jul 2016 17:02:30 -0400 Received: from mail.kernel.org ([198.145.29.136]:34482 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753145AbcG3VCU (ORCPT ); Sat, 30 Jul 2016 17:02:20 -0400 Date: Sat, 30 Jul 2016 14:02:16 -0700 From: Shaohua Li To: ZhengYuan Liu Cc: neilb@suse.com, liuzhengyuang521@gmail.com, linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] raid5: fix incorrectly counter of conf->empty_inactive_list_nr Message-ID: <20160730210216.GC9149@kernel.org> References: <1469686934-1937-1-git-send-email-liuzhengyuan@kylinos.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1469686934-1937-1-git-send-email-liuzhengyuan@kylinos.cn> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 28, 2016 at 02:22:14PM +0800, ZhengYuan Liu wrote: > The counter conf->empty_inactive_list_nr is only used for determine if the > raid5 is congested which is deal with in function raid5_congested(). > It was increased in get_free_stripe() when conf->inactive_list got to be > empty and decreased in release_inactive_stripe_list() when splice > temp_inactive_list to conf->inactive_list. However, this may have a > problem when raid5_get_active_stripe or stripe_add_to_batch_list was called, > because these two functions may call list_del_init(&sh->lru) to delete sh from > "conf->inactive_list + hash" which may cause "conf->inactive_list + hash" to > be empty when atomic_inc_not_zero(&sh->count) got false. So a check should be > done at these two point and increase empty_inactive_list_nr accordingly. > Otherwise the counter may get to be negative number which would influence > async readahead from VFS. > > Signed-off-by: ZhengYuan Liu Applied, thanks!