From patchwork Wed Mar 6 08:57:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 2224051 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 801AEDF23A for ; Wed, 6 Mar 2013 08:58:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753378Ab3CFI6C (ORCPT ); Wed, 6 Mar 2013 03:58:02 -0500 Received: from mail-la0-f52.google.com ([209.85.215.52]:48159 "EHLO mail-la0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750816Ab3CFI6B (ORCPT ); Wed, 6 Mar 2013 03:58:01 -0500 Received: by mail-la0-f52.google.com with SMTP id fs12so7176424lab.11 for ; Wed, 06 Mar 2013 00:57:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=Mouu9YWzyHQO2bPCs5e9wyLEBquKQvL5X0njicU15v4=; b=SX7ji7fv2D9Ts9Th1+/7OKVSGqvNHtPnFW7qRHmok3OeG+VkaSS0rwShO/uu+Euc4z J09lE2We2jY3kNkkfN8D7ZLFu5emWF1G6H3fnKs4I8jimvROlQFjfBaDl3hRyiXLNYE7 AhZUVKwaPHFvyJMFKKOElnWdCcLTwP/5K5Rd8bQBg5Ruesb+v86w879y0bjP6Rqn5clo e8I9PbqNQ1SkqTSiPxv55iyeuxoKX03Z+bISjL6F+41qI6tfNKLma9GrwUAOdV4B3veu aVRfs48z4AF2tJO0ZU9nl4IANzLD6jAptmUt486a+lFJh2lKoiPfzn8k4F4vtWHQxInq fjXQ== X-Received: by 10.112.8.233 with SMTP id u9mr7187161lba.97.1362560279455; Wed, 06 Mar 2013 00:57:59 -0800 (PST) Received: from localhost ([109.110.94.35]) by mx.google.com with ESMTPS id m1sm9497516lbh.5.2013.03.06.00.57.57 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 06 Mar 2013 00:57:58 -0800 (PST) From: Ilya Dryomov To: linux-btrfs@vger.kernel.org Cc: Chris Mason , David Sterba , idryomov@gmail.com Subject: [PATCH] Btrfs: fix a mismerge in btrfs_balance() Date: Wed, 6 Mar 2013 10:57:55 +0200 Message-Id: <1362560275-3223-1-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 1.7.9.1 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Raid56 merge (merge commit e942f88) had mistakenly removed a call to __cancel_balance(), which resulted in balance not cleaning up after itself after a successful finish. (Cleanup includes switching the state, removing the balance item and releasing mut_ex_op testnset lock.) Bring it back. Reported-by: David Sterba Signed-off-by: Ilya Dryomov Reviewed-by: Liu Bo --- fs/btrfs/volumes.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 35bb2d4..33440da 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -3230,6 +3230,11 @@ int btrfs_balance(struct btrfs_balance_control *bctl, update_ioctl_balance_args(fs_info, 0, bargs); } + if ((ret && ret != -ECANCELED && ret != -ENOSPC) || + balance_need_close(fs_info)) { + __cancel_balance(fs_info); + } + wake_up(&fs_info->balance_wait_q); return ret;