X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Fzpl_xattr.c;h=82787cb2d29c23269ad96ba542fdd403f9956705;hb=0d3ac5e7356d29fbb7d2880c0a0c457656355ca0;hp=86e52f791ec762ef4a5049c43f58a3de545e8cfc;hpb=777d4af89137907adc91377327505f40c296035d;p=zfs.git diff --git a/module/zfs/zpl_xattr.c b/module/zfs/zpl_xattr.c index 86e52f7..82787cb 100644 --- a/module/zfs/zpl_xattr.c +++ b/module/zfs/zpl_xattr.c @@ -110,11 +110,11 @@ zpl_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size) struct inode *ip = dentry->d_inode; struct inode *dxip = NULL; loff_t pos = 3; /* skip '.', '..', and '.zfs' entries. */ - cred_t *cr; + cred_t *cr = CRED(); int error; xattr_filldir_t xf = { buffer_size, 0, buffer, ip }; - cr = (cred_t *)get_current_cred(); + crhold(cr); /* Lookup the xattr directory */ error = -zfs_lookup(ip, NULL, &dxip, LOOKUP_XATTR, cr, NULL, NULL); @@ -135,7 +135,7 @@ out: if (dxip) iput(dxip); - put_cred(cr); + crfree(cr); return (error); } @@ -145,10 +145,10 @@ zpl_xattr_get(struct inode *ip, const char *name, void *buf, size_t size) { struct inode *dxip = NULL; struct inode *xip = NULL; - cred_t *cr; + cred_t *cr = CRED(); int error; - cr = (cred_t *)get_current_cred(); + crhold(cr); /* Lookup the xattr directory */ error = -zfs_lookup(ip, NULL, &dxip, LOOKUP_XATTR, cr, NULL, NULL); @@ -173,7 +173,7 @@ out: if (dxip) iput(dxip); - put_cred(cr); + crfree(cr); if (error == -ENOENT) error = -ENODATA; @@ -188,11 +188,11 @@ zpl_xattr_set(struct inode *ip, const char *name, const void *value, struct inode *dxip = NULL; struct inode *xip = NULL; vattr_t *vap = NULL; - cred_t *cr; + cred_t *cr = CRED(); ssize_t wrote; int error; - cr = (cred_t *)get_current_cred(); + crhold(cr); /* Lookup the xattr directory and create it if required. */ error = -zfs_lookup(ip, NULL, &dxip, LOOKUP_XATTR | CREATE_XATTR_DIR, @@ -232,8 +232,8 @@ zpl_xattr_set(struct inode *ip, const char *name, const void *value, vap = kmem_zalloc(sizeof(vattr_t), KM_SLEEP); vap->va_mode = S_IFREG | 0644; vap->va_mask = ATTR_MODE; - vap->va_uid = current_fsuid(); - vap->va_gid = current_fsgid(); + vap->va_uid = crgetfsuid(cr); + vap->va_gid = crgetfsgid(cr); error = -zfs_create(dxip, (char *)name, vap, 0, 0644, &xip, cr, 0, NULL); @@ -256,7 +256,7 @@ out: if (dxip) iput(dxip); - put_cred(cr); + crfree(cr); if (error == -ENOENT) error = -ENODATA; @@ -266,7 +266,7 @@ out: } static int -zpl_xattr_user_get(struct inode *ip, const char *name, +__zpl_xattr_user_get(struct inode *ip, const char *name, void *buffer, size_t size) { char *xattr_name; @@ -284,9 +284,10 @@ zpl_xattr_user_get(struct inode *ip, const char *name, return (error); } +ZPL_XATTR_GET_WRAPPER(zpl_xattr_user_get); static int -zpl_xattr_user_set(struct inode *ip, const char *name, +__zpl_xattr_user_set(struct inode *ip, const char *name, const void *value, size_t size, int flags) { char *xattr_name; @@ -304,6 +305,7 @@ zpl_xattr_user_set(struct inode *ip, const char *name, return (error); } +ZPL_XATTR_SET_WRAPPER(zpl_xattr_user_set); xattr_handler_t zpl_xattr_user_handler = { .prefix = XATTR_USER_PREFIX, @@ -312,7 +314,7 @@ xattr_handler_t zpl_xattr_user_handler = { }; static int -zpl_xattr_trusted_get(struct inode *ip, const char *name, +__zpl_xattr_trusted_get(struct inode *ip, const char *name, void *buffer, size_t size) { char *xattr_name; @@ -330,9 +332,10 @@ zpl_xattr_trusted_get(struct inode *ip, const char *name, return (error); } +ZPL_XATTR_GET_WRAPPER(zpl_xattr_trusted_get); static int -zpl_xattr_trusted_set(struct inode *ip, const char *name, +__zpl_xattr_trusted_set(struct inode *ip, const char *name, const void *value, size_t size, int flags) { char *xattr_name; @@ -350,6 +353,7 @@ zpl_xattr_trusted_set(struct inode *ip, const char *name, return (error); } +ZPL_XATTR_SET_WRAPPER(zpl_xattr_trusted_set); xattr_handler_t zpl_xattr_trusted_handler = { .prefix = XATTR_TRUSTED_PREFIX, @@ -358,7 +362,7 @@ xattr_handler_t zpl_xattr_trusted_handler = { }; static int -zpl_xattr_security_get(struct inode *ip, const char *name, +__zpl_xattr_security_get(struct inode *ip, const char *name, void *buffer, size_t size) { char *xattr_name; @@ -373,9 +377,10 @@ zpl_xattr_security_get(struct inode *ip, const char *name, return (error); } +ZPL_XATTR_GET_WRAPPER(zpl_xattr_security_get); static int -zpl_xattr_security_set(struct inode *ip, const char *name, +__zpl_xattr_security_set(struct inode *ip, const char *name, const void *value, size_t size, int flags) { char *xattr_name; @@ -390,6 +395,7 @@ zpl_xattr_security_set(struct inode *ip, const char *name, return (error); } +ZPL_XATTR_SET_WRAPPER(zpl_xattr_security_set); int zpl_xattr_security_init(struct inode *ip, struct inode *dip) @@ -407,7 +413,7 @@ zpl_xattr_security_init(struct inode *ip, struct inode *dip) return (error); } - error = zpl_xattr_security_set(ip, name, value, len, 0); + error = __zpl_xattr_security_set(ip, name, value, len, 0); kfree(name); kfree(value);