Permalink
Browse files

Merge branch 'master' of git@github.com:zfs-linux/lzfs into debian

Conflicts:

	module/lzfs_vnops.c
	module/lzfs_xattr.c
	module/lzfs_xattr_security.c
	module/lzfs_xattr_user.c
  • Loading branch information...
2 parents 5c1fd23 + a558438 commit 564f4a82bde0dd1832a1eb6e7cbc28ec08f4c621 @tushk2 tushk2 committed Feb 16, 2011
Showing with 695 additions and 209 deletions.
  1. +26 −2 include/lzfs_xattr.h
  2. +1 −0 module/Makefile.in
  3. +1 −0 module/lzfs_super.c
  4. +76 −45 module/lzfs_vnops.c
  5. +76 −27 module/lzfs_xattr.c
  6. +450 −0 module/lzfs_xattr_acl.c
  7. +34 −69 module/lzfs_xattr_security.c
  8. +31 −66 module/lzfs_xattr_user.c
View
@@ -12,16 +12,40 @@ ssize_t
lzfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
extern struct xattr_handler lzfs_xattr_user_handler;
-
extern struct xattr_handler lzfs_xattr_security_handler;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)
+extern struct xattr_handler lzfs_xattr_acl_access_handler;
+extern struct xattr_handler lzfs_xattr_acl_default_handler;
+#endif
+
int
lzfs_xattr_get(struct inode *inode, const char *name,
- void *buffer, size_t size, int);
+ void *buffer, size_t size, const char *xattr_name);
+
+int
+lzfs_xattr_set(struct inode *inode, const char *name,
+ void *buffer, size_t size, const char *xattr_name);
+
int
lzfs_removexattr(struct dentry *dentry, const char *name);
int
lzfs_init_security(struct dentry *dentry, struct inode *dir);
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)
+extern int
+lzfs_acl_init(struct inode *inode, struct inode *dir);
+
+extern int
+lzfs_acl_chmod(struct inode *inode);
+
+extern int
+lzfs_check_acl(struct inode *inode, int mask);
+#endif
+
+extern int
+lzfs_vnop_setattr(struct dentry *dentry, struct iattr *iattr);
+
#endif /* _LZFS_XATTR_H */
View
@@ -14,6 +14,7 @@ lzfs-objs += lzfs_exportfs.o
lzfs-objs += lzfs_xattr.o
lzfs-objs += lzfs_xattr_user.o
lzfs-objs += lzfs_xattr_security.o
+lzfs-objs += lzfs_xattr_acl.o
INSTALL=/usr/bin/install
View
@@ -258,6 +258,7 @@ lzfs_fill_super(struct super_block *sb, void *data, int silent)
sb->s_op = &lzfs_ops;
sb->s_time_gran = 1;
sb->s_flags = MS_ACTIVE;
+ sb->s_flags |= MS_POSIXACL;
sb->s_export_op = &zfs_export_ops;
sb->s_xattr = lzfs_xattr_handlers;
error = zfs_domount(vfsp, data);
View
@@ -27,7 +27,6 @@
#include <sys/tsd.h>
#include <linux/writeback.h>
#include <lzfs_snap.h>
-#include <linux/fsync_compat.h>
#include <linux/xattr.h>
#include <lzfs_xattr.h>
@@ -98,7 +97,7 @@ lzfs_vnop_create(struct inode *dir, struct dentry *dentry, int mode,
vattr_t *vap;
const cred_t *cred = get_current_cred();
- int err, se_err;
+ int err;
SENTRY;
err = checkname((char *)dentry->d_name.name);
@@ -122,20 +121,21 @@ lzfs_vnop_create(struct inode *dir, struct dentry *dentry, int mode,
(void)put_cred(cred);
kfree(vap);
if (err) {
- tsd_exit();
- SEXIT;
- return PTR_ERR(ERR_PTR(-err));
+ err = -err;
+ goto failed;
}
d_instantiate(dentry, LZFS_VTOI(vp));
- se_err = lzfs_init_security(dentry, dir);
- if(se_err) {
- tsd_exit();
- SEXIT;
- return se_err;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)
+ if ((err = lzfs_acl_init(dentry->d_inode, dir))) {
+ /* XXX need more error handling */
+ goto failed;
}
+#endif
+ err = lzfs_init_security(dentry, dir);
+failed:
tsd_exit();
SEXIT;
- return 0;
+ return err;
}
/* Read the directory. It uses the filldir function provided by Linux kernel.
@@ -281,7 +281,7 @@ lzfs_vnop_symlink (struct inode *dir, struct dentry *dentry,
vnode_t *vp;
vattr_t *vap;
const cred_t *cred = get_current_cred();
- int err, se_err;
+ int err;
SENTRY;
err = checkname((char *)dentry->d_name.name);
if(err)
@@ -303,20 +303,22 @@ lzfs_vnop_symlink (struct inode *dir, struct dentry *dentry,
kfree(vap);
(void)put_cred(cred);
if (err) {
- tsd_exit();
- SEXIT;
- return PTR_ERR(ERR_PTR(-err));
+ err = -err;
+ goto failed;
}
d_instantiate(dentry, LZFS_VTOI(vp));
- se_err = lzfs_init_security(dentry, dir);
- if(se_err) {
- tsd_exit();
- SEXIT;
- return se_err;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)
+ err = lzfs_acl_init(dentry->d_inode, dir);
+ if(err) {
+ /* XXX error handling */
+ goto failed;
}
+#endif
+ err = lzfs_init_security(dentry, dir);
+failed:
tsd_exit();
SEXIT;
- return 0;
+ return err;
}
static int
@@ -326,7 +328,7 @@ lzfs_vnop_mkdir(struct inode *dir, struct dentry *dentry, int mode)
vnode_t *dvp;
vattr_t *vap;
const cred_t *cred = get_current_cred();
- int err, se_err;
+ int err;
SENTRY;
err = checkname((char *)dentry->d_name.name);
if(err)
@@ -346,21 +348,22 @@ lzfs_vnop_mkdir(struct inode *dir, struct dentry *dentry, int mode)
kfree(vap);
(void)put_cred(cred);
if (err) {
- tsd_exit();
- SEXIT;
- return PTR_ERR(ERR_PTR(-err));
+ err = -err;
+ goto failed;
}
d_instantiate(dentry, LZFS_VTOI(vp));
- se_err = lzfs_init_security(dentry, dir);
- if(se_err) {
- tsd_exit();
- SEXIT;
- return se_err;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)
+ err = lzfs_acl_init(dentry->d_inode,dir);
+ if(err) {
+ /* XXX error handling */
+ goto failed;
}
-
+#endif
+ err = lzfs_init_security(dentry, dir);
+failed:
tsd_exit();
SEXIT;
- return 0;
+ return err;
}
static int
@@ -397,7 +400,7 @@ lzfs_vnop_mknod(struct inode * dir, struct dentry *dentry, int mode,
vattr_t *vap;
const cred_t *cred = get_current_cred();
- int err, se_err;
+ int err;
SENTRY;
vap = kmalloc(sizeof(vattr_t), GFP_KERNEL);
ASSERT(vap != NULL);
@@ -423,21 +426,24 @@ lzfs_vnop_mknod(struct inode * dir, struct dentry *dentry, int mode,
(void)put_cred(cred);
kfree(vap);
if (err) {
- tsd_exit();
- SEXIT;
- return PTR_ERR(ERR_PTR(-err));
+ err = -err;
+ goto failed;
}
d_instantiate(dentry, LZFS_VTOI(vp));
- se_err = lzfs_init_security(dentry, dir);
- if(se_err) {
- tsd_exit();
- SEXIT;
- return se_err;
+ init_special_inode(dentry->d_inode,mode,rdev);
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)
+ err = lzfs_acl_init(dentry->d_inode,dir);
+ if(err) {
+ /* XXX error handling */
+ goto failed;
}
+#endif
+ err = lzfs_init_security(dentry, dir);
+failed:
tsd_exit();
SEXIT;
- return 0;
+ return err;
}
static int
@@ -526,6 +532,11 @@ lzfs_vnop_setattr(struct dentry *dentry, struct iattr *iattr)
err = zfs_setattr(vp, vap, 0, (cred_t *)cred, NULL);
kfree(vap);
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)
+ if(mask & ATTR_MODE){
+ lzfs_acl_chmod(inode);
+ }
+#endif
(void)put_cred(cred);
tsd_exit();
SEXIT;
@@ -534,12 +545,15 @@ lzfs_vnop_setattr(struct dentry *dentry, struct iattr *iattr)
return 0;
}
+#if 0
int
lzfs_vnop_permission(struct inode *inode, int mask)
{
return generic_permission(inode, mask, NULL);
}
+#endif
+
static void lzfs_put_link(struct dentry *dentry, struct nameidata *nd, void *ptr)
{
char *buf = nd_get_link(nd);
@@ -622,13 +636,24 @@ lzfs_vnop_readlink(struct dentry *dentry, char __user *buf, int len)
return ((int) (len - uio.uio_resid));
}
#endif
-LZFS_VNOP_FSYNC_HANDLER(lzfs_vnop_fsync)
+
+#ifdef HAVE_3ARGS_FILE_FSYNC
+int lzfs_vnop_fsync(struct file *filep, struct dentry *dentry, int datasync)
+#else
+int lzfs_vnop_fsync(struct file *filep, int datasync)
+#endif
{
int err = 0;
vnode_t *vp = NULL;
const cred_t *cred = get_current_cred();
+ struct inode *inode;
SENTRY;
+#ifdef HAVE_3ARGS_FILE_FSYNC
+ inode = dentry->d_inode;
+#else
+ inode = filep->f_mapping->host;
+#endif
vp = LZFS_ITOV(filep->f_path.dentry->d_inode);
err = zfs_fsync(vp, datasync, (cred_t *)cred, NULL);
@@ -1194,7 +1219,10 @@ const struct inode_operations zfs_inode_operations = {
.mknod = lzfs_vnop_mknod,
.rename = lzfs_vnop_rename,
.setattr = lzfs_vnop_setattr,
- //.permission = lzfs_vnop_permission,
+// .permission = lzfs_vnop_permission,
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)
+ .check_acl = lzfs_check_acl,
+#endif
.setxattr = generic_setxattr,
.getxattr = generic_getxattr,
.listxattr = lzfs_listxattr,
@@ -1225,7 +1253,10 @@ const struct inode_operations zfs_dir_inode_operations ={
.mknod = lzfs_vnop_mknod,
.rename = lzfs_vnop_rename,
.setattr = lzfs_vnop_setattr,
- //.permission = lzfs_vnop_permission,
+// .permission = lzfs_vnop_permission,
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)
+ .check_acl = lzfs_check_acl,
+#endif
.setxattr = generic_setxattr,
.getxattr = generic_getxattr,
.listxattr = lzfs_listxattr,
Oops, something went wrong.

0 comments on commit 564f4a8

Please sign in to comment.