ovl: define ->get_acl() for overlay inodes

Now we are planning to do DAC permission checks on overlay inode
itself. And to make it work, we will need to make sure we can get acls from
underlying inode. So define ->get_acl() for overlay inodes and this in turn
calls into underlying filesystem to get acls, if any.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
Vivek Goyal
2016-07-01 16:34:26 -04:00
committed by Miklos Szeredi
parent 72e4848181
commit 39a25b2b37
4 changed files with 28 additions and 0 deletions

View File

@ -310,6 +310,22 @@ out:
return err;
}
struct posix_acl *ovl_get_acl(struct inode *inode, int type)
{
struct inode *realinode = ovl_inode_real(inode);
if (!realinode)
return ERR_PTR(-ENOENT);
if (!IS_POSIXACL(realinode))
return NULL;
if (!realinode->i_op->get_acl)
return NULL;
return realinode->i_op->get_acl(realinode, type);
}
static bool ovl_open_need_copy_up(int flags, enum ovl_path_type type,
struct dentry *realdentry)
{
@ -354,6 +370,7 @@ static const struct inode_operations ovl_file_inode_operations = {
.getxattr = ovl_getxattr,
.listxattr = ovl_listxattr,
.removexattr = ovl_removexattr,
.get_acl = ovl_get_acl,
};
static const struct inode_operations ovl_symlink_inode_operations = {