From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f74.google.com (mail-dl1-f74.google.com [74.125.82.74]) (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 588D65C613 for ; Wed, 24 Jun 2026 05:15:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782278160; cv=none; b=Q1NwtzbBFkqVFiVm6bnoypwonhymuRzmROU91EsUoRFm/ojNrtJW0gUykws7nrGA0fFm6/Y6XzxfbWsAeQ43lgqhyaUpxh3W1gwfq0iKpanl7Y486WlDrUy1F8ie+GSH+BqlvX3hNVkQFgzideOIXFs1bHQX+0K5Kp09m8z/XAg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782278160; c=relaxed/simple; bh=6gaNNsM3QsGSL6Z/u0Bak3+noraJ0xcSTjKBLWCfW7c=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=hOwK8/50a7vNwHCkHpiOsW5vg4rSxLtbGpUFukGWBXQ1imoccsfxrrdtcyq47Y5Ggg0W2CAsCRynP8s0AYypm1k8TmaRG1sEMzNj1fT2b732fQQpGuMEOOTQPjFmN5bEs8SsV7ho3R7uQK/qevzSjG5bKFIDTyIUyd9I6weFSGE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=iNWDb7rl; arc=none smtp.client-ip=74.125.82.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="iNWDb7rl" Received: by mail-dl1-f74.google.com with SMTP id a92af1059eb24-1394c3ee7f2so2644755c88.1 for ; Tue, 23 Jun 2026 22:15:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782278156; x=1782882956; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=8wJPelRIQw8f/Dg4s7jbpIWSg3DgRcwrqK7YBo20jNU=; b=iNWDb7rliTuV3noen0ZTTcHWQRYGwL3WHo0oW9ME7iGlVedHLABkFE3rFgtSTOSQ84 G+q4UK6IPq75E4bhUDFhpeM913qxVWN5ajtO4DOfVy7IllW7VQa0IIimoIniQ82InsJl ZjShBkH5qfzfoH4XlLmYDKMaTsjjvfBwqgxwm75D3VpNf30lbot5tSD4A8S0o1BYACAe QjDzGLTeoszVRyaTX/GiHR7WV6wQscBHlnYgg+PRZJEy7kGZBeUDOdfg/wCESBx2XXOa A2fAkr/wSe3I5zksmwtHeQIncFsQNKZT/sUeAjQlPsK+J5dh4m9sWeIFNc025xid5Ta5 xAoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782278156; x=1782882956; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8wJPelRIQw8f/Dg4s7jbpIWSg3DgRcwrqK7YBo20jNU=; b=bQfTTyIi1p8UW6PBVHwEs4ME6FZ6cbIm2Kh+zrt5H+esIEJlvDPxEYMS04IZApj3o8 QsowKMubpCZAQUJAtvFOdJfYfPPwGpnAyrQffSbUsDZZctHcfghEz3Ej8XAPWAF4whp+ dKppOypYgpAWb9tTLdSEySffXtqkWTkf6+5tl+zy0bgExrw/kurfwS3nc5GO/wqrjCav 5hWo9t+CLCsXYZ1WkVXIUjtUumDy08En6pHm3KQ8ETxOMiru05MrdJqbTYsvPVsNUGZp dSxMbY4fflrJIMD5o6iYfAjNKu7pmx4/2Vf2ieO1NiAJukWqRVRB6sTPbGIbJ+D9Ism7 +mMw== X-Forwarded-Encrypted: i=1; AFNElJ/7A5hzhPtZjErolN8yrsMtmyVx33o7VzCSQi9Oqcwg41jxK6b3lzfSXLt8loDDidtpPxaC7ogO+kmc9Hc=@vger.kernel.org X-Gm-Message-State: AOJu0YzDX9vmLapX5gpIm9ZpEcHFEeKoeti0ezBMRoVhNXwXl9a8huXQ /efV0meO7WYqmfrRPcwR/0bu5mCZ0g9NqpSi/LoS67P1B6HyUEyh68wIh7V/ylXSjbFTZGxjmU7 OSgWAH6/A/w== X-Received: from dlber4.prod.google.com ([2002:a05:7022:2644:b0:139:ae4d:e464]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:2507:b0:139:b977:9bc6 with SMTP id a92af1059eb24-139d0c81f85mr1561205c88.18.1782278156091; Tue, 23 Jun 2026 22:15:56 -0700 (PDT) Date: Tue, 23 Jun 2026 22:15:24 -0700 In-Reply-To: <20260624051535.3584977-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260623053515.2677888-1-irogers@google.com> <20260624051535.3584977-1-irogers@google.com> X-Mailer: git-send-email 2.55.0.rc0.799.gd6f94ed593-goog Message-ID: <20260624051535.3584977-8-irogers@google.com> Subject: [PATCH v2 06/16] perf data: Fix directory file descriptor leak in perf_data__switch From: Ian Rogers To: irogers@google.com, acme@kernel.org, namhyung@kernel.org Cc: adrian.hunter@intel.com, alice.mei.rogers@gmail.com, dapeng1.mi@linux.intel.com, james.clark@linaro.org, leo.yan@linux.dev, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, tmricht@linux.ibm.com Content-Type: text/plain; charset="UTF-8" Fix a file descriptor leak in perf_data__switch() when running in directory mode. By substituting perf_data__close() for perf_data_file__close(), any thread-local directory files are properly closed during file rotation. Assisted-by: Antigravity:gemini-3.1-pro Fixes: 040f9915e99e ("perf data: Add perf_data_file__switch() helper") Signed-off-by: Ian Rogers --- tools/perf/util/data.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c index 33fd1b82019e..32d4d908ad38 100644 --- a/tools/perf/util/data.c +++ b/tools/perf/util/data.c @@ -472,8 +472,7 @@ int perf_data__switch(struct perf_data *data, pr_warning("Failed to rename %s to %s\n", data->path, *new_filepath); if (!at_exit) { - perf_data_file__close(&data->file); - data->open = false; + perf_data__close(data); ret = perf_data__open(data); if (ret < 0) goto out; -- 2.55.0.rc0.799.gd6f94ed593-goog