From patchwork Mon Oct 7 14:46:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Pisati X-Patchwork-Id: 1993669 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XMhnT3tWFz1xvL for ; Tue, 8 Oct 2024 01:47:09 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1sxp0m-0001OA-UY; Mon, 07 Oct 2024 14:47:00 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sxp0k-0001Nf-Nk for kernel-team@lists.ubuntu.com; Mon, 07 Oct 2024 14:46:58 +0000 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 8EF4A3F167 for ; Mon, 7 Oct 2024 14:46:58 +0000 (UTC) Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42cb115566eso51235085e9.2 for ; Mon, 07 Oct 2024 07:46:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728312418; x=1728917218; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sOJn6lUNAtIZ8bJufIg7O6Znfn1SgWBTkO2Ni3KB2ZI=; b=Tr3M60nt8hqo7pzOtZ1C2k4sW67QgSc3FNQwwjuvTlS57ropP/JXeQWaiJa/85fCSF FiR9PPNrjpFEsV80TpStVr64/9G8s5AAJG2o57Si6W9Ue41XygAAkTEwa40JU+dZIP3E g5GSSj6H8D0usu+Nkk3xTPLI+iRVHBIUjTuzkDgW37eF7oLK5fB/pqnsOWKZ0Q0k51TO HBx63BkTU2C38OCVtC/q1vBUtUBl4RZZYLFskCPguNnh05BTkZa8P2LOHvgfnX618Q3q G5iDLUM5gYL7PK0iPAi62zAQdssyuXZexbAh1R6wwtX4EUA7q3jNsEBr+Sw7iTFLP2nw trtA== X-Gm-Message-State: AOJu0YyPxKL6saG60e5VpmhCPn/jzr8EISI465VM1NPAdZ7ZPhX9Qm3g 2OPtQoZY3ircSqFYa4vk3JD++OG8wVPY6IT+CkXQGdwiTWox6nHBOk/wgdN/60DYFZmp74fyXdm sZa0KsuXIAXTtehFTcJNSvGoSaSGrMyUBowxstBWhFTxvevXCZnPz5V+os/Vi5khShsioNLqSjj ss56s6ANUY8qT+ X-Received: by 2002:a05:600c:35cf:b0:42c:b62c:9f0d with SMTP id 5b1f17b1804b1-42f85ab87cdmr139619055e9.17.1728312417744; Mon, 07 Oct 2024 07:46:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHsSMukE1wMO1zWxnXpdZyhUla1xcauNSY5px+6Uixb0VqQ2jblA7WJrOHHffOcHIQH/gp2Pg== X-Received: by 2002:a05:600c:35cf:b0:42c:b62c:9f0d with SMTP id 5b1f17b1804b1-42f85ab87cdmr139618735e9.17.1728312417287; Mon, 07 Oct 2024 07:46:57 -0700 (PDT) Received: from canonical.com ([2a01:e11:1403:8620:ecef:de68:2f05:58d8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f86b1d640sm94190115e9.25.2024.10.07.07.46.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 07:46:56 -0700 (PDT) From: Paolo Pisati To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1] block: Fix elv_iosched_local_module handling of "none" scheduler Date: Mon, 7 Oct 2024 16:46:55 +0200 Message-Id: <20241007144655.340877-2-paolo.pisati@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241007144655.340877-1-paolo.pisati@canonical.com> References: <20241007144655.340877-1-paolo.pisati@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Damien Le Moal BugLink: https://bugs.launchpad.net/bugs/2083845 commit e3accac1a976e65491a9b9fba82ce8ddbd3d2389 upstream. Commit 734e1a860312 ("block: Prevent deadlocks when switching elevators") introduced the function elv_iosched_load_module() to allow loading an elevator module outside of elv_iosched_store() with the target device queue not frozen, to avoid deadlocks. However, the "none" scheduler does not have a module and as a result, elv_iosched_load_module() always returns an error when trying to switch to this valid scheduler. Fix this by ignoring the return value of the request_module() call done by elv_iosched_load_module(). This restores the behavior before commit 734e1a860312, which was to ignore the request_module() result and instead rely on elevator_change() to handle the "none" scheduler case. Reported-by: Shin'ichiro Kawasaki Fixes: 734e1a860312 ("block: Prevent deadlocks when switching elevators") Cc: stable@vger.kernel.org Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/20240917133231.134806-1-dlemoal@kernel.org Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 2327c3f9d4f7eac4939bbe2ed3206f3a7dec48e1) Signed-off-by: Paolo Pisati --- block/elevator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block/elevator.c b/block/elevator.c index c355b55d0107..4122026b11f1 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -715,7 +715,9 @@ int elv_iosched_load_module(struct gendisk *disk, const char *buf, strscpy(elevator_name, buf, sizeof(elevator_name)); - return request_module("%s-iosched", strstrip(elevator_name)); + request_module("%s-iosched", strstrip(elevator_name)); + + return 0; } ssize_t elv_iosched_store(struct gendisk *disk, const char *buf,