linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: "Eric W. Biederman" <ebiederm@xmission.com>,
	Al Viro <viro@ZenIV.linux.org.uk>
Cc: linux-next@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: linux-next: manual merge of the userns tree with the vfs tree
Date: Mon, 25 May 2015 19:49:43 +1000	[thread overview]
Message-ID: <20150525194943.3ae9649d@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 3633 bytes --]

Hi Eric,

Today's linux-next merge of the userns tree got a conflict in
fs/libfs.c between commit 61ba64fc0768 ("libfs: simple_follow_link()")
from the vfs tree and commit d5044ae07353 ("fs: Add helper functions
for permanently empty directories.") from the userns tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/libfs.c
index 65e1feca8b98,02813592e121..000000000000
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@@ -1097,14 -1094,98 +1097,109 @@@ simple_nosetlease(struct file *filp, lo
  }
  EXPORT_SYMBOL(simple_nosetlease);
  
 +const char *simple_follow_link(struct dentry *dentry, void **cookie)
 +{
 +	return d_inode(dentry)->i_link;
 +}
 +EXPORT_SYMBOL(simple_follow_link);
 +
 +const struct inode_operations simple_symlink_inode_operations = {
 +	.follow_link = simple_follow_link,
 +	.readlink = generic_readlink
 +};
 +EXPORT_SYMBOL(simple_symlink_inode_operations);
+ 
+ /*
+  * Operations for a permanently empty directory.
+  */
+ static struct dentry *empty_dir_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
+ {
+ 	return ERR_PTR(-ENOENT);
+ }
+ 
+ static int empty_dir_getattr(struct vfsmount *mnt, struct dentry *dentry,
+ 				 struct kstat *stat)
+ {
+ 	struct inode *inode = d_inode(dentry);
+ 	generic_fillattr(inode, stat);
+ 	return 0;
+ }
+ 
+ static int empty_dir_setattr(struct dentry *dentry, struct iattr *attr)
+ {
+ 	return -EPERM;
+ }
+ 
+ static int empty_dir_setxattr(struct dentry *dentry, const char *name,
+ 			      const void *value, size_t size, int flags)
+ {
+ 	return -EOPNOTSUPP;
+ }
+ 
+ static ssize_t empty_dir_getxattr(struct dentry *dentry, const char *name,
+ 				  void *value, size_t size)
+ {
+ 	return -EOPNOTSUPP;
+ }
+ 
+ static int empty_dir_removexattr(struct dentry *dentry, const char *name)
+ {
+ 	return -EOPNOTSUPP;
+ }
+ 
+ static ssize_t empty_dir_listxattr(struct dentry *dentry, char *list, size_t size)
+ {
+ 	return -EOPNOTSUPP;
+ }
+ 
+ static const struct inode_operations empty_dir_inode_operations = {
+ 	.lookup		= empty_dir_lookup,
+ 	.permission	= generic_permission,
+ 	.setattr	= empty_dir_setattr,
+ 	.getattr	= empty_dir_getattr,
+ 	.setxattr	= empty_dir_setxattr,
+ 	.getxattr	= empty_dir_getxattr,
+ 	.removexattr	= empty_dir_removexattr,
+ 	.listxattr	= empty_dir_listxattr,
+ };
+ 
+ static loff_t empty_dir_llseek(struct file *file, loff_t offset, int whence)
+ {
+ 	/* An empty directory has two entries . and .. at offsets 0 and 1 */
+ 	return generic_file_llseek_size(file, offset, whence, 2, 2);
+ }
+ 
+ static int empty_dir_readdir(struct file *file, struct dir_context *ctx)
+ {
+ 	dir_emit_dots(file, ctx);
+ 	return 0;
+ }
+ 
+ static const struct file_operations empty_dir_operations = {
+ 	.llseek		= empty_dir_llseek,
+ 	.read		= generic_read_dir,
+ 	.iterate	= empty_dir_readdir,
+ 	.fsync		= noop_fsync,
+ };
+ 
+ 
+ void make_empty_dir_inode(struct inode *inode)
+ {
+ 	set_nlink(inode, 2);
+ 	inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO;
+ 	inode->i_uid = GLOBAL_ROOT_UID;
+ 	inode->i_gid = GLOBAL_ROOT_GID;
+ 	inode->i_rdev = 0;
+ 	inode->i_size = 2;
+ 	inode->i_blkbits = PAGE_SHIFT;
+ 	inode->i_blocks = 0;
+ 
+ 	inode->i_op = &empty_dir_inode_operations;
+ 	inode->i_fop = &empty_dir_operations;
+ }
+ 
+ bool is_empty_dir_inode(struct inode *inode)
+ {
+ 	return (inode->i_fop == &empty_dir_operations) &&
+ 		(inode->i_op == &empty_dir_inode_operations);
+ }

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

             reply	other threads:[~2015-05-25  9:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-25  9:49 Stephen Rothwell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-06-20  2:39 linux-next: manual merge of the userns tree with the vfs tree Stephen Rothwell
2018-08-06  7:50 ` Stephen Rothwell
2018-08-06 17:35   ` Eric W. Biederman
2018-06-20  1:44 Stephen Rothwell
2018-06-20  3:31 ` Stephen Rothwell
2018-06-19  4:56 Stephen Rothwell
2018-06-19 10:11 ` Eric W. Biederman
2014-12-16  3:21 Stephen Rothwell
2014-12-16  4:40 ` Eric W. Biederman
2014-12-10  6:27 Stephen Rothwell
2014-12-10  6:21 Stephen Rothwell
2013-11-08  6:50 Stephen Rothwell
2013-11-08  6:50 Stephen Rothwell
2013-11-08  6:49 Stephen Rothwell
2013-11-08  6:49 Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150525194943.3ae9649d@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).