Re: [PATCH 19/32] VFS: Implement fsopen() to prepare for a mount [ver #8]
From: Al Viro
Date: Thu May 31 2018 - 17:26:08 EST
On Fri, May 25, 2018 at 01:07:27AM +0100, David Howells wrote:
> + inode = alloc_anon_inode(fscontext_fs_mnt->mnt_sb);
> + if (IS_ERR(inode))
> + return ERR_CAST(inode);
> + inode->i_fop = &fscontext_fs_fops;
That's almost certainly wrong - you need it only if you want it possible to
reopen via /proc/*/fd/*
> + fc->phase = FS_CONTEXT_CREATE_PARAMS;
> +
> + ret = -ENOMEM;
> + path.dentry = d_alloc_pseudo(fscontext_fs_mnt->mnt_sb, &empty_name);
> + if (!path.dentry)
> + goto err_inode;
> + path.mnt = mntget(fscontext_fs_mnt);
> +
> + d_instantiate(path.dentry, inode);
> +
> + f = alloc_file(&path, FMODE_READ | FMODE_WRITE, &fscontext_fs_fops);
Re your question on IRC - we might want that fs in longer run, but for now
just go with anon_inode_getfile() here. Easier that way and we can always
switch later.