From patchwork Sun Sep 17 09:02:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sargun Dhillon X-Patchwork-Id: 9954685 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 34E3E60208 for ; Sun, 17 Sep 2017 09:03:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2590628B96 for ; Sun, 17 Sep 2017 09:03:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A7F928B9A; Sun, 17 Sep 2017 09:03:46 +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 F120628B96 for ; Sun, 17 Sep 2017 09:03:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750803AbdIQJCd (ORCPT ); Sun, 17 Sep 2017 05:02:33 -0400 Received: from mail-it0-f42.google.com ([209.85.214.42]:54419 "EHLO mail-it0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750761AbdIQJCc (ORCPT ); Sun, 17 Sep 2017 05:02:32 -0400 Received: by mail-it0-f42.google.com with SMTP id e134so6777950ite.3 for ; Sun, 17 Sep 2017 02:02:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sargun.me; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=AOvXLuKxuTX2PKsDefGjxAzgd17EWUDFpcl1ZHhwgrQ=; b=RSKRuMFgbETH1UCqJAGzCMHSDOZEcoHg/Xm5PLlt3qryps2WDG4cS+4wXVrspJRiFv NudlAqwcMmH+k5OBmmjEocUDXYHHt8IPGiDKuGf6wCT5KbgB7sxEvi8Gc2L6RVjhTURj ab1FHACG0e+5qjMdz4IfJKyi7lYPoIO+5lV9Q= 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:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=AOvXLuKxuTX2PKsDefGjxAzgd17EWUDFpcl1ZHhwgrQ=; b=f7QdVPoVSHbyo5wC4LmC5jasvNo2Gh6VzAKTFJCiJEBeS4mEh0P5Aplbbs1LB9H5rq 0baxe4d4whWUEQlEoXRjfd79oaHadhI/cDitAcXRCH0xm+tM50zDKcy3kuH42zZhXdd4 +rzldSXNz7pn8sbxBcWyHVzi1X6R/lIl5K1Wujn1CvOuMEPAjJSaPP+46qwwCBfreymn PkmGcQ6oHjV6raiy9tbYruJjkTPvSi0Cgpb3AKgx1xpMgderVvJHfb+Sq0TDEI3/K0U6 CFExIhMDsLKU/4eexKM2Xe5QvfGf85KC3HErj9muXxHk5a2x9ZJUYyrYbqgBobdGIYdt 2sxg== X-Gm-Message-State: AHPjjUhIeHvrhpvct4UADJdVYWzAigiWVayLlapsLNSa7nsRRc6ua0A7 4tnYgKOgx/IyRz9WH9SeEg== X-Google-Smtp-Source: AOwi7QB5KBjNAGnEzNtdmvefRf4Ulm2E31gsxfRcF4d2Uyw7tkNmNn4orMPd+e1IfOsZzVyGShdzyA== X-Received: by 10.36.196.84 with SMTP id v81mr9255837itf.142.1505638951234; Sun, 17 Sep 2017 02:02:31 -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 v25sm793168iov.41.2017.09.17.02.02.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Sep 2017 02:02:30 -0700 (PDT) Date: Sun, 17 Sep 2017 09:02:29 +0000 From: Sargun Dhillon To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz, quwenruo@cn.fujitsu.com Subject: [PATCH] btrfs: Report error on removing qgroup if del_qgroup_item fails Message-ID: <20170917090226.GA30640@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 if the error is fatal, (any error other than qgroup not found). Signed-off-by: Sargun Dhillon Reviewed-by: Qu Wenruo --- fs/btrfs/qgroup.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 770f667269f5..e172d4843eae 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -1305,6 +1305,8 @@ int btrfs_remove_qgroup(struct btrfs_trans_handle *trans, } } ret = del_qgroup_item(trans, quota_root, qgroupid); + if (ret && ret != -ENOENT) + goto out; while (!list_empty(&qgroup->groups)) { list = list_first_entry(&qgroup->groups,