Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2365707imm; Tue, 10 Jul 2018 19:25:06 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcv1ANFcG1Dp+8+F6sbpXMwBhgy/+MqhacA3+ZWMdlEIyYCBdmVaHrORcQCvPmNNS0Nkz6b X-Received: by 2002:a63:af14:: with SMTP id w20-v6mr19566457pge.47.1531275906178; Tue, 10 Jul 2018 19:25:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531275906; cv=none; d=google.com; s=arc-20160816; b=t3AvxjTfc50m8caWu1ypsgsU2/r8NDGPnjqNFmstsrdkl5gTg/wj9nEI7hZxt/UWDw j6x3OIUWMKs66zreE7tBsZrNv4toVuut6b5qHhbpBG3ZilQQmfgROIfcKbU8/AbjSWGI sEpCFJsS/r1K+k9kfxPFv/GvnRstGi0MKMa0k63k93XVtgiXzQWH5IkXX7hPTXKAHbym U8pcscS+eoPJ1bOEgWrLCZ0gmH7AOsNjxtSRM0s1QCwZc0j0CubRE1xYy1aYhuCpBtPJ AoOjQVkl78vPp6BV7pQNlD/udkGFHVeI3l3aikSc6dFR+t5rKDovJ+ACqD51frVeeqJe 8DEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=rIVMR8OP9MP3v67NySuew9Xs24oT9pZM3w9R5Hm7Qlo=; b=uQVLlzWum0gDfjqoim1nb9eQ0NIEETliJKGv4DGC7ET+ZxxHJNEFCVzhP+c8R4YlgM DxF7BjgPx07Iy8CdBvNg7700eEOttd0o+ev3FoIp7mUZSbRy5pJ2njUpMqJrO11htVAF Ri0Z473Yt4+8a/T/ECeeWkWLnT7ZGcMCs2X0jUwG29l7fKxdLSZ6AQkN+wDh0aiq3Pb8 OM/zE3KBOgkIQYsElhWQIyDWQT1U7YI8quDNoOjiGgv0tpHPyuB0JqTIGb4KQV7PGIqb fKNZN/98fIW4973HPLV5EdCzzJ2hbDrFgiUTscVdrAUo3ye3yYVl8c//OpMgq3NVNELe ukaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e98-v6si18599336plb.150.2018.07.10.19.24.51; Tue, 10 Jul 2018 19:25:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732617AbeGKCYH (ORCPT + 99 others); Tue, 10 Jul 2018 22:24:07 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:45694 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732558AbeGKCYH (ORCPT ); Tue, 10 Jul 2018 22:24:07 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1fd4le-0003L6-86; Wed, 11 Jul 2018 02:22:10 +0000 From: Al Viro To: Linus Torvalds Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Miklos Szeredi Subject: [RFC][PATCH 34/42] anon_inode_getfile(): switch to alloc_file_pseudo() Date: Wed, 11 Jul 2018 03:21:58 +0100 Message-Id: <20180711022206.12571-34-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180711022206.12571-1-viro@ZenIV.linux.org.uk> References: <20180711021136.GN30522@ZenIV.linux.org.uk> <20180711022206.12571-1-viro@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro Signed-off-by: Al Viro --- fs/anon_inodes.c | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c index 3168ee4e77f4..7e13edd23db1 100644 --- a/fs/anon_inodes.c +++ b/fs/anon_inodes.c @@ -71,8 +71,6 @@ struct file *anon_inode_getfile(const char *name, const struct file_operations *fops, void *priv, int flags) { - struct qstr this; - struct path path; struct file *file; if (IS_ERR(anon_inode_inode)) @@ -82,29 +80,15 @@ struct file *anon_inode_getfile(const char *name, return ERR_PTR(-ENOENT); /* - * Link the inode to a directory entry by creating a unique name - * using the inode sequence number. - */ - file = ERR_PTR(-ENOMEM); - this.name = name; - this.len = strlen(name); - this.hash = 0; - path.dentry = d_alloc_pseudo(anon_inode_mnt->mnt_sb, &this); - if (!path.dentry) - goto err_module; - - path.mnt = mntget(anon_inode_mnt); - /* * We know the anon_inode inode count is always greater than zero, * so ihold() is safe. */ ihold(anon_inode_inode); - - d_instantiate(path.dentry, anon_inode_inode); - - file = alloc_file(&path, OPEN_FMODE(flags), fops); + file = alloc_file_pseudo(anon_inode_inode, anon_inode_mnt, name, + OPEN_FMODE(flags), fops); if (IS_ERR(file)) - goto err_dput; + goto err; + file->f_mapping = anon_inode_inode->i_mapping; file->f_flags = flags & (O_ACCMODE | O_NONBLOCK); @@ -112,9 +96,8 @@ struct file *anon_inode_getfile(const char *name, return file; -err_dput: - path_put(&path); -err_module: +err: + iput(anon_inode_inode); module_put(fops->owner); return file; } -- 2.11.0