[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210322144916.137245-3-mszeredi@redhat.com>
Date: Mon, 22 Mar 2021 15:49:00 +0100
From: Miklos Szeredi <mszeredi@...hat.com>
To: linux-fsdevel@...r.kernel.org
Cc: Al Viro <viro@...IV.linux.org.uk>, linux-kernel@...r.kernel.org,
Christoph Hellwig <hch@....de>, Tyler Hicks <code@...icks.com>
Subject: [PATCH v2 02/18] ecryptfs: stack miscattr ops
Add stacking for the miscattr operations.
Signed-off-by: Miklos Szeredi <mszeredi@...hat.com>
Cc: Tyler Hicks <code@...icks.com>
---
fs/ecryptfs/inode.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 18e9285fbb4c..b7d18583c50f 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -18,6 +18,7 @@
#include <linux/fs_stack.h>
#include <linux/slab.h>
#include <linux/xattr.h>
+#include <linux/miscattr.h>
#include <asm/unaligned.h>
#include "ecryptfs_kernel.h"
@@ -1118,6 +1119,23 @@ static int ecryptfs_removexattr(struct dentry *dentry, struct inode *inode,
return rc;
}
+static int ecryptfs_miscattr_get(struct dentry *dentry, struct miscattr *ma)
+{
+ return vfs_miscattr_get(ecryptfs_dentry_to_lower(dentry), ma);
+}
+
+static int ecryptfs_miscattr_set(struct user_namespace *mnt_userns,
+ struct dentry *dentry, struct miscattr *ma)
+{
+ struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
+ int rc;
+
+ rc = vfs_miscattr_set(&init_user_ns, lower_dentry, ma);
+ fsstack_copy_attr_all(d_inode(dentry), d_inode(lower_dentry));
+
+ return rc;
+}
+
const struct inode_operations ecryptfs_symlink_iops = {
.get_link = ecryptfs_get_link,
.permission = ecryptfs_permission,
@@ -1139,6 +1157,8 @@ const struct inode_operations ecryptfs_dir_iops = {
.permission = ecryptfs_permission,
.setattr = ecryptfs_setattr,
.listxattr = ecryptfs_listxattr,
+ .miscattr_get = ecryptfs_miscattr_get,
+ .miscattr_set = ecryptfs_miscattr_set,
};
const struct inode_operations ecryptfs_main_iops = {
@@ -1146,6 +1166,8 @@ const struct inode_operations ecryptfs_main_iops = {
.setattr = ecryptfs_setattr,
.getattr = ecryptfs_getattr,
.listxattr = ecryptfs_listxattr,
+ .miscattr_get = ecryptfs_miscattr_get,
+ .miscattr_set = ecryptfs_miscattr_set,
};
static int ecryptfs_xattr_get(const struct xattr_handler *handler,
--
2.30.2
Powered by blists - more mailing lists