From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753396AbcH3Odu (ORCPT ); Tue, 30 Aug 2016 10:33:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38384 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750798AbcH3Odq (ORCPT ); Tue, 30 Aug 2016 10:33:46 -0400 Date: Tue, 30 Aug 2016 16:33:12 +0200 From: Oleg Nesterov To: Dmitry Safonov Cc: linux-kernel@vger.kernel.org, mingo@redhat.com, luto@amacapital.net, tglx@linutronix.de, hpa@zytor.com, x86@kernel.org, 0x7f454c46@gmail.com, rostedt@goodmis.org, viro@zeniv.linux.org.uk Subject: Re: [RFC 1/3] x86/vdso: create vdso file, use it for mapping Message-ID: <20160830143311.GA23007@redhat.com> References: <20160825152110.25663-1-dsafonov@virtuozzo.com> <20160825152110.25663-2-dsafonov@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160825152110.25663-2-dsafonov@virtuozzo.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 30 Aug 2016 14:33:45 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/25, Dmitry Safonov wrote: > > +static __init struct file *init_vdso_file(const struct vdso_image *vdso_image, > + const char *name) > +{ > + struct super_block *sb; > + struct qstr name_str; > + struct inode *inode; > + struct path path; > + struct file *res; > + > + if (IS_ERR(vdso_mnt)) > + return ERR_CAST(vdso_mnt); > + sb = vdso_mnt->mnt_sb; > + > + name_str.hash = 0; > + name_str.len = strlen(name); > + name_str.name = name; > + > + res = ERR_PTR(-ENOMEM); > + path.mnt = mntget(vdso_mnt); > + path.dentry = d_alloc_pseudo(sb, &name_str); > + if (!path.dentry) > + goto put_path; > + d_set_d_op(path.dentry, &vdso_dops); > + > + res = ERR_PTR(-ENOSPC); > + inode = ramfs_get_inode(sb, NULL, S_IFREG | S_IRUGO | S_IXUGO, 0); > + if (!inode) > + goto put_path; > + > + inode->i_flags |= S_PRIVATE; > + d_instantiate(path.dentry, inode); > + inode->i_size = vdso_image->size; > + > + res = ERR_PTR(add_vdso_pages_to_page_cache(vdso_image, inode)); > + if (IS_ERR(res)) > + goto put_path; > + > + res = alloc_file(&path, FMODE_READ, &ramfs_file_operations); > + if (!IS_ERR(res)) > + return res; > + > +put_path: > + path_put(&path); > + return res; > +} Not sure... I think alloc_anon_inode() makes more sense. Perhaps you can look at fs/aio.c and extract some bits of code into the new helpers which could be used by both aio_fs and vdso_fs? Oleg.