Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp156699ybj; Fri, 8 May 2020 08:38:51 -0700 (PDT) X-Google-Smtp-Source: APiQypJh676EwRTF/fHvjs3S9EX4J/ug9MHGcfg1GB5nBt6E4RqysH2/n6muT12iv2m8WbgjfFqZ X-Received: by 2002:a05:6402:1fc:: with SMTP id i28mr2617363edy.18.1588952331437; Fri, 08 May 2020 08:38:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588952331; cv=none; d=google.com; s=arc-20160816; b=o17t1benguKW3Iihm5yR63I4kd4caKazutz20t3QHBWjq/ajfLIwrU/4OjxLqbGeLI jwqrosl9kulexEnu6ZSfB2LZth1HGPl+aVSOX/stiTbpMxGCFVuXyiXzbP5zOsGK0qKR kjf1rY/bt4BvhKL64kWE1aMQwR0hBfhf+Zvc90idyr/o67S1DW6FmxRXp3YJNfdTAYgF jD6jJAiI1UYfe7elbJmRa5LMIBN4/zxvOOlJs9hosoovzOwKpepNNrTqmbJgNw9L6exW GSoS6wss+kO4QvOCoujtJGMG6oEXwJNYWibfY21UESYdOx3+naC5ry568EUCXgGH4yWd 8RlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=84Q6+XvESATHkPDs3NezzlHWwc4KFGjN8N6drGU+t58=; b=oftxYA8j4JaK1XwZjnN/vEpx+zMODMtG+gel3zgDBuq1vXluiZJgU3XrDmrVn4iXs+ TixdR/daFryKdEZPcPKow59X7ZwnmgT2cV8aTuj7UuEY4efhRt5zyD9Yo4IFhkiyoTYo j+SffOc5dqu1UaOGKIwpctDa5GOIsxNuO/GA0tyEhxlbMCyKTuc1htCue6XEs/XzUGh+ nyl7BXxr0p+opQiMWt1kHcqkd9iZu3ABAcGCitGU+5xEfb5NghozZ3/KThnV17QXpf9g t8lJBUhFaCvtdWFZgeYOOMix3ug24ZZNL8y8C65UISobLMrSnUDuYNPA4atOEPDJeIzF OwTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=AWoCrBmc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b16si1110693edr.270.2020.05.08.08.38.28; Fri, 08 May 2020 08:38:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=AWoCrBmc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728271AbgEHPgy (ORCPT + 99 others); Fri, 8 May 2020 11:36:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726736AbgEHPgw (ORCPT ); Fri, 8 May 2020 11:36:52 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9235C061A0C; Fri, 8 May 2020 08:36:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=84Q6+XvESATHkPDs3NezzlHWwc4KFGjN8N6drGU+t58=; b=AWoCrBmcbiNeSqG41R8zejRyGu q9id5MMqFDnvfrZaKfLud0DzqWzP81fdQM2386RtOX+d1YUMf/xfAOiVUr699SfUMz7BTaVNStXYL URpd5PGUP47QmFtYhFKrjV9Chp+yOi6JLX3053q5fnCJsoCaJC0JS55pAMk20L88eIz9rHxZgVuGV yjg4TCdQyTS/tDFunEk4vcDsvmGZCUFGy9Yo0DcC3s6+nRk9Or5FqCiCQQmg/86acEJlB6AwC/r2W ha+mGlYY+7L0ukMxEOgVwW3F6ckPe0jf7choEDgXl4CQfuHU79gbeHfvDNAxNZBTXBT7Mjx37VB6E BcK7J1bg==; Received: from [2001:4bb8:180:9d3f:90d7:9df8:7cd:3504] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jX53T-0004BL-6n; Fri, 08 May 2020 15:36:51 +0000 From: Christoph Hellwig To: Alexander Viro Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org, kvm@vger.kernel.org, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH 05/12] io_uring: use __anon_inode_getfd Date: Fri, 8 May 2020 17:36:27 +0200 Message-Id: <20200508153634.249933-6-hch@lst.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200508153634.249933-1-hch@lst.de> References: <20200508153634.249933-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use __anon_inode_getfd instead of opencoding the logic using get_unused_fd_flags + anon_inode_getfile. Signed-off-by: Christoph Hellwig --- fs/io_uring.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 5190bfb6a6657..4104f8a45d11e 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -7709,18 +7709,11 @@ static int io_uring_get_fd(struct io_ring_ctx *ctx) return ret; #endif - ret = get_unused_fd_flags(O_RDWR | O_CLOEXEC); + ret = __anon_inode_getfd("[io_uring]", &io_uring_fops, ctx, + O_RDWR | O_CLOEXEC, &file); if (ret < 0) goto err; - file = anon_inode_getfile("[io_uring]", &io_uring_fops, ctx, - O_RDWR | O_CLOEXEC); - if (IS_ERR(file)) { - put_unused_fd(ret); - ret = PTR_ERR(file); - goto err; - } - #if defined(CONFIG_UNIX) ctx->ring_sock->file = file; #endif -- 2.26.2