From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F1501C68F; Mon, 4 May 2026 14:15:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777904152; cv=none; b=sApQai0xJg8YBSnHocgH1znCPvWq863A2umelr6Xu2IAVFn7r9t88iBm014dLF+7y5cco4jaFZBl8cRQ1boYC76F1Ki0T9eslKIvITMXdrv7OGDG3Edlod3bdeXOqOAy9DOEf/EEwRcZFHuddCOukcedrCqYPc7yuntbySdip4g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777904152; c=relaxed/simple; bh=CwuL2IY6fztOfJrYJ12yR3Q+exVtNLx9+wDryF2yTnU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fNboaPa8fKyscShCgfWya8PuhJ3RuPZBYdXJz0Mw1WBvjS/z//41K18VUqQw02MQek6SfI441kncFZ1LVtKwqis5kv1rK7+He3K/cxqepxCdNF/nsSjim320UuPBRR6jk/lyiowm+Fh7tCzmwGoVBkzEGp5EQvXhMVQ2WfBawRI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=IpR4uvEs; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="IpR4uvEs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93B15C2BCB8; Mon, 4 May 2026 14:15:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777904151; bh=CwuL2IY6fztOfJrYJ12yR3Q+exVtNLx9+wDryF2yTnU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IpR4uvEsvbe1E74YTIZwPeJEzvieh+cHFBn6ai7T0YPoi22oEmz5TglnoSMGACJYi HebEi+umpwp30Rnc00WfYnoe23TmI7l352Crh7P0DRaA+hrIfqsVqZHlDqAgkJ84l3 fkogqxzBNJ0GEwbwqHGNENwf+a1iPw2jkiZT8CqY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, FengWei Shih , Chia-Ming Chang , Yu Kuai Subject: [PATCH 6.18 204/275] md/raid5: fix soft lockup in retry_aligned_read() Date: Mon, 4 May 2026 15:52:24 +0200 Message-ID: <20260504135150.656759509@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260504135142.929052779@linuxfoundation.org> References: <20260504135142.929052779@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chia-Ming Chang commit 7f9f7c697474268d9ef9479df3ddfe7cdcfbbffc upstream. When retry_aligned_read() encounters an overlapped stripe, it releases the stripe via raid5_release_stripe() which puts it on the lockless released_stripes llist. In the next raid5d loop iteration, release_stripe_list() drains the stripe onto handle_list (since STRIPE_HANDLE is set by the original IO), but retry_aligned_read() runs before handle_active_stripes() and removes the stripe from handle_list via find_get_stripe() -> list_del_init(). This prevents handle_stripe() from ever processing the stripe to resolve the overlap, causing an infinite loop and soft lockup. Fix this by using __release_stripe() with temp_inactive_list instead of raid5_release_stripe() in the failure path, so the stripe does not go through the released_stripes llist. This allows raid5d to break out of its loop, and the overlap will be resolved when the stripe is eventually processed by handle_stripe(). Fixes: 773ca82fa1ee ("raid5: make release_stripe lockless") Cc: stable@vger.kernel.org Signed-off-by: FengWei Shih Signed-off-by: Chia-Ming Chang Link: https://lore.kernel.org/linux-raid/20260402061406.455755-1-chiamingc@synology.com/ Signed-off-by: Yu Kuai Signed-off-by: Greg Kroah-Hartman --- drivers/md/raid5.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -6635,7 +6635,13 @@ static int retry_aligned_read(struct r5 } if (!add_stripe_bio(sh, raid_bio, dd_idx, 0, 0)) { - raid5_release_stripe(sh); + int hash; + + spin_lock_irq(&conf->device_lock); + hash = sh->hash_lock_index; + __release_stripe(conf, sh, + &conf->temp_inactive_list[hash]); + spin_unlock_irq(&conf->device_lock); conf->retry_read_aligned = raid_bio; conf->retry_read_offset = scnt; return handled;