From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94C532D5408 for ; Fri, 1 May 2026 11:47:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777636026; cv=none; b=Q2nFseexf+dKMcLvboTHPf4KzDIwnfbmccZgIaT3jkd6um8k4K+3fhs4xHDVE739TkKT7ZWRg+Mh14Gw5QzQMEJ1uzsj18u+JfJou0oFBoxWm6Oe/jGLMSIUIx6wQyWqEkocB01wpwPofz36GIusHl1zd9FaAvyvGaA5LgjscQQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777636026; c=relaxed/simple; bh=rTowFu/ufBjrWjGtXEPAIvD0nUWtqTXgMILIDeQRLls=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ZfLG093AYaGzz/WzLQt/rImieLqjYhjn5yJUiqLEcR8VLAo/VGUxJrclIC7GVCVhlQUfnfiVoNhP+UOCwtNefTPgV5z16LxGXbuM7csbOkfuIypLKnajzJJuZdFoxSH42YiTlHKPDTFJsZgZViim9NZ2L3IjQ8AJP8+1ukKYnLI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CwJpQ/ob; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CwJpQ/ob" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4838c15e3cbso15651705e9.3 for ; Fri, 01 May 2026 04:47:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777636023; x=1778240823; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=7+F9KrcqkNOlg88GFhvcMRaxxFuRjKMs3WpEfPMm25k=; b=CwJpQ/obvYygTx0xXNi4fj6AEhX8I9lCugntKa6K+I/zJ8uRIwHyjyazSz8jDthqTF wyJQHXzAvRbovXfTiM1ws3gGlJ8HSbmiaV+XOVVhoEl6uMGlYFg42ZvnK1K3jnvqzkOA ug6fca7aGzZY46cb3T0g9FVkLc6BmGbERYDq4ZR3APBC+UV5g/Uc4esuEUHfBrM0B5jm bKtZmQ1X73/rTriWhFN+Etmxk+ngTpdvKmiHZt1LqrhBuEXzPNq4h7gZd0G+phXumIDM XLpSBQBSm0PhmXC3Ts02ng84ePEhtdOsYA4ekhDO6ZWJeTRwRFm+aVtSZyuNZZakgi0V RLaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777636023; x=1778240823; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=7+F9KrcqkNOlg88GFhvcMRaxxFuRjKMs3WpEfPMm25k=; b=XvBJgiYwQVR0TrSPKW0WY/Ws1vH8Kmnq5GSqgHDqZw51rSwA3FvUbgwBtwq+r+KzaK WOGcNu6ebi/7AeA1fYlKdCfIVT184dbuOTrXutzjh0bQ/HXNgpuec7u9lTNRTlNfKj1o 6GSb/Wef4tsSjwlFcojq3KvqgSJfnD7LcSOLrc18/1N+NXajFp6AOLrzvtNcNAF1i23s EDuZ74G6osFacXIMD7i71Nc2066IsPn4uvcE9eHkWtGuuaIhALPGE8o4CRGzLvft/+YV 3XogKFeCFsRX6HAcaMiJ++xitzdGR2irHgyMURc9gZftL6MJXjYdQCB8Rnc+g/nFXL2O AbkQ== X-Forwarded-Encrypted: i=1; AFNElJ9V6xA9W3d25THZww3fYey7SpTh1tjQ00lQXkx0GuJ3WSmz5/o6YWsQbgTbYdf1KJULNneu1t68jxt3Rnw=@vger.kernel.org X-Gm-Message-State: AOJu0Yw/kXAeEs6awEJSYyY/Uqy5HMMtPjn9oxlbndldDIe9ArGyPfOP h9S1SAKwflTFPuwyF01McAmT1Gh8aJ50CDgMYiLX+r6Ykap9o9F5Admh X-Gm-Gg: AeBDievcSkeHEeXkBD+CIgcyOy8VrVodCij4tQCigCAnDPPXgCRO45QKudOuctVzLjd SEsLi51lMQEgZEu8RbipzqvHYRF8e2nxiMVrEq3ZYEGY6R8x/f95xXGHh3aUsMVPsJTBpRLZass p7Oqf0AS++6I6Nvum5NqUh1yD7HWmRwE4Fmt0LPGg6fuvAHa3CRrwgGR1htP87Rs369aB1MQWNM L9InNdO7U06cupl/bX6a9GGFXLNAvEnjKESMos+Zjb5siRdm7LUycf7nRdkC2eofN7KbNheziwl iaaZj2X2bxKu0qbjf+Gi7ZQ06i1N7QMc8BAI7UilMUEIxYjD1G7Mm2+76BqrWmpHBoIB1o1UbPW 6CQleuUKSjE0PJJju/ICKVHmMuGafQoBrZDdEduHllZzxMLXrNWu9gmd3H+w4e/QUp/PzwuocEW qWj5YPdm4UDbhatsSUkW+Nu4au+fVPJCK5Jg== X-Received: by 2002:a05:600c:a316:b0:48a:58ae:9933 with SMTP id 5b1f17b1804b1-48a8eb8b706mr27491095e9.18.1777636022866; Fri, 01 May 2026 04:47:02 -0700 (PDT) Received: from yocto.. ([2a02:3037:621:7039:f080:d03a:2ee1:37d9]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a8fee5033sm11797005e9.22.2026.05.01.04.46.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2026 04:47:01 -0700 (PDT) From: Abd-Alrhman Masalkhi To: song@kernel.org, yukuai@fnnas.com, xni@redhat.com, neilb@suse.com, shli@fb.com Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, Abd-Alrhman Masalkhi Subject: [PATCH v2 0/3] md/raid1,raid10: fix deadlock and bio accounting in read error path Date: Fri, 1 May 2026 13:46:48 +0200 Message-ID: <20260501114652.590037-1-abd.masalkhi@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi, This series revisits an issue in the read error recovery path for raid1 and raid10 when bios are split and resubmitted. In v1, the approach was to avoid splitting bios in the raid1 thread to prevent recursion and potential deadlocks. However, this was not ideal and too restrictive. As suggested by Yu Kuai, this series instead handles the problem in md_handle_request() and allows bio splitting. Link to Yu Kuai' email: https://lore.kernel.org/linux-raid/m2lde74dtw.fsf@gmail.com/T/#m714020a38b60fc5f84b9a24f0c46acbe5d7342d6 This series fixes the above by: - handling md cloned bios explicitly in md_handle_request() - using md_cloned_bio() to reliably detect the error path - fixing bio accounting to avoid double/missing accounting Changes in v2: - Split fixes into separate patches for clarity. - Use md_cloned_bio() consistently to detect cloned bios. - Recognize that raid10 has the same issue and fix it in this series - Allow splitting bios. - Handle md cloned bios explicitly in md_handle_request() - Link v1: https://lore.kernel.org/linux-raid/20260427103446.300378-1-abd.masalkhi@gmail.com/ Abd-Alrhman Masalkhi (3): md/raid1,raid10: fix deadlock in read error recovery path md/raid1,raid10: fix error-path detection with md_cloned_bio() md/raid1,raid10: fix bio accounting for split md cloned bios drivers/md/md.c | 25 ++++++++++++++++--------- drivers/md/md.h | 5 +++++ drivers/md/raid1.c | 15 +++++++++++---- drivers/md/raid10.c | 28 ++++++++++++++++++---------- 4 files changed, 50 insertions(+), 23 deletions(-) -- 2.43.0