From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750797AbWHXHUV (ORCPT ); Thu, 24 Aug 2006 03:20:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750738AbWHXHUU (ORCPT ); Thu, 24 Aug 2006 03:20:20 -0400 Received: from ns2.suse.de ([195.135.220.15]:63929 "EHLO mx2.suse.de") by vger.kernel.org with ESMTP id S1750791AbWHXHUS (ORCPT ); Thu, 24 Aug 2006 03:20:18 -0400 From: NeilBrown To: Andrew Morton Date: Thu, 24 Aug 2006 17:20:18 +1000 Message-Id: <1060824072018.14153@suse.de> X-face: [Gw_3E*Gng}4rRrKRYotwlE?.2|**#s9D Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org If we - shut down a clean array, - restart with one (or more) drive(s) missing - make some changes - pause, so that they array gets marked 'clean', the event count on the superblock of included drives will be the same as that of the removed drives. So adding the removed drive back in will cause it to be included with no resync. To avoid this, we only update the eventcount backwards when the array is not degraded. In this case there can (should) be no non-connected drives that we can get confused with, and this is the particular case where updating-backwards is valuable. Signed-off-by: Neil Brown ### Diffstat output ./drivers/md/md.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff .prev/drivers/md/md.c ./drivers/md/md.c --- .prev/drivers/md/md.c 2006-08-24 17:03:33.000000000 +1000 +++ ./drivers/md/md.c 2006-08-24 17:03:47.000000000 +1000 @@ -1597,6 +1597,19 @@ void md_update_sb(mddev_t * mddev) repeat: spin_lock_irq(&mddev->write_lock); + + if (mddev->degraded && mddev->sb_dirty == 3) + /* If the array is degraded, then skipping spares is both + * dangerous and fairly pointless. + * Dangerous because a device that was removed from the array + * might have a event_count that still looks up-to-date, + * so it can be re-added without a resync. + * Pointless because if there are any spares to skip, + * then a recovery will happen and soon that array won't + * be degraded any more and the spare can go back to sleep then. + */ + mddev->sb_dirty = 1; + sync_req = mddev->in_sync; mddev->utime = get_seconds(); if (mddev->sb_dirty == 3)