From patchwork Fri Feb 28 23:59:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Sander Mateos X-Patchwork-Id: 13997236 Received: from mail-pl1-f225.google.com (mail-pl1-f225.google.com [209.85.214.225]) (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 9887B23F37E for ; Fri, 28 Feb 2025 23:59:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.225 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740787194; cv=none; b=Rdgkkp+DydMPaKvtuD00i0jUKA111H5ZBL4AtZCcZOGP/bqGJ/RSvHl8u/e0cNQAD8cLJMPIYsoAnzGyds6ipMKun8tzQgltauXT1IO/MJ4HXNDYgF5hZnfbRed7R2/2IaAM+J2QAt1FVlIkpTwOg/sA1lxxjRGAorYomrw7dlc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740787194; c=relaxed/simple; bh=M19kqPwNW3vIXGn+RbcnqMl8wOB9w+/nhDOK8KFUgxw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=e7n+XCWkDQeT8CgTpUsyqeOq/W5J5TZ5RjyKpb7+pXigUqRsNEKxR7BZU0biQ4j8nzdysTSEYd4X/wn4FE4QcLiHg3393MJ2ZVTEuSDZVsc7SCgElKiL+havgVKuw2MG6/cBVnV0qVQG8FPlRnuAGA1In7nnoVJgms+/VVtY9/E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=QeCRZzBB; arc=none smtp.client-ip=209.85.214.225 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="QeCRZzBB" Received: by mail-pl1-f225.google.com with SMTP id d9443c01a7336-2234f57b892so6668995ad.1 for ; Fri, 28 Feb 2025 15:59:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1740787192; x=1741391992; 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=JSAJMXS5kmM5iwGMwe4iAEt0SbX+ffh78y3gp8LBwPk=; b=QeCRZzBBjv67C1z6Ur4k1aan8mf2RiEZL1RAvXNWeTm+4Xn/p8GKEqJCp61s4vwo77 V3Yw4CByOVqjDbbDHt4KC1NNq09SbuxDMeJtngwf/1wKjzfuPEvMYghP9peDBiELIbCi deB0J1S8IXuVxoJM+E9Nod9NxEzdYFGQfwg3lRt1gMnn6wfWh/CmAVQz54zOu/nibnXu dvBY28CisI6EajoA7+NFNGmf0y03XyIm4wgRGDnEXt8jGrolUhr4N+vyyNaPobHbYhN+ cU9+E+Auc4dRFV5jCst0jayLiIIcQuVzDyIeOuMisSLij0h9avm8d9NyvI8CtdVNBGNw x8hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740787192; x=1741391992; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JSAJMXS5kmM5iwGMwe4iAEt0SbX+ffh78y3gp8LBwPk=; b=IYseJtIGtzhVR1H6VeRduia2q5XB3RszqYiiTwlftvIvAAiLAQ0MML6y5Ydp4j4riS rUtogNpavpIC5h+SDBRIi9yXG1B9oJxGLS9DPC9dwM8IuFpP++7orTJLSLpJVxznbywa m7j+hPu0ppweLAvvfXMESLBBcpoY10Ge1Yj95sI7UitCWffvxiKyyNZQ4UGqheF+/7l1 tdyXHGO9wCEDJP1Bj1Be1GY/YwxG1cyL6w7uhd6clP8YXpzWSeuowPZ6vco363D/IXZW P8RXUdWVwQvEV3Q14aK/WwZJ8sXiYOfATyjTbtgRivAHBBhGFDohCvgie1WLxEinebgJ YvGg== X-Forwarded-Encrypted: i=1; AJvYcCWGskdDq9xkYhuDVu8tfqxP1XyJ02IIENsgAtVIybTapaajXboC/NtKYbb7Shg0/U6+bBzUZ1I9aw==@vger.kernel.org X-Gm-Message-State: AOJu0YzRQck+r9jOYLmjtOYFc+mUrddGDB1zzqQFH0vpnEGTe41kUnqP FNttB76YSmD0JsLQwmkfSr6PRmQxgao3A5qb+2r9f5kDvVRpsGdhYan3vGGMr2yHUkZwmGu/yFm upPmPj9HFLjYTo7oHmjfOigJUjkE/0Cg7 X-Gm-Gg: ASbGncu7ciwWL6jluEo4uecz7Pz+Oobr26vk0mqIoMjzXVsRvZNwkSOZfEPinbd+CQk QC5jMohpMkQvjq7nBrfZ4r2nu9ND1LF5+fF1cVtgomJUAEpBKK7IBUGsgMv5KBlEestvZEV1pXl a1WTUHkJvm8LrPgdEqHydvdJxG76vrLD/HtNheP5NGqJF/C87Jq7+ckgNuVEiwqW+bMKpBraDN+ EEOKxgyxnJlMsj7/c+/jgZj2RmXE6zD4oTUMZjQe+PcnEzk9lSAxed9Scdz6Bq52qduqnlOoLVO sRw3NE1tGQyNLRDpD4IhVnJFbVPwlbfNe6NYbECGC7rdm9A2 X-Google-Smtp-Source: AGHT+IFXwoTbx+UT09HA0mseihQdFnNVZNlDZ+Vyxp4n3cmTdkTekPi9axOJaI12Kcp3hl9Tn51ew5XmZClo X-Received: by 2002:a17:903:f85:b0:215:3862:603a with SMTP id d9443c01a7336-223692477f6mr31720455ad.10.1740787191655; Fri, 28 Feb 2025 15:59:51 -0800 (PST) Received: from c7-smtp-2023.dev.purestorage.com ([208.88.159.129]) by smtp-relay.gmail.com with ESMTPS id d9443c01a7336-223501fb591sm2330175ad.44.2025.02.28.15.59.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2025 15:59:51 -0800 (PST) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.7.70.37]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id 36D4B34028F; Fri, 28 Feb 2025 16:59:51 -0700 (MST) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 1F621E419EA; Fri, 28 Feb 2025 16:59:21 -0700 (MST) From: Caleb Sander Mateos To: Jens Axboe , Pavel Begunkov Cc: Caleb Sander Mateos , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] io_uring/rsrc: split out io_free_node() helper Date: Fri, 28 Feb 2025 16:59:10 -0700 Message-ID: <20250228235916.670437-1-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Split the freeing of the io_rsrc_node from io_free_rsrc_node(), for use with nodes that haven't been fully initialized. Signed-off-by: Caleb Sander Mateos --- io_uring/rsrc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index 45bfb37bca1e..d941256f0d8c 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -485,10 +485,16 @@ int io_files_update(struct io_kiocb *req, unsigned int issue_flags) req_set_fail(req); io_req_set_res(req, ret, 0); return IOU_OK; } +static void io_free_node(struct io_ring_ctx *ctx, struct io_rsrc_node *node) +{ + if (!io_alloc_cache_put(&ctx->node_cache, node)) + kvfree(node); +} + void io_free_rsrc_node(struct io_ring_ctx *ctx, struct io_rsrc_node *node) { if (node->tag) io_post_aux_cqe(ctx, node->tag, 0, 0); @@ -504,12 +510,11 @@ void io_free_rsrc_node(struct io_ring_ctx *ctx, struct io_rsrc_node *node) default: WARN_ON_ONCE(1); break; } - if (!io_alloc_cache_put(&ctx->node_cache, node)) - kvfree(node); + io_free_node(ctx, node); } int io_sqe_files_unregister(struct io_ring_ctx *ctx) { if (!ctx->file_table.data.nr) From patchwork Fri Feb 28 23:59:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Sander Mateos X-Patchwork-Id: 13997237 Received: from mail-pj1-f99.google.com (mail-pj1-f99.google.com [209.85.216.99]) (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 E37E11DF74E for ; Fri, 28 Feb 2025 23:59:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.99 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740787195; cv=none; b=V27zwpFLmhY/VJmEGLtaFSBymfUuL4krYjULsnbXXgSDkT5EWBO4N7cQZvcolxjuzOwjyeMNGY94FDAO4KrcUofYXSia+34SRhhDQtbAO3f8XanHWq2lsnpflKsE/rG87FccK8SnE8AEH7w1n3ws8+UBJphKKzeWcBaVuhNbj3I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740787195; c=relaxed/simple; bh=AZLZzMJ0MTVnkoUKBeMQDCZ4HtU6js9qp5I5DPRcObM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W7+/b5TOi8vBA11luAkQRMl8Tu6WozxYcoypU57MiDYuACQ/Wrhwvm2QmR9/VwIPKo/Sg/ZxMvsB7YGJ0IfJ5FEjFp9EmqYo+QXAB1xqmEAi9ga3EGv2T7WBi9kw1b9Px9Pn/+8bi7/bjZ5gasiCBdMjPKXUSiXqXaU8LaoPKPI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=J3W2W/RC; arc=none smtp.client-ip=209.85.216.99 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="J3W2W/RC" Received: by mail-pj1-f99.google.com with SMTP id 98e67ed59e1d1-2fea4cc08edso652103a91.2 for ; Fri, 28 Feb 2025 15:59:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1740787193; x=1741391993; 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=9sAFpF9FEO4L/QlXHSxh/NHTnXAGTF5O5LuvRrb5CMs=; b=J3W2W/RCsKnCTerIHfTQUZMH0DW4rltDuBnLy/YR4nPXLUje8GCqwID7QUMo50w86p kMXFRHT84eIoCHRfgyp9FcFoToATXAyt9pUu/GrncZCSPhSLwwwXtIYFMqQZzE5z4fm2 JEfnMM7jQBhU3MVIdwHJW5CtepXVtlfu+ePI1y+K1iKSMW6kYPcwMohMnoqw4IAKD4Cf h4LQMnhmul7qzOF7U9ON2KgVJSo7KvRe7WF3KH/iAWgF9zKtWPZjCLwReumIHw4YuPuh 3KwtMMUMkU5/Ydx58oy/wfWe81r+eY0m5QHQ+3nGKlET4cAJHo/SoSX8+7mhEMjUkOKm +2vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740787193; x=1741391993; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9sAFpF9FEO4L/QlXHSxh/NHTnXAGTF5O5LuvRrb5CMs=; b=hnU+rXqSIuDQfm/KQPSEF3OXAhfCY8TGxoBxbq88wG9uXfDkbkISz8CxM2uRk91NjH MRbURhT5SvT/ytx+S9CSSdvX/llH1l4RXRd3W3EkiGp+H3JWMfKaL1mGDVnu3TEOOj8j YJ4iBBXCgZr0V0vfIYTjgCOgpc2jsh4GlKzOHJSTyx2XAijuRMq8LSczkgftq/6Y27Kc Z+3mt0Kwm0m3FkDY/eAWUd4REmkaVEvVNkrPLU7XIyaP2HU2fVLnK8DAIbOMqrS2BxZK 5RlMX/ibho3kGBxrhKNYwzP3WOcxX1/vPpnUOPuyYCmn7IP0MMFhScyWoKLKcuJlWNNQ RBEQ== X-Forwarded-Encrypted: i=1; AJvYcCVuad0ozkwnoZTvx6X6RW+DFXgpIOe0TvDnnQWqfRGsgD0RvnC7h0tf4c9xhAD6MU4CtXwGNe9eiA==@vger.kernel.org X-Gm-Message-State: AOJu0YzV3Oc2VEt+QIzz8A9logUVmiXYpLMbH0Msg5JrFjTLHgKE2uc/ 1Uej59EYvKN2WhyHjFD+U0fvm+pPZOIXnFoPQErD7FZdWeWe2acXOV7axb392ETZD3oOtOdk4C1 HA6c0PrGWPWos7lPRwWMlpamzSsYMqroe X-Gm-Gg: ASbGncsv+iFguUl5fWGudvZR1Z2ddqI0MyT4f+yX4y8qrTsp5mGzGFsuAkNk6wlS2bJ VjXll2s/zL+k9Tof/t8xn/xiAZV+lBT203D+DbV55fjJ30/8wxLckUmDNIqj6HhZXzn0/4uwOaR KfvhV49xRfomZFHAQsuc0bcBBl31s2OB9ANQCu1cSneVIpdos88c9f3ZjjpYdoi/9s+/99gr2IX PA3kF/jVgq7E2D8sJ+dmAbgSmeG85FAsJavFNozVE/7AdzQqpzrC2U756XteLjbPcgNMWOekplG Lhn1kCMLQosSdRp+0LH0NiqpIzUE4qZXqSIrfD+UYG+Gmz7C X-Google-Smtp-Source: AGHT+IEW1Xd6SYijTL09braAm7HsEL2GN7+54qihyn7XQtQRzFpzh2VrVsxovv2bmR4SodKogme58OERoUcL X-Received: by 2002:a17:903:19e6:b0:220:e1e6:446e with SMTP id d9443c01a7336-22368fb8e9fmr30785535ad.1.1740787193090; Fri, 28 Feb 2025 15:59:53 -0800 (PST) Received: from c7-smtp-2023.dev.purestorage.com ([208.88.159.129]) by smtp-relay.gmail.com with ESMTPS id d9443c01a7336-223501d35casm2145365ad.17.2025.02.28.15.59.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2025 15:59:53 -0800 (PST) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.7.70.37]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id 8536734028F; Fri, 28 Feb 2025 16:59:52 -0700 (MST) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 78DA8E41A00; Fri, 28 Feb 2025 16:59:22 -0700 (MST) From: Caleb Sander Mateos To: Jens Axboe , Pavel Begunkov Cc: Caleb Sander Mateos , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] io_uring/rsrc: free io_rsrc_node using kfree() Date: Fri, 28 Feb 2025 16:59:11 -0700 Message-ID: <20250228235916.670437-2-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250228235916.670437-1-csander@purestorage.com> References: <20250228235916.670437-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 io_rsrc_node_alloc() calls io_cache_alloc(), which uses kmalloc() to allocate the node. So it can be freed with kfree() instead of kvfree(). Signed-off-by: Caleb Sander Mateos --- io_uring/rsrc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index d941256f0d8c..748a09cfaeaa 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -488,11 +488,11 @@ int io_files_update(struct io_kiocb *req, unsigned int issue_flags) } static void io_free_node(struct io_ring_ctx *ctx, struct io_rsrc_node *node) { if (!io_alloc_cache_put(&ctx->node_cache, node)) - kvfree(node); + kfree(node); } void io_free_rsrc_node(struct io_ring_ctx *ctx, struct io_rsrc_node *node) { if (node->tag) From patchwork Fri Feb 28 23:59:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Sander Mateos X-Patchwork-Id: 13997238 Received: from mail-vk1-f228.google.com (mail-vk1-f228.google.com [209.85.221.228]) (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 3092B1DFE3D for ; Fri, 28 Feb 2025 23:59:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.228 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740787198; cv=none; b=RA05Z0MNnxN/5ykcjmM66sthfuWdu+1y4hWSk38l1BqGkL8LMeAayYL1pg8JpQbUuuGh6duh1OENLpvIAGSqH4WiDskkVJXt83iy4KEnpBfYankvRBPW9fquPtEuqcZP6vazYs3bLx9Se4MHWP5W2aJN1g+vpw29RNCVZGf8NCg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740787198; c=relaxed/simple; bh=GqEhJOiyYXdr8rGQugNrCU6kawK92vTYNv4q8/6+xKU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GqN3b3UxbwIjTu9fYFn1sN+N/pSYSIZd6sJXPMo4HXsvrGDWjpVGwGqdGUO8CWgRy5CduMTgFqlzaiJeX0R/9pCJqM4U/XxEm22+M2gMB55YqRNe0A1/dY0HrxOATUMW56D0UG+1LPS1hOAndLCKWovDRf+uxHDSjYDb5PSRdOg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=bbYcnhvh; arc=none smtp.client-ip=209.85.221.228 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="bbYcnhvh" Received: by mail-vk1-f228.google.com with SMTP id 71dfb90a1353d-523610d834eso22705e0c.0 for ; Fri, 28 Feb 2025 15:59:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1740787196; x=1741391996; 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=IqbUgsOP74rQAaYypSD/gLbYz0cVUXhGZfBogbxaru4=; b=bbYcnhvhpzE+esEVp0I7U0EDjNqvwDySuY0XTWgXlYJxrCawT3hYpHiWdN95RxL2U9 e6bKZnoOIZ4QzUeJeOmo0nu2YxcFQjAkmNNnmlcrxsVhiRV1NzmvjW8NgD2AIefJR85g JJn+ZG6Om1SHOKuFlHgkd0syQBxv29Av2V8hfBVUTHgMOY0zP3CU1L9DpxHAtPOp3JfL I+CdouGPDKU/kuQkm6c0zxgF3MGtt0gwQQL9IZ0NRV/rGno/hyECfFl/fewzhDCgCMx+ jzxpgMItWzgOLV4LHY/DjJuhTp31b14C7G1A1yNDD4CYA9FaD5rQVuUnNFqI1815YRS2 jULA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740787196; x=1741391996; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IqbUgsOP74rQAaYypSD/gLbYz0cVUXhGZfBogbxaru4=; b=kfgdcURDEQzUMGbQke/AA4MQAYN/GudK39vXL0vcgmJTFbfIKp/sbAYfROsa0/hl1o dai4rFZwckmdOgeCXr/soxAlIBdL7Gw8iIpTmXH5lvaD/o6PpIRsLSGl4ZSVE9QH51Td Yzmmg6ay+HpvDRO9oWXhI6w7mdsfqy5dVOd2Kq7LLpvdVR4rom0ZbLOUCqjxqnmu1RwH dAPBnXhBkdBRj0ApebY0DrHczBjDykngHHtxopPljiUcnaekESiqEuORodQk3wRWqzIF hQEUpjMRJQmkGKNh5M5W6XAOE8XeeesCFOJkDuAMoo6l3ySY7maK/ifHIRx2WAOCG6Ks LI8w== X-Forwarded-Encrypted: i=1; AJvYcCWu69k0shh01AL+KOnpnIR5Alf3p1/98njpYNn9tcX7s8wvGCeXZy8PvqBwuEFrnnm+4kaYQsbqcQ==@vger.kernel.org X-Gm-Message-State: AOJu0YwjeEDA+SgMDCv8yp1lFH94fMeB5H/tuRmJN6WM1QhP/MbwbPTi fUeb8U5wAMD0wgkNHnA51QZQf2PhKIrSbpQ7Dxk9ar9gWfHH8UAq4dUHrqI/CDtIEe73FRQLUiq uibag/8f6tKlWsvu6wrRjSYwJ7xImfPCuP6HfIxa7YPStZrZF X-Gm-Gg: ASbGncvjuknkHcqN8WYwlHc+YMqkTLlW5jh/pe01zwBmyXj94EHDlQGe7GuUVWvlET0 Uv/KjpAo4rVmlCmZXhtrDdF9VH1xcv1fc+SrJ4D0/myVn+toZkFIqP/70tpKAdsZN6Vy3KRCNa9 9nSHDFRvpObBDMJKyYCk7h61GPMgv6Vwe1sl2xVoVknFaLxwb7n8jiIYAyIddVWTYQtYSqX0/3B tKAs3rTvB2C2K2GDn+2ELVAnf79dGDTuyB7xk6J6URDZ3kfrk8oSetfquKG6KB98SOIFBJ8HG2g +UbBGTYndVcvcYYH5pP+hzB8FmqvpLJvYA== X-Google-Smtp-Source: AGHT+IGRBEGoIDXj6ALCnhETDFnXCj12VARjJtS72JzhHgZ8tigxOcRZZIHSTkQ218vW8h9TJLZxg4EO/5ga X-Received: by 2002:a05:6122:1b8d:b0:520:579d:893c with SMTP id 71dfb90a1353d-5235b64757dmr1239548e0c.1.1740787195935; Fri, 28 Feb 2025 15:59:55 -0800 (PST) Received: from c7-smtp-2023.dev.purestorage.com ([2620:125:9017:12:36:3:5:0]) by smtp-relay.gmail.com with ESMTPS id 71dfb90a1353d-5234bec414fsm230393e0c.2.2025.02.28.15.59.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2025 15:59:55 -0800 (PST) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.7.70.37]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id 6B12334028F; Fri, 28 Feb 2025 16:59:54 -0700 (MST) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 5C474E41A01; Fri, 28 Feb 2025 16:59:24 -0700 (MST) From: Caleb Sander Mateos To: Jens Axboe , Pavel Begunkov Cc: Caleb Sander Mateos , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/5] io_uring/rsrc: call io_free_node() on io_sqe_buffer_register() failure Date: Fri, 28 Feb 2025 16:59:12 -0700 Message-ID: <20250228235916.670437-3-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250228235916.670437-1-csander@purestorage.com> References: <20250228235916.670437-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 io_sqe_buffer_register() currently calls io_put_rsrc_node() if it fails to fully set up the io_rsrc_node. io_put_rsrc_node() is more involved than necessary, since we already know the reference count will reach 0 and no io_mapped_ubuf has been attached to the node yet. So just call io_free_node() to release the node's memory. This also avoids the need to temporarily set the node's buf pointer to NULL. Signed-off-by: Caleb Sander Mateos --- io_uring/rsrc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index 748a09cfaeaa..398c6f427bcc 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -780,11 +780,10 @@ static struct io_rsrc_node *io_sqe_buffer_register(struct io_ring_ctx *ctx, return NULL; node = io_rsrc_node_alloc(ctx, IORING_RSRC_BUFFER); if (!node) return ERR_PTR(-ENOMEM); - node->buf = NULL; ret = -ENOMEM; pages = io_pin_pages((unsigned long) iov->iov_base, iov->iov_len, &nr_pages); if (IS_ERR(pages)) { @@ -837,11 +836,11 @@ static struct io_rsrc_node *io_sqe_buffer_register(struct io_ring_ctx *ctx, done: if (ret) { if (imu) io_free_imu(ctx, imu); if (node) - io_put_rsrc_node(ctx, node); + io_free_node(ctx, node); node = ERR_PTR(ret); } kvfree(pages); return node; } From patchwork Fri Feb 28 23:59:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Sander Mateos X-Patchwork-Id: 13997234 Received: from mail-io1-f97.google.com (mail-io1-f97.google.com [209.85.166.97]) (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 B89E91DF74E for ; Fri, 28 Feb 2025 23:59:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.97 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740787169; cv=none; b=VKAPhp55XBlb3iuj0LZDJRU2inYeUtV5YlphnJdpc7obrjEuk0GbCHJBErx+FZ8k3AZirbcV3nTLwZXTS+3ACArKQKhBFPNeXuFVsWJi+ZdtCRI/GGcwc/0x2j1pIW0SSHUQQwXadLoEG7trs7VuvDI+iOXnOT6UA8mlWan6cL8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740787169; c=relaxed/simple; bh=QFjWgNXy9Kx8/WOzwsIn/1I5TFpqOsgdfFlTxY3gJ2I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pp0OUXY5BM0axzXY2UoOiNhVq/6FAz64EA7wVvFRdbHcM3Lf79L+AQsw2h1/GMuy/OBfeaUQR8WlMzg5NsEOIVG+NX5eYe6BBqYddD6UaugVGHH8DCIHLZ2lnKPr9c8JZUziKDMDr/7HdxnlEYUTsYw3jTBPAngBTv11UYoCWsI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=gqnn/7va; arc=none smtp.client-ip=209.85.166.97 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="gqnn/7va" Received: by mail-io1-f97.google.com with SMTP id ca18e2360f4ac-85597c291f1so6295239f.1 for ; Fri, 28 Feb 2025 15:59:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1740787166; x=1741391966; 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=hK6QOjfXK+fgEevkc21x4GT0Qq5JPIuUXpL7Fx2XzDA=; b=gqnn/7vaDIXgAqm8A5CHGZtj+IRGGog0VDj/YYCBW+1EfJ/X7ZJyR2cPp6HkHg/Yxk 8vDmP/qOG5fGRraMcV7QyFgCKHjtE6LAHhw3PXDShuz2TOxTu4MQDRs9aBhTwZZhah5I cYkuEzL3UA5XEke9Ar1wulAmRvCnEwAbiRaYEV9ST2d/79e0+1+UpRTa7F9dui+P0air 83VVNhJmADSw5k4itOjCTtOCHnrc+fSu7UsF0VPkc1tfvSjqVj4LmWIrMGayi1HBkT3w rVkc8bjzNxb4ha1j6Atvhi9l9JOgfSiGj2OJfXWELZ6F2OCYOfVX/1UDoIXIH2Ke0kHg 8MAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740787166; x=1741391966; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hK6QOjfXK+fgEevkc21x4GT0Qq5JPIuUXpL7Fx2XzDA=; b=ppTOuyHNWgPxNul2b/znkCcDu3SczUz2Y1iNBdgaszFT1FeXUksj3rYCvb32gDyWgq Rd2a+RhGHUksyPEyMc/cQFXmI7Y86rUlD3rxk8jSbQirQ4bdQhKiEHN4PoT0UbITs2Pq UQr4LzrbUw+8L/gwarLVorKjAW1nLbSrr3n+NAAAgy4oZ5OyfgDWULutZhbR78r1Fs+D cS79XrZE/pQ1FJDqKx3Dz3JAdyZBnIZbottTh96Eod2PEqep8fL+f3g8YL6E4E9ggJ99 70MbQlmFX4Ae1pLvvfbD5UHTfloYHTRQcHOM0ZP+goluCpcnxBZYylSV4Tk35mATNFdc L/8w== X-Forwarded-Encrypted: i=1; AJvYcCXORzdczidioXLnMm5girvwFnDGFUZlvz8iMGmwMAjEDqeX3CMQcdKYqrTjlumVQLqBryZqxvno3A==@vger.kernel.org X-Gm-Message-State: AOJu0YwgytF8yeprx2O0UW1dHAzW93GKJInwY7abYxTDYE2HAW/11nz1 BWOpkHSMwGb6b6sIIt5Khio64Kd2F0iu69rMeD+LYGCe4Pj8qoOTmPEJmnSBGXT2Gxo5criNLtK iU2fR/zcEEq0NRIqZ+0ZVdZtXb9UbASyh X-Gm-Gg: ASbGncsZEt02fBKC80xdARvUg/tVdSG3Ar3l4VgQ7qlDwZvc3NsiD5uTljqowmDgOBq qviL8OdIYF3pDtY6k+r40TpVrgP6oldj+0wjDj1SmKzs283kgWfSKp0Q54vT67X4pSOoiMWCMuJ S8dJlbv9fiUgpZniX9WdXs8mDZ0kN8eUU+Nkf+PmSQg5e4mcq4fTkK4FmUgwf2OCbLvLZot9cqW 5T/v75qsRNqibr7Nn4d0kmN5MyOaWHRy9Qjhp15SoptQyAdwQ7EJYopauFSLgz8VZ9fzfpu8k9Z B6UmLbp7bfzVJby6upZY3ghRhGQbqIYOCWtHcyS5UJf5wqvY X-Google-Smtp-Source: AGHT+IG/Nq900tpHhaf/0mNrSn5JRVXcZZ+nNO4WfDhJCn+LVSSYjcj85ej1aZMx9Yzu7PxQoceMQhcBDyrs X-Received: by 2002:a05:6e02:1fc7:b0:3d1:936d:1e22 with SMTP id e9e14a558f8ab-3d3e6e45d8emr12968445ab.1.1740787166685; Fri, 28 Feb 2025 15:59:26 -0800 (PST) Received: from c7-smtp-2023.dev.purestorage.com ([208.88.159.128]) by smtp-relay.gmail.com with ESMTPS id 8926c6da1cb9f-4f061c5563dsm256932173.16.2025.02.28.15.59.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2025 15:59:26 -0800 (PST) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.7.70.37]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id 8845F34028F; Fri, 28 Feb 2025 16:59:25 -0700 (MST) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 7D6AEE41AF2; Fri, 28 Feb 2025 16:59:25 -0700 (MST) From: Caleb Sander Mateos To: Jens Axboe , Pavel Begunkov Cc: Caleb Sander Mateos , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] io_uring/rsrc: avoid NULL node check on io_sqe_buffer_register() failure Date: Fri, 28 Feb 2025 16:59:13 -0700 Message-ID: <20250228235916.670437-4-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250228235916.670437-1-csander@purestorage.com> References: <20250228235916.670437-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The done: label is only reachable if node is non-NULL. So don't bother checking, just call io_free_node(). Signed-off-by: Caleb Sander Mateos --- io_uring/rsrc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index 398c6f427bcc..95def9e5f3a7 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -835,12 +835,11 @@ static struct io_rsrc_node *io_sqe_buffer_register(struct io_ring_ctx *ctx, } done: if (ret) { if (imu) io_free_imu(ctx, imu); - if (node) - io_free_node(ctx, node); + io_free_node(ctx, node); node = ERR_PTR(ret); } kvfree(pages); return node; } From patchwork Fri Feb 28 23:59:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Sander Mateos X-Patchwork-Id: 13997235 Received: from mail-pl1-f227.google.com (mail-pl1-f227.google.com [209.85.214.227]) (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 B3C001DF965 for ; Fri, 28 Feb 2025 23:59:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.227 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740787170; cv=none; b=AuTU/JMMz1bg1uZu+2ts8Q+fQwONd8aZC197SDgKRKT3TLTyU4Ay+/pUXPv+RLgx5kL6HjKuFmwq65JD/mLgJ3qoNhPQx7sU+5HxUPR0uhZpsYiFxvUug35WvJlscZStBrDR3RrC+TOyBSPW79ym/28Cdkm3uys54f7HwVXC2fc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740787170; c=relaxed/simple; bh=/ShPFdmtDi5zFWZPDuX4uvqo7DJ/+xJn2xPk55ZuQbg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K+O5zXtYFk4NnPRzzVtZW+lJvYhYk0o8Cu8ti6mbFcd0uRdmnhg6sGL2D9dSWjAhCis4flo4lZHvLJYqL58XWJi05nv4pFVblBpQK7TRzcTDvFo2jqpN3w5yyIHZ8m/Ug7G5q7DfycLk+ZBCEPas6jqkt9giLtpld4K+BVUK9R0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=Bb3+dpIj; arc=none smtp.client-ip=209.85.214.227 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="Bb3+dpIj" Received: by mail-pl1-f227.google.com with SMTP id d9443c01a7336-2234a03cfa4so6273645ad.0 for ; Fri, 28 Feb 2025 15:59:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1740787168; x=1741391968; 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=YG/WzviAKa26P9kIv9dajWRH9oVJW/MjIO0ud3obPZI=; b=Bb3+dpIjNzolqpvPRpJTdPDkx/FQNie4AbcF1y+slnYdzPXF0sf5PxMSCmr3d7DZm0 385BqwwE9IUtlAbGNOtcIeBXlc7mK1uc1EfkMKZLRmLQAR7nkfvkc+/gUavjRyW3LUin PDBz67WofuHZTS3nCWHwLXdAo+6/1IHSstmluuwcaBfXZKe7fQsWuU1ZYe6vs8Uo054d Kzua77Z+HwN7rNSgzy0Oeau1YH601ptEpvshJpoBs/VuzlTUgWTmE0IFtDOwcpCyoWrB U+lrIMFch4Zb5jnuAUEqFwJwO7yKN05RV6Wbc7BAtAYC703T1eP83TYjMOAIYlRqX2/i yD6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740787168; x=1741391968; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YG/WzviAKa26P9kIv9dajWRH9oVJW/MjIO0ud3obPZI=; b=MV/x1bt48WjD2pMwuLkoijlWdrTV71LtwMPHzO9U8GEvBt8yWuL5eyej7AELESlxHE BzSXmKU4EcjhNr/aSVn1g1sPAa12Ekz9HSqJNnN80vAzZ9J3PBvNRPnopRWrLwaForgn 3Apvq4eGiHt027hsvPwaMJ1u19g7NJhst8NV4dnybdU80/BH4/l6otdpsnap1sewfjRR g/rg5VYKAAosNJmxfkMPjZISHKNEdbaJooo72G3A3pVOaZP/8GqDY78tJTM5apQtDHXr 1mbA6KxEHrOp4GWN2Y1Y/R4Jf8ELthO2bB/cdL4lYsiPOLrgKawkc7nxAzsxIZOXM9e7 44Og== X-Forwarded-Encrypted: i=1; AJvYcCUjyr81or8VOQ90xa0VHTsJNgekZSiKAZEBq4wYIiPLpU9ReoqJnCQMYaBsBWmYBb7Auvz1tFaQVw==@vger.kernel.org X-Gm-Message-State: AOJu0YxLo8uzGE0HivudVsQ+DLn4QLPYOmx2cFTA/GsVoum6+sLFED/N duF9KpMqVvM8drOI1dRXJzk/O9yjXNzEiMkjsDasOmsVlc93ShGUftHVti8d16PL9BBXC+9RWLb +zC0Jtsetodl8nN7x5ZAliOMdvhZ8KsaXP09uzKdngUhGJzdd X-Gm-Gg: ASbGncvr4+Ix9Kc4Loq1uamxLwTpZAzMFPXlaMI8i75WV3k5SOepm0JvSls+X/5lxkd oc08MXFXDpi/n+NRt6cvFtLx5RnaXcH1RXmZqe7I5mvqf2AjU8qSHJfQ1jTbfPLkduJJEAN+M4i iAQKMuBd+tNiyO3DsEAlAUSD+RMyKnuqhKXb11eaTnscW5TQD1e9105m10L2Ulmc/S1t7XVAeu/ C/p2pmAUCSwPac4A9gX4YdEOwE3FCiJGhgQoHWDpWQd+BpAo6ML1CHNqYpqwnvTDp1ZCzNgKtpn 2L2wLr0MnhfTflXc5ZytxArNBJw/fZr26Q== X-Google-Smtp-Source: AGHT+IFHsPC6/EgweKrZsOqRp/ximYusBvGZYTTJpG1c/+bUJfy0qECQNUKeO9TX9U6nuPa28QKEjcpBKwxD X-Received: by 2002:a17:902:d541:b0:223:5525:622f with SMTP id d9443c01a7336-22368f6c10amr31026015ad.1.1740787167809; Fri, 28 Feb 2025 15:59:27 -0800 (PST) Received: from c7-smtp-2023.dev.purestorage.com ([2620:125:9017:12:36:3:5:0]) by smtp-relay.gmail.com with ESMTPS id d9443c01a7336-223501f9de3sm2367515ad.32.2025.02.28.15.59.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2025 15:59:27 -0800 (PST) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.7.70.37]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id 0807434028F; Fri, 28 Feb 2025 16:59:27 -0700 (MST) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 008E0E41AF2; Fri, 28 Feb 2025 16:59:26 -0700 (MST) From: Caleb Sander Mateos To: Jens Axboe , Pavel Begunkov Cc: Caleb Sander Mateos , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/5] io_uring/rsrc: skip NULL file/buffer checks in io_free_rsrc_node() Date: Fri, 28 Feb 2025 16:59:14 -0700 Message-ID: <20250228235916.670437-5-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250228235916.670437-1-csander@purestorage.com> References: <20250228235916.670437-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 io_rsrc_node's of type IORING_RSRC_FILE always have a file attached immediately after they are allocated. IORING_RSRC_BUFFER nodes won't be returned from io_sqe_buffer_register()/io_buffer_register_bvec() until they have a io_mapped_ubuf attached. So remove the checks for a NULL file/buffer in io_free_rsrc_node(). Signed-off-by: Caleb Sander Mateos --- io_uring/rsrc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index 95def9e5f3a7..c8b79ebcff68 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -498,16 +498,14 @@ void io_free_rsrc_node(struct io_ring_ctx *ctx, struct io_rsrc_node *node) if (node->tag) io_post_aux_cqe(ctx, node->tag, 0, 0); switch (node->type) { case IORING_RSRC_FILE: - if (io_slot_file(node)) - fput(io_slot_file(node)); + fput(io_slot_file(node)); break; case IORING_RSRC_BUFFER: - if (node->buf) - io_buffer_unmap(ctx, node->buf); + io_buffer_unmap(ctx, node->buf); break; default: WARN_ON_ONCE(1); break; }