From patchwork Fri May 26 20:44:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sargun Dhillon X-Patchwork-Id: 9751271 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 333CD6032C for ; Sat, 27 May 2017 01:11:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25E9928512 for ; Sat, 27 May 2017 01:11:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23ED92846F; Sat, 27 May 2017 01:11:00 +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 7EE1728485 for ; Sat, 27 May 2017 01:10:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752193AbdE0BKN (ORCPT ); Fri, 26 May 2017 21:10:13 -0400 Received: from mail-io0-f171.google.com ([209.85.223.171]:34323 "EHLO mail-io0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S944931AbdEZUoa (ORCPT ); Fri, 26 May 2017 16:44:30 -0400 Received: by mail-io0-f171.google.com with SMTP id k91so16162111ioi.1 for ; Fri, 26 May 2017 13:44:29 -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=Y4aJfJ/xVvPlJ34SVpV6+qSpAV/mxE8Wl6O/UuMPIhU=; b=ckMuWG+Tfz9DH3OGwm9lkSt0fdjS3X/yKuhKeGRooGbiBsXaaw48O9mw7ZZw+zBht7 FbVhkhMYNjihJ/li28fvnJ3o/N+zlwSgDRAfuUZTogG+N0sNgm0Uy8xj+rmbZvDuITm3 D2KhcFzJK3SVkFCO9MupqE1Tq8mc5ilOgo7zw= 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=Y4aJfJ/xVvPlJ34SVpV6+qSpAV/mxE8Wl6O/UuMPIhU=; b=FCJ2dbkGcKti+opX9rB6Pc2yoN++xuPGtOYVInV/sqIEwbgswmPQhC5LMDjPHCvJmx wygTzGBSvvZIL0QrziwA2Ng3KScJ29bXF5AL06sZLn+3KABKbV5W7qyvF21i2kfOiYCn g97iB52qFB42OsHt/2nbwlvHJdIf7ZaZTaYt6hkfX1BZkttOY7sY+e3bZ5Z2ISYlyvSS D5kxdaUDaS3tBvMGyNLiGo/lXtf2wT7wPIiWZ6712CpXUZglA/hrWbxsp5r5uPnkejSt KXNU+DSdTvi2rTOTvyOhAbWV/MMIF5bfLEp1Wsr41lyMOc7OTbWpg2176gCudc0J4dGX dKmw== X-Gm-Message-State: AODbwcDWlOi049Hz6UimbpjcLux9SxEEhhmJU7t0tWeyLI8AtbS2ijlf PAP9y4fTes6he03GhGvHQw== X-Received: by 10.107.173.16 with SMTP id w16mr3692306ioe.81.1495831469118; Fri, 26 May 2017 13:44:29 -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 82sm765450iok.39.2017.05.26.13.44.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 May 2017 13:44:28 -0700 (PDT) Date: Fri, 26 May 2017 20:44:27 +0000 From: Sargun Dhillon To: linux-btrfs@vger.kernel.org Cc: quwenruo@cn.fujitsu.com, mkh@rqc.ru Subject: [PATCH v2 1/4] btrfs: Fail on removing qgroup if del_qgroup_item fails Message-ID: <20170526204424.GA18188@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 --- fs/btrfs/qgroup.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index deffbeb..d39ffcc 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);