From patchwork Fri Apr 27 16:11:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Mahoney X-Patchwork-Id: 10369379 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 890EB601D3 for ; Fri, 27 Apr 2018 16:11:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76C8029489 for ; Fri, 27 Apr 2018 16:11:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 69E372948B; Fri, 27 Apr 2018 16:11:41 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 061BA29489 for ; Fri, 27 Apr 2018 16:11:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758680AbeD0QLF (ORCPT ); Fri, 27 Apr 2018 12:11:05 -0400 Received: from mx2.suse.de ([195.135.220.15]:43971 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758653AbeD0QLC (ORCPT ); Fri, 27 Apr 2018 12:11:02 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CB626ADF5 for ; Fri, 27 Apr 2018 16:11:01 +0000 (UTC) Subject: [PATCH v2] btrfs: qgroup, don't try to insert status item after ENOMEM in rescan worker From: Jeff Mahoney To: dsterba@suse.cz, Nikolay Borisov , linux-btrfs@vger.kernel.org References: <20180426192351.473-1-jeffm@suse.com> <20180426192351.473-3-jeffm@suse.com> <471d8f08-ee33-80c7-67be-d35d5df6f166@suse.com> <20180427154425.GB21272@twin.jikos.cz> Openpgp: preference=signencrypt Message-ID: Date: Fri, 27 Apr 2018 12:11:00 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US 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 If we fail to allocate memory for a path, don't bother trying to insert the qgroup status item. We haven't done anything yet and it'll fail also. Just print an error and be done with it. Signed-off-by: Jeff Mahoney Reviewed-by: David Sterba --- fs/btrfs/qgroup.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 8de423a0c7e3..b795bad54705 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -2648,7 +2648,6 @@ static void btrfs_qgroup_rescan_worker(struct btrfs_work *work) btrfs_end_transaction(trans); } -out: btrfs_free_path(path); mutex_lock(&fs_info->qgroup_rescan_lock); @@ -2684,13 +2683,13 @@ static void btrfs_qgroup_rescan_worker(struct btrfs_work *work) if (btrfs_fs_closing(fs_info)) { btrfs_info(fs_info, "qgroup scan paused"); - } else if (err >= 0) { + err = 0; + } else if (err >= 0) btrfs_info(fs_info, "qgroup scan completed%s", err > 0 ? " (inconsistency flag cleared)" : ""); - } else { +out: + if (err < 0) btrfs_err(fs_info, "qgroup scan failed with %d", err); - } - done: mutex_lock(&fs_info->qgroup_rescan_lock); fs_info->qgroup_rescan_running = false;