From patchwork Sat May 20 08:39:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sargun Dhillon X-Patchwork-Id: 9738523 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 926936034C for ; Sat, 20 May 2017 08:39:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86449285C8 for ; Sat, 20 May 2017 08:39:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79B88285D4; Sat, 20 May 2017 08:39:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0816285C8 for ; Sat, 20 May 2017 08:39:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755634AbdETIjK (ORCPT ); Sat, 20 May 2017 04:39:10 -0400 Received: from mail-io0-f179.google.com ([209.85.223.179]:35519 "EHLO mail-io0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755602AbdETIjG (ORCPT ); Sat, 20 May 2017 04:39:06 -0400 Received: by mail-io0-f179.google.com with SMTP id f102so58713030ioi.2 for ; Sat, 20 May 2017 01:39:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sargun.me; s=google; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=xu/nehGGvuid8mSZr117CXGlhGXWV28/j/TSY8shy7Y=; b=RI6JlT6kdHrZrdIigMNGvWvX71aYMBGW1tONePCoqdcV/q2pX5KFvgqwaQ9kfCXgtr FLuJ5zxIXqkMnrI5qs7GUJqg4GEAH2l++d81J0j6scPfg+0DGMcCUpdW/k2vNIgwumKd JbjHni5RURj4Ua19C6WzSVJO2Bb4yu0h4Tls4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=xu/nehGGvuid8mSZr117CXGlhGXWV28/j/TSY8shy7Y=; b=lsUIAB+xJaNsSq3KGRvu1db878Gn9YDFPrY68DCd7TIjpd9WxNicfUWjqyHBilYzSW e3g+l3zyUgR2/6+ulqVhjdv8dSRTVvAhzBKkXHwXv0SuylP9MfOtecC2RS0EVTCgfKVz WafvxQWd1UiuSYxkYHgXiUFX1WqyjI9vHdrTbYsIxtqth8kOV26kQ9oqQGBMNEwlYhu5 AEraLsptD4VFIhdrxeKXtLsqKHR1emg7z4yFyBgUxyENtZL4X8lamfbvSirmJKjv30nX TjBF4SCKDriHpYWfM6+J8kolWNTZbd9fIkI/LU9/TqMwm666yryVLkeO/0oqUAFS78+N Mh0g== X-Gm-Message-State: AODbwcCv+iZS9H1bHnKqb//TTy+AjaWbVNRhSJYxo3dJlGTP6wGf5Mqm wpaYeC2RbpwcW/Elkm+YyA== X-Received: by 10.107.161.19 with SMTP id k19mr14455801ioe.204.1495269544985; Sat, 20 May 2017 01:39:04 -0700 (PDT) Received: from ircssh-2.c.rugged-nimbus-611.internal (80.60.198.104.bc.googleusercontent.com. [104.198.60.80]) by smtp.gmail.com with ESMTPSA id l19sm5056789ioe.3.2017.05.20.01.39.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 May 2017 01:39:04 -0700 (PDT) Date: Sat, 20 May 2017 08:39:03 +0000 From: Sargun Dhillon To: linux-btrfs@vger.kernel.org Subject: [PATCH 2/8] btrfs: Fail on removing qgroup if del_qgroup_item fails Message-ID: <20170520083902.GA4204@ircssh-2.c.rugged-nimbus-611.internal> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Previously, we were calling del_qgroup_item, and ignoring the return code resulting in a potential to have divergent in-memory state without an error. Perhaps, it makes sense to handle this error code, and put the filesystem into a read only, or similar state. This patch only adds reporting of the error. Signed-off-by: Sargun Dhillon --- fs/btrfs/qgroup.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index a2add44..7e772ba 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -1303,6 +1303,8 @@ static int __btrfs_remove_qgroup(struct btrfs_trans_handle *trans, return -EBUSY; ret = del_qgroup_item(trans, quota_root, qgroupid); + if (ret) + goto out; while (!list_empty(&qgroup->groups)) { list = list_first_entry(&qgroup->groups,