From patchwork Sun Nov 3 17:06:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 3133681 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 23299BEEB2 for ; Sun, 3 Nov 2013 17:07:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 45EB720278 for ; Sun, 3 Nov 2013 17:07:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 656282018E for ; Sun, 3 Nov 2013 17:07:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752926Ab3KCRH0 (ORCPT ); Sun, 3 Nov 2013 12:07:26 -0500 Received: from mail-ee0-f41.google.com ([74.125.83.41]:61551 "EHLO mail-ee0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752683Ab3KCRHV (ORCPT ); Sun, 3 Nov 2013 12:07:21 -0500 Received: by mail-ee0-f41.google.com with SMTP id e53so681517eek.0 for ; Sun, 03 Nov 2013 09:07:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HAKENA6J+Ytd4/CUm8VLeVaWAsCfTZjw2CfAbqXqjjg=; b=EOzEnJOZ1KJU06fRZ7NLAWvv7mPTpognhv1kTzNbTv1E8l9tcVx+k03R2M3CVMZQYX UJndlb0u9qzX+xEnbwwdW5l4Q5YDsriS1tAwLiD9n4hbsX64ZKf4PYffNk/nls4v2IkG Ad7rpxCKQaGHtMCDh6vHE6gzmsaqpk/cSS/TFmIBV1ambS0k2wowyFvdgcETsR7ChrtG LV3lpV0s6R95Mtge9CHNgcV8x3UsplzGPcV6O3z/2wzSn7OIJZQ+IHQB3DAiLUI96j8Y kSyvKw129yAsMr75fQXH28R678cV2BrGEO4fdCIODynoZ6xlbB81iQYOxK0Ez/eW2Fo/ DN8g== X-Received: by 10.14.2.2 with SMTP id 2mr521512eee.92.1383498440303; Sun, 03 Nov 2013 09:07:20 -0800 (PST) Received: from localhost ([109.110.66.69]) by mx.google.com with ESMTPSA id m54sm35560064eex.2.2013.11.03.09.07.19 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 03 Nov 2013 09:07:20 -0800 (PST) From: Ilya Dryomov To: linux-btrfs@vger.kernel.org Cc: Chris Mason , idryomov@gmail.com Subject: [PATCH 3/3] Btrfs: fix __btrfs_start_workers retval Date: Sun, 3 Nov 2013 19:06:40 +0200 Message-Id: <1383498400-21009-3-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1383498400-21009-1-git-send-email-idryomov@gmail.com> References: <1383498400-21009-1-git-send-email-idryomov@gmail.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP __btrfs_start_workers returns 0 in case it raced with btrfs_stop_workers and lost the race. This is wrong because worker in this case is not allowed to start and is in fact destroyed. Return -EINVAL instead. Signed-off-by: Ilya Dryomov --- fs/btrfs/async-thread.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c index 08cc08f..1d5f3d7 100644 --- a/fs/btrfs/async-thread.c +++ b/fs/btrfs/async-thread.c @@ -495,6 +495,7 @@ static int __btrfs_start_workers(struct btrfs_workers *workers) spin_lock_irq(&workers->lock); if (workers->stopping) { spin_unlock_irq(&workers->lock); + ret = -EINVAL; goto fail_kthread; } list_add_tail(&worker->worker_list, &workers->idle_list);