From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (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 BD91E379C5D for ; Mon, 22 Jun 2026 10:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782125844; cv=none; b=n+EREmmF+Nqvs2e6CneDeOpIixq7jly0tgbV16W6whADUhnquoJcUviS+j9khrL/SxN9PDeyj9uQBc3cMmTyOqsv5DwfvdLPQoP95LYVENdj5jHKxkSgKhXiZcQ4v+6VjToVwbLOGYWtjJeFOlNYtxVDtTIgOGq1KiHssF/EUVY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782125844; c=relaxed/simple; bh=LWHVuMY1/ncBwfRP7JCD6/Wpmd4uhdg2Wme/B92jfYc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Vxq0JFEvc2tVy601maAqQIk0ljyjXlKY0Y05fdvQyVRgWZ5uMJVk2wvpENPteTEEJNa27iC6Nnvgh/mkz9BBSucR34WxwZ+nKZNeb+jk60vgjT+EjuiyZe708EOiC/Lrd7kxbLyAUHG/AmMErY1j/XBuZ757EkQNnivYp/Z7W4I= 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=oSlfZut6; arc=none smtp.client-ip=209.85.218.49 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="oSlfZut6" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-c0c964d6470so238852366b.3 for ; Mon, 22 Jun 2026 03:57:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782125841; x=1782730641; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=ZWK0XbJl/m0yxPi2tihir84Vy/CVlnAxBTBF0YEc9Mg=; b=oSlfZut6cCJMuK/Ce36fHc3OpKYX31CvpkWow7px+VYRHk1I2BuU/+yPPpEHByEkM6 dtkSvM/N4w/GweK6Pu+TTD/mJfjnaq/vOhTOhyowfE6NKu1ChbX3vZXtoUBt0YeLdrWs KV3mtI2NcwVnmYQ6TBn0t0dRhLLBNU7nu9SfAs/pvPUecwGI8VrmqOl4eqJiH/gVWimT oqOC96c+okwSJNjmmOM75cQ8HJZ6COhfbORHw2L5UndDBKLXuOjsVK+907q7t1P8co0/ RRGWS7qKizbrTLNbjgfRzlRRVMT4L6KBqJSLmIj3kUB6xZ9P3oxnzJNouy/Sx03q14uI y9Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782125841; x=1782730641; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZWK0XbJl/m0yxPi2tihir84Vy/CVlnAxBTBF0YEc9Mg=; b=qphnc9wuqDYVzbQTCqeZYqU4AWkVNdXALbhuuWjyLI05eu/rPft0No/jawN3iuDcI8 Ak5EILnb/ecIowzyRWKIHUbQgeSTsGH5Su90VzHzVD7BJggbCoTfVEvVntsRsxc4G6Kd D+fEBrV8lbA9ll32R0K9iy3+7rYKiZR08i13yMv8BItjaC2EUILpLpM5ZkxsP9wlOqco 9etEcMnnYLMi+CgjiV2RZp4L66QB3KtFQU/EjQzyn6V7G3Nl67Qru/i/EYguA/Ll7B+j kHQwHxkr4tXQGyTBWmo04cDIUyaPLNNaXZsJ2qF4rnHgLya+ZpJWx2n1EjyrA/195Jb6 GTAw== X-Forwarded-Encrypted: i=1; AFNElJ+zTtOnQEQKQ+jzyQgJXom4OYWeze2dr82SLvFaQS0vAPwi0RAW/3ybm+628lbNXvdg5/ZLIxrRvrkuIJM=@vger.kernel.org X-Gm-Message-State: AOJu0YznYIIJ9Fxq80cD2UP+sc7O+EcUEkjkxvoKWmm0R6qeEqvoCuJH tjOHzWwzlhvHgaDnctPPthpP/mSqp59G7LDJj492E+6aN9jY4luhXYz0 X-Gm-Gg: AfdE7ck7WYrlgTiJ6CaxuvrcMNgKlk6XoW0wUik9z9lktQXPV7h3zogfpbS/PWz2Ag7 dJh/UC3ZJU5JjmBb9hJIFq8HMhzrEze0dVWLCG33EXwGaweR3OKmJQ1b4uHicQW8reTTOzgw8Mt m+rLdPQ+GKIV2Fv13TiDlCij+5VGT9FfzWlcLIvLWPxspvaPrQvO2gKNMVMujxaC+Zx24px+jR3 uDdm44+PbDC51LYmhwmDmYBOjnQlRpt9qLVl8uqyho8wJavBHr+s9ypVQYF4w93PkjpZSTGLXwR UTKYaNR0MWQhnhDuB1InAsp+73N2+kNKXmS1IaOudqOp1rkPvuJRfN1KeqK15JuZVm3DIzyeWw8 hyf0A3Bn9yWI634jhW0d20iAi4RNdKbOHr0Gzskg/fREVHX3oHcUOiLtCJ1WLQ3DQbEeCwW2mCN /7a4EGHwe+ X-Received: by 2002:a17:906:ee8d:b0:c0f:c475:6bd6 with SMTP id a640c23a62f3a-c0fc4756e1cmr42963466b.13.1782125841003; Mon, 22 Jun 2026 03:57:21 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c0c5e99b968sm335639766b.24.2026.06.22.03.57.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2026 03:57:20 -0700 (PDT) Date: Mon, 22 Jun 2026 13:57:16 +0300 From: Dan Carpenter To: Sajal Gupta Cc: linux-raid@vger.kernel.org, song@kernel.org, yukuai3@huawei.com, tomasz.majchrzak@intel.com, linux-kernel@vger.kernel.org, skhan@linuxfoundation.org, me@brighamcampbell.com, linux-kernel-mentees@lists.linux.dev Subject: Re: [PATCH] md/raid5-ppl: convert pending_flushes from atomic_t to refcount_t Message-ID: References: <20260622102859.38034-1-sajal2005gupta@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260622102859.38034-1-sajal2005gupta@gmail.com> On Mon, Jun 22, 2026 at 03:58:58PM +0530, Sajal Gupta wrote: > Hi Dan, > > > Have you tested this at all because it doesn't seem at all correct to > > me... > > I have only done compile test, sorry, I forgot to mention that. > > > How I imagined this would work would be: > > patch 1: add a break statement to fix the use after free > > patch 2: s/atomic_t/recount_t/ > > > The difference between atomic_t and refcount_t is that refount_t warns > > about overflows and underflows. > > I did it like this because that is the pattern mostly used in the codebase. > Simple s/atomic_t/recount_t/ would have > refcount_set(&io->pending_flushes, 0) in init > and then later refcount_set(&io->pending_flushes, raid_disks) in > ppl_do_flush, which is not the usual way. I am treating it as a proper reference > counter rather than a mechanical type swap. > > If that is too invasive, I’ll rework it into the break fix first, and do > s/atomic_t/recount_t cleanup separately. Heh. Yeah... There is not a chance I would merge a patch like this without testing. It also really feels like an AI patch and you're supposed to say when you use AI to generate patches. regards, dan carpenter