From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750942AbcEHWMd (ORCPT ); Sun, 8 May 2016 18:12:33 -0400 Received: from mail.kernel.org ([198.145.29.136]:42246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750822AbcEHWMc (ORCPT ); Sun, 8 May 2016 18:12:32 -0400 Date: Sun, 8 May 2016 15:12:27 -0700 From: Shaohua Li To: Guoqing Jiang Cc: neilb@suse.de, linux-raid@vger.kernel.org, Martin Kepplinger , Andrew Morton , Denys Vlasenko , Sasha Levin , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] md: set MD_CHANGE_PENDING in a atomic region Message-ID: <20160508221227.GA2271@kernel.org> References: <1462328535-22566-1-git-send-email-gqjiang@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1462328535-22566-1-git-send-email-gqjiang@suse.com> 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 Tue, May 03, 2016 at 10:22:13PM -0400, Guoqing Jiang wrote: > Some code waits for a metadata update by: > > 1. flagging that it is needed (MD_CHANGE_DEVS or MD_CHANGE_CLEAN) > 2. setting MD_CHANGE_PENDING and waking the management thread > 3. waiting for MD_CHANGE_PENDING to be cleared > > If the first two are done without locking, the code in md_update_sb() > which checks if it needs to repeat might test if an update is needed > before step 1, then clear MD_CHANGE_PENDING after step 2, resulting > in the wait returning early. > > So make sure all places that set MD_CHANGE_PENDING are atomicial, and > bit_clear_unless (suggested by Neil) is introduced for the purpose. Applied the 3, thanks!