From patchwork Fri Jul 14 15:12:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sargun Dhillon X-Patchwork-Id: 9841291 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 DFF8B602BD for ; Fri, 14 Jul 2017 15:12:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D05D528542 for ; Fri, 14 Jul 2017 15:12:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C56A828750; Fri, 14 Jul 2017 15:12:48 +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 5429328542 for ; Fri, 14 Jul 2017 15:12:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754474AbdGNPMq (ORCPT ); Fri, 14 Jul 2017 11:12:46 -0400 Received: from mail-it0-f51.google.com ([209.85.214.51]:34920 "EHLO mail-it0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754215AbdGNPMp (ORCPT ); Fri, 14 Jul 2017 11:12:45 -0400 Received: by mail-it0-f51.google.com with SMTP id v202so23234413itb.0 for ; Fri, 14 Jul 2017 08:12:45 -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:references:mime-version :content-disposition:in-reply-to:user-agent; bh=1oTI5OhGB0Nwtlqh6Oi11Z+in8xsLEkHdihFmUZvjg0=; b=QAH+oP+uT3TYeS2kL6sqL6EKoanUVoY6q2cFKePNbYoWg+3XnNMy5NahMThthtS+Po vUmo58BbUBMt5Cb80SHBJXjBHeAVAQMidhk6kfQuSu5mnxzRp37NurxqpXwOCAV/E1Fq 5810jkIrGkiy3Jk4U7NZNiB+Pi2mfyYZ6q0v8= 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=1oTI5OhGB0Nwtlqh6Oi11Z+in8xsLEkHdihFmUZvjg0=; b=Euv9CbAGFVZITwnoZvTMm47BEL1Cm4xBjCvaWT/r6N/Y+nckOJ5hBSyk47rZwbjLay RbYYHAa/0Fk4DAysb+xPTsqP2oGdZ8c0Zy41I8Xq574bDcWQkfUvpgRrtZi7yth63wIf k6ZE8eTGrGQy5A/xG8+tN43lqlQSL9YTJAoI4HS6FiVuBVI5AbwPtQomhL9YgI18SL1G QzjApLRAu2t1aVTp0biV/wxShjucT2OMMunjQW2Q/68SoRDb0cUM/g4qe09Nu4VDT4Zy iivCJAhbQBwOxBb2efmhvWM+5wBZD8cq2o8ihlvBVuiZ1OEG+rECSjVvJqsEi+PKsVoH 91Dw== X-Gm-Message-State: AIVw111BmlxnxmHhAX0mAm29tCH5dLEVbLtCx2ZjKjRres5Udn1V8/ua RTlGwrhPRCF6Q+hsnNX9lQ== X-Received: by 10.36.185.26 with SMTP id w26mr3942704ite.122.1500045164439; Fri, 14 Jul 2017 08:12:44 -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 202sm1374421itx.24.2017.07.14.08.12.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jul 2017 08:12:43 -0700 (PDT) Date: Fri, 14 Jul 2017 15:12:41 +0000 From: Sargun Dhillon To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz, quwenruo@cn.fujitsu.com Subject: [PATCH v3 1/2] btrfs: Fail on removing qgroup if del_qgroup_item fails Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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 --- fs/btrfs/qgroup.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 4ce351e..3abc517 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -1309,6 +1309,9 @@ 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, struct btrfs_qgroup_list, next_group);