From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 A27FD371D14 for ; Mon, 22 Jun 2026 10:30:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782124218; cv=none; b=aeZ/CpblZ3UwC/yvhiGTF6qWrhDmsVDwRnGD4gEb4ZoHPwfKd5606XWsuuOnto8DGwTt8Et3N28XjoOrt8jtsTuOlG8eOV385mOy34JD8Bs68tLOWPaBES8bFupTe+ZlqwF4gTDc6EmSGOqrEplIluU2YPIkwVPahHG14UhWAfI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782124218; c=relaxed/simple; bh=Ii1KCfk/Q6UmKa4S2HR7teKRK6ri3Hm0oX1mojujygk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=h32M8vUo16Yoy9WLnAtBj+s5NWfscT3ioSN+uq+gqc+/hvf3S/JMib+yUddDfjPEnAx1m+xs/uY35TqZfZ4g3qn39wA6UQByKYQrW9etUB4tEUhLGvG9Zmt0n02kdxn1iF8N+AommfkooORnAfczTZaC4kJWv+EgXy9zcHl/6Js= 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=ApO76NQZ; arc=none smtp.client-ip=209.85.214.170 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="ApO76NQZ" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2c6b67d5fa1so30083115ad.2 for ; Mon, 22 Jun 2026 03:30:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782124217; x=1782729017; darn=vger.kernel.org; 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=Ii1KCfk/Q6UmKa4S2HR7teKRK6ri3Hm0oX1mojujygk=; b=ApO76NQZxYkUBNnZ5Vcvlu5SZVHKL/I011mmvA9x9mX3vzAPErJ9Mht8X86RqpUGOs lQdjikfO3hrXe8Z/0WTcXf8K9bpRPMmwIhBn82oqCUmfrFu6ENl/DeXETsTFenVZf3v4 Xa0MRjB33JmHGvgMNOvlC0no2h9NMMdRVi5uwEb723yfdlKM5bB0D4QF/l9xuumNW+YD 06WG8kNHangKhBTKlU1foujW8DLWleEiIpBAz3tiey7E2TwhYcE5wiEyi6Yaov5YcgwM GkQjV8BveJHkm3z57YPYBQh01ObNM7ZFTaLNa4GHhXYcm1cwMg+DdykByYycq8sAG12h eRcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782124217; x=1782729017; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Ii1KCfk/Q6UmKa4S2HR7teKRK6ri3Hm0oX1mojujygk=; b=jgH5lfJRDcsYFJXm933xpRYGCUt4IDYntBHKhvC5GQdaW8pz/aqd1K9pddz5nQOq8M rVdH8YsvPgkK4d3P1K3cLlAgeyrR5Ox1ZtVV9YX4EnUpvWct1aBuxwoe3ZfqqziljBgm TziSN14QcRZO2i7+9/FC61VyTDnCnQYqMufHtExVNBWTMDfs6iZpxHFfNv8Vr/7GYfiC 91toW+rs1LT4s7fRPffbEsaQhNfdBhZAGqAT3JTfygaGAtSDugKpDbVXcksHSlBvu1tL yEokxojUDmN/FPaaaPunzbfSau4WxZBXV07sjpY3XNQJ6LWv88K+YTZSs9zge5dZQBVq 92MQ== X-Forwarded-Encrypted: i=1; AHgh+Rqv3aBY2556ykaLP0etQe6zO1yG7BHgGiTmizHMbtWY71lFYE06doJfV7/9fmT7dzdhtW8RWz8B6E15fsc=@vger.kernel.org X-Gm-Message-State: AOJu0Yx+AwPKDxqQStxdcyV3AGXCZlq9PDQqG+AIxwqr1sAAfFq/XiF7 QsiH93yGFCVwY6ct9+ODdfR2OAalobgl80+cfY6dTuHSv3OZ6E8UKIgN X-Gm-Gg: AfdE7ckDOVtt8VOMWOg17CAMA/tiKSrJ/sC2I3I7A2ir3ALuT08DJ7EuAGyUCA69Ie2 1n5rFkasLai5yStNPrKHe3ie9elzRBJx5/tJBPCGTPd/eH3NsiNZWY15faeuVeAi2LdIqLwyg6K cvyO4FBLKM8JdHhMiIeSm9F+E0k0Lc5bAKjWYFMf2v/och1AwzjQxvKCJkKesoiI6HjlzqVE0kY Ync65EJzgiCG7GBlo4siv/UQrbI7z63mBu17uQtE91sxi06GYnWufd0fMLqseV7dMTwdkng3WKA CTiC335mFUaDiJ2xmu7PkVkg/8Opg+1lCfjVajER5NPaMcOoOUaycJxoSx2IubPl+QetB6gF+y8 /MOtm91T+kmXnMP5ckiZifpvpdTQ9GhXPKOEtjk/TjE5uHcFlz/bB5aOzQ7qhQy2YXmuVyZvb5U G1Lf3S3+HU1uu5xQ== X-Received: by 2002:a17:902:d4cb:b0:2c6:f3ae:2383 with SMTP id d9443c01a7336-2c725b93678mr133806555ad.13.1782124216347; Mon, 22 Jun 2026 03:30:16 -0700 (PDT) Received: from fedora ([106.219.196.189]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c742fdd411sm80718545ad.0.2026.06.22.03.30.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2026 03:30:16 -0700 (PDT) From: Sajal Gupta To: error27@gmail.com 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 Date: Mon, 22 Jun 2026 15:58:58 +0530 Message-ID: <20260622102859.38034-1-sajal2005gupta@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: References: 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-Transfer-Encoding: 8bit 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. Thanks, Sajal