From nobody Wed Oct 8 07:24:27 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 F23B528032F for ; Tue, 1 Jul 2025 16:39:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751387973; cv=none; b=fIcwxDngRIeFne3JCubbNFMi6f0G0RG4DZjn9Jb2s+6RYlCgrywneGUrGbu1Cd/QJVigkm7wg2KTTPPLK7nARcEYhdTGEuevrt8AKyqxQdu7Ux/+A3sc7vqY/8F0LxkDQiq8WHqr2CW+i0HPx8ph83rxPnn2kzs5Ov4LSn0/yP0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751387973; c=relaxed/simple; bh=J1luoHaqcVABtRpfP3s2rxvvgrzCAFJw0IrLyGBtqmo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j6VfxEYAQqqWa/6TV0sW7kGJY6cc+cCQt7/09R2N31UDzBhpyAoKiok4jwJdXCh/jej6UN8cG5PmtylCXk+TL24VFNFA63WcyJ/hM5ZkMKFHjEGgUKO0hhSoYJQiSymQ7HUTLdCwRwK+B7uGnFLj8okLc7F6PYzhFnQEtzWS9mg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=HlrWYAo3; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HlrWYAo3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1751387971; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DxcT4ITb/2b3Wlke7YAIfqjVHs8i3ce0MqCsS8Z3jlI=; b=HlrWYAo3zNO4g4cMazzfhSgCT6vTEGRGb817qgdjWDJbowm+hv7GGkC6tT+YGWS+k/kqBy VieOohQEYJ15tc84WzBCaG/30v/BF68UJqp8IglzseIeLObZcJzrQDt4/roTPeQj4uiHbr e8L7p6kSHkOMB+jVOrI4yM3YM623rq0= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-621-VppJQ7HKOYahrYaxrZWUNw-1; Tue, 01 Jul 2025 12:39:28 -0400 X-MC-Unique: VppJQ7HKOYahrYaxrZWUNw-1 X-Mimecast-MFC-AGG-ID: VppJQ7HKOYahrYaxrZWUNw_1751387966 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 03EA61944AAF; Tue, 1 Jul 2025 16:39:26 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.81]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9417D19560A7; Tue, 1 Jul 2025 16:39:22 +0000 (UTC) From: David Howells To: Christian Brauner , Steve French Cc: David Howells , Paulo Alcantara , netfs@lists.linux.dev, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Paulo Alcantara Subject: [PATCH 05/13] netfs: Fix ref leak on inserted extra subreq in write retry Date: Tue, 1 Jul 2025 17:38:40 +0100 Message-ID: <20250701163852.2171681-6-dhowells@redhat.com> In-Reply-To: <20250701163852.2171681-1-dhowells@redhat.com> References: <20250701163852.2171681-1-dhowells@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Content-Type: text/plain; charset="utf-8" The write-retry algorithm will insert extra subrequests into the list if it can't get sufficient capacity to split the range that needs to be retried into the sequence of subrequests it currently has (for instance, if the cifs credit pool has fewer credits available than it did when the range was originally divided). However, the allocator furnishes each new subreq with 2 refs and then another is added for resubmission, causing one to be leaked. Fix this by replacing the ref-getting line with a neutral trace line. Fixes: 288ace2f57c9 ("netfs: New writeback implementation") Signed-off-by: David Howells Reviewed-by: Paulo Alcantara Tested-by: Steve French cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org --- fs/netfs/write_retry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/netfs/write_retry.c b/fs/netfs/write_retry.c index 9d1d8a8bab72..7158657061e9 100644 --- a/fs/netfs/write_retry.c +++ b/fs/netfs/write_retry.c @@ -153,7 +153,7 @@ static void netfs_retry_write_stream(struct netfs_io_re= quest *wreq, trace_netfs_sreq_ref(wreq->debug_id, subreq->debug_index, refcount_read(&subreq->ref), netfs_sreq_trace_new); - netfs_get_subrequest(subreq, netfs_sreq_trace_get_resubmit); + trace_netfs_sreq(subreq, netfs_sreq_trace_split); =20 list_add(&subreq->rreq_link, &to->rreq_link); to =3D list_next_entry(to, rreq_link);