Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp503688ima; Sat, 20 Oct 2018 11:57:50 -0700 (PDT) X-Google-Smtp-Source: ACcGV63WhR0ENmLQjyV/yquyUCa02+gAqIh9TmCo9sIQ6l6UZKYYCGENnF0OrBRMTE7qSwyr7MAU X-Received: by 2002:a62:b209:: with SMTP id x9-v6mr40412667pfe.148.1540061870757; Sat, 20 Oct 2018 11:57:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540061870; cv=none; d=google.com; s=arc-20160816; b=UvbCWLcOGL3yrpY9h5yFilLHmvU8WDMbG35wfio/+Hlw6zMeKruquWc1y26Cn9/LzW Iz12JG3VrSnI+DojzcI8qCo/mWJVLxIRmCnd0jl24J9Dbhgvj6zKMfMJNgjJY5BB4llh Ph0QVX/MlwJzmafopEqIlT28RSQoO5LRSzQK5IY0V1eVthhRGjUkS+6T1ptGviGVZd58 3kgVYlyHLIwgHV8wC63fS3h784krbTs0MdN30Y3tBABxXZou4uxd+NKREbuW2WoBeiMZ jLCEPwWEu8MoIz0tyruKbayodauSs6afadBgXjKVT/FAuEd0VqMcrc8mF/0LHnsrfMFM vbwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=L0Pq2h/W1f/KYzbrrTowNUuevgyASLGv6InK8Va0E1U=; b=awbWgwSAT6m5z97W4ovsAETUm9m81fFOkYAGBGKOoRHVZ3w6KSNW078dVMZwsFx8Xq P7QEIw5qdZEIyOfisw27rBbKcX2c4ALCDxKg5O3dBHwm4zBb1XRU4+VxEYcrTDaQVYHi 900ugXmdMmo/jMSwL39ItWENEBJzwydkfozcYUnn+OBJMRS2z0Ej4al8tgZCmnirw+5U mZGPefiWvyPprI6tdYAwIWwx5tlMPnHXHsnDymW1utk6q7UMzOGbyON8F6Gn+lz58Ek7 oLCOGd+27vvqVOlQqX3L5KSnHhP5CM+1ePUS9LWV3ckktrzYNE0IU5Jp2sWXnYDeymP8 o92g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r15-v6si28375072pgh.88.2018.10.20.11.57.35; Sat, 20 Oct 2018 11:57:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727683AbeJUDHs (ORCPT + 99 others); Sat, 20 Oct 2018 23:07:48 -0400 Received: from mail-yb1-f195.google.com ([209.85.219.195]:35996 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727350AbeJUDHs (ORCPT ); Sat, 20 Oct 2018 23:07:48 -0400 Received: by mail-yb1-f195.google.com with SMTP id w16-v6so1877496ybp.3; Sat, 20 Oct 2018 11:56:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=L0Pq2h/W1f/KYzbrrTowNUuevgyASLGv6InK8Va0E1U=; b=ewQOpztj2I0W0+6wPbNGobLJiJAII8mINwrQXZyIxwnKMSxYYL0iey0raX+qNVt9YW 5tt8rWTqCh/DoNFcyEDOpTFJaK0pd28OnE/FO/5Vpw64tS8/wIPAL4G+vgDLumXcrciR byA89Mrld5iT82uGk2WgBYN43BlfhKxxX3H8VthPk5WRggxaatvcBmnXPqbMErl3soEF hJUN4VZdxHGB5Bhw0nBN43gWI2MclWpNkZTxLpBdQ9xwpmmEiO5oNjSb3tsVqW4kS6JD SEBOqD/13lKhEOcs50o+SdwvnrMRAZAIIZTpkqbhhJFvgAPHxaScYKPfDxNjJrBEbRX4 VkrQ== X-Gm-Message-State: ABuFfoi+onzAUoD3iW3h+Kkq9Y/f7Ub5gryrHlvqp4a1ZgVrsxgNErfg /ZqG2wzdL9Lg/EMJdxPDU7g= X-Received: by 2002:a25:bd05:: with SMTP id f5-v6mr6303567ybk.415.1540061785660; Sat, 20 Oct 2018 11:56:25 -0700 (PDT) Received: from dennisz-mbp.thefacebook.com ([199.201.65.3]) by smtp.gmail.com with ESMTPSA id h63-v6sm1977456ywb.110.2018.10.20.11.56.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 20 Oct 2018 11:56:24 -0700 (PDT) From: Dennis Zhou To: Jens Axboe Cc: Tejun Heo , Valdis Kletnieks , kernel-team@fb.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Dennis Zhou Subject: [PATCH 1/2] blkcg: fix edge case for blk_get_rl() under memory pressure Date: Sat, 20 Oct 2018 14:56:11 -0400 Message-Id: <20181020185612.51587-2-dennis@kernel.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20181020185612.51587-1-dennis@kernel.org> References: <20181020185612.51587-1-dennis@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is possible for blkg creation to fail when in blk_get_rl(). In this situation, the fallback logic returns the nearest created blkg. There is however special handling for the request_list for the root blkcg. This fixes the missing edge case from the earlier series changing blk_get_rl(). Fixes: e2b0989954ae ("blkcg: cleanup and make blk_get_rl use blkg_lookup_create") Signed-off-by: Dennis Zhou --- include/linux/blk-cgroup.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index b7fd08013de2..1e76ceebeb5d 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h @@ -597,7 +597,7 @@ static inline struct request_list *blk_get_rl(struct request_queue *q, if (unlikely(!blkg)) blkg = __blkg_lookup_create(blkcg, q); - if (!blkg_tryget(blkg)) + if (blkg->blkcg == &blkcg_root || !blkg_tryget(blkg)) goto rl_use_root; rcu_read_unlock(); -- 2.17.1