Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2913932rwb; Fri, 9 Dec 2022 07:47:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf73BJ0yygt3MRee30As1LfHtpfWTUoeRoRxsLhAs2PkEfa3cIgzaZmK7VcT6ljiR9n5JESp X-Received: by 2002:a17:906:a085:b0:7ad:a42f:72c2 with SMTP id q5-20020a170906a08500b007ada42f72c2mr6255805ejy.35.1670600878708; Fri, 09 Dec 2022 07:47:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670600878; cv=none; d=google.com; s=arc-20160816; b=gTJA+qYmXENk4n2iGvIACYGjUav0mnHdRP0IMFzSBrp05T+pXZU2XcQGp7ocrVegJC He26YEidHJ9lwXmjC2PCJLDr30e1x0fnOmcE3L7GYb/uFgHfRxlT6W0ahsyQ1oQ/HXlD C5sDzmSvXen7jYtJtWNnBURKjUfT2N+tbP33j3EL6QVUQGeZsK4CpYdk/4V7ppdWJ2kr tXYne7pPajwnDLKmyvyqIy08fGG4C2kfAEp06d80u5MBa4ZkfSMUNMCP+LWpTKlonciU vDMyVnv636+Ot4T4/oM1dU2riWbVGfgloXnXRP7NOeeMm60OPRKpwELOGIfybFkIjiZq 3eUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=T5KT6Auu94HJGq65sn5VmhXW8yJRnWzEtldTHa29AT0=; b=fzNB+ZRDJVtQRa4pSfp6sGbuBcLiZK2iMCYxKxVyreg8VQ1CCc5h83WuNOCdaoajKa ufZdWra5bqkW/LSRn4WqP9GD3Vb6SWFDoJ5nROzVYjmtHSYXEWWhdJ5vhkI1RjGsIDfs Ho52hM6o541WNi6eMPgiczxaRfPdOjNO9v72SuGSWShr0luAVI71FbfY45d3wNwSahQt W8BsfQYbw3q0B5uKHBm2BuYx5VnBt/AP8Wi0t2ZrOTjKefmkHOojFMkWpVSFE21zbkJz i6+Pju3GXztzahiOfZGCFpxnLBwMSxDRpR+fgUZRD+6j6qF+Ykvopd2ncIZl3TxUH9gu DHSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linbit-com.20210112.gappssmtp.com header.s=20210112 header.b=qH3VWd11; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb18-20020a1709077e9200b007c07e00f443si43187ejc.945.2022.12.09.07.47.40; Fri, 09 Dec 2022 07:47:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linbit-com.20210112.gappssmtp.com header.s=20210112 header.b=qH3VWd11; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230064AbiLIOyD (ORCPT + 75 others); Fri, 9 Dec 2022 09:54:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229885AbiLIOxj (ORCPT ); Fri, 9 Dec 2022 09:53:39 -0500 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3EBB5FBBA for ; Fri, 9 Dec 2022 06:53:38 -0800 (PST) Received: by mail-ej1-x632.google.com with SMTP id n20so12153456ejh.0 for ; Fri, 09 Dec 2022 06:53:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linbit-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T5KT6Auu94HJGq65sn5VmhXW8yJRnWzEtldTHa29AT0=; b=qH3VWd11DupxgvhV7pRjAnxBZRPHRVTf98egvIoxinGVQRaCd3ZF6czmLJrKGMYXsB RPHSkdAu9kOeJaTYhohXQXSGeMniGLXhcla20EEwDNTC1pwXdIdgGpwsv7c5MUKiVfJ4 R1VvZPx8vqt/LI+/3wwHRHtRFyTNoI0svx/XUBUrBuvjF/bzvA/Y6OWRrm0xZtMvR/F+ GYGXyzCyfra0P4oZkNg1YSYhQYcyfjze8MWS1K+ayD2T8KOWYRpy/oTWm5ghL2KGPbFm OyE/IwQEY7caV74dSK229wiG3ZJJvY53vrA2EAt4e0G0x3uKy7Z06SVhwwjmN7Rh4MdS DY/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T5KT6Auu94HJGq65sn5VmhXW8yJRnWzEtldTHa29AT0=; b=nZJUZGAp6eqaXl121kSOQsfeomV5FFKd4SizaFgTd84JPG3ADa8ZfPCH39SVlyBvgZ TZLjL/eq5BOd0r0fzXMz8JVVk7du2DCSaQ6Fqn9T2vs4neuaQUxuaUcbL65U94JJsaf2 E2MyTpTv7K1UvdCZi5F0aty3I7aLa8Nir2EuxOomB3PWXT4CpP0XE+UJvDT4bLzZA8+8 hzEIn/8PCZm0H2fuZU6LTy+oSywJ93yc50ARHdAQAZt2TAr9A4wwQWCWWq7TpCh9TSK5 nrf2Lw3yLaVMWsMHMl08kHTTsf5DjaOBZi6jdYBSzfMzy4eHw1W+5XRSnF3Rx7LSJ7Wt moow== X-Gm-Message-State: ANoB5pnSaPmZ6w348Vdvk+HSDsK8EqSc1vXQHRSf/gcOWfYLCm924qhw UfAGwKomdIRMeWfysaqRt9MsNg== X-Received: by 2002:a17:906:3a96:b0:78d:f454:ba4a with SMTP id y22-20020a1709063a9600b0078df454ba4amr6226366ejd.73.1670597617418; Fri, 09 Dec 2022 06:53:37 -0800 (PST) Received: from localhost.localdomain (h082218028181.host.wavenet.at. [82.218.28.181]) by smtp.gmail.com with ESMTPSA id bd21-20020a056402207500b0046bb7503d9asm728424edb.24.2022.12.09.06.53.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 06:53:36 -0800 (PST) From: =?UTF-8?q?Christoph=20B=C3=B6hmwalder?= To: Jens Axboe Cc: drbd-dev@lists.linbit.com, linux-kernel@vger.kernel.org, Lars Ellenberg , Philipp Reisner , linux-block@vger.kernel.org, =?UTF-8?q?Christoph=20B=C3=B6hmwalder?= Subject: [PATCH 7/8] drbd: interval tree: make removing an "empty" interval a no-op Date: Fri, 9 Dec 2022 15:53:26 +0100 Message-Id: <20221209145327.2272271-8-christoph.boehmwalder@linbit.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221209145327.2272271-1-christoph.boehmwalder@linbit.com> References: <20221209145327.2272271-1-christoph.boehmwalder@linbit.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lars Ellenberg Trying to remove an "empty" (just initialized, or "cleared") interval from the tree, this results in an endless loop. As we typically protect the tree with a spinlock_irq, the result is a hung system. Be nice to error cleanup code paths, ignore removal of empty intervals. Signed-off-by: Lars Ellenberg Signed-off-by: Christoph Böhmwalder --- drivers/block/drbd/drbd_interval.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/block/drbd/drbd_interval.c b/drivers/block/drbd/drbd_interval.c index 5024ffd6143d..b6aaf0d4d85b 100644 --- a/drivers/block/drbd/drbd_interval.c +++ b/drivers/block/drbd/drbd_interval.c @@ -95,6 +95,10 @@ drbd_contains_interval(struct rb_root *root, sector_t sector, void drbd_remove_interval(struct rb_root *root, struct drbd_interval *this) { + /* avoid endless loop */ + if (drbd_interval_empty(this)) + return; + rb_erase_augmented(&this->rb, root, &augment_callbacks); } -- 2.38.1