aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/fuse/fuse_i.h1
-rw-r--r--fs/fuse/inode.c7
-rw-r--r--fs/fuse/xattr.c43
3 files changed, 51 insertions, 0 deletions
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index f630951df8dc..5256ad333b05 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -985,6 +985,7 @@ ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size);
985int fuse_removexattr(struct inode *inode, const char *name); 985int fuse_removexattr(struct inode *inode, const char *name);
986extern const struct xattr_handler *fuse_xattr_handlers[]; 986extern const struct xattr_handler *fuse_xattr_handlers[];
987extern const struct xattr_handler *fuse_acl_xattr_handlers[]; 987extern const struct xattr_handler *fuse_acl_xattr_handlers[];
988extern const struct xattr_handler *fuse_no_acl_xattr_handlers[];
988 989
989struct posix_acl; 990struct posix_acl;
990struct posix_acl *fuse_get_acl(struct inode *inode, int type); 991struct posix_acl *fuse_get_acl(struct inode *inode, int type);
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 1643043d4fe5..22c76cf8c2e3 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -1100,6 +1100,13 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
1100 file->f_cred->user_ns != sb->s_user_ns) 1100 file->f_cred->user_ns != sb->s_user_ns)
1101 goto err_fput; 1101 goto err_fput;
1102 1102
1103 /*
1104 * If we are not in the initial user namespace posix
1105 * acls must be translated.
1106 */
1107 if (sb->s_user_ns != &init_user_ns)
1108 sb->s_xattr = fuse_no_acl_xattr_handlers;
1109
1103 fc = kmalloc(sizeof(*fc), GFP_KERNEL); 1110 fc = kmalloc(sizeof(*fc), GFP_KERNEL);
1104 err = -ENOMEM; 1111 err = -ENOMEM;
1105 if (!fc) 1112 if (!fc)
diff --git a/fs/fuse/xattr.c b/fs/fuse/xattr.c
index 3caac46b08b0..433717640f78 100644
--- a/fs/fuse/xattr.c
+++ b/fs/fuse/xattr.c
@@ -192,6 +192,26 @@ static int fuse_xattr_set(const struct xattr_handler *handler,
192 return fuse_setxattr(inode, name, value, size, flags); 192 return fuse_setxattr(inode, name, value, size, flags);
193} 193}
194 194
195static bool no_xattr_list(struct dentry *dentry)
196{
197 return false;
198}
199
200static int no_xattr_get(const struct xattr_handler *handler,
201 struct dentry *dentry, struct inode *inode,
202 const char *name, void *value, size_t size)
203{
204 return -EOPNOTSUPP;
205}
206
207static int no_xattr_set(const struct xattr_handler *handler,
208 struct dentry *dentry, struct inode *nodee,
209 const char *name, const void *value,
210 size_t size, int flags)
211{
212 return -EOPNOTSUPP;
213}
214
195static const struct xattr_handler fuse_xattr_handler = { 215static const struct xattr_handler fuse_xattr_handler = {
196 .prefix = "", 216 .prefix = "",
197 .get = fuse_xattr_get, 217 .get = fuse_xattr_get,
@@ -209,3 +229,26 @@ const struct xattr_handler *fuse_acl_xattr_handlers[] = {
209 &fuse_xattr_handler, 229 &fuse_xattr_handler,
210 NULL 230 NULL
211}; 231};
232
233static const struct xattr_handler fuse_no_acl_access_xattr_handler = {
234 .name = XATTR_NAME_POSIX_ACL_ACCESS,
235 .flags = ACL_TYPE_ACCESS,
236 .list = no_xattr_list,
237 .get = no_xattr_get,
238 .set = no_xattr_set,
239};
240
241static const struct xattr_handler fuse_no_acl_default_xattr_handler = {
242 .name = XATTR_NAME_POSIX_ACL_DEFAULT,
243 .flags = ACL_TYPE_ACCESS,
244 .list = no_xattr_list,
245 .get = no_xattr_get,
246 .set = no_xattr_set,
247};
248
249const struct xattr_handler *fuse_no_acl_xattr_handlers[] = {
250 &fuse_no_acl_access_xattr_handler,
251 &fuse_no_acl_default_xattr_handler,
252 &fuse_xattr_handler,
253 NULL
254};