diff options
author | Brian Behlendorf <[email protected]> | 2011-03-22 11:13:41 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2011-03-22 12:15:54 -0700 |
commit | 81e97e21872a9c38ad66c37fafe1436ee25abee3 (patch) | |
tree | ec6c61e27476f7321ac19ba4bd1c0cd5b155dd43 /module/zfs/zpl_xattr.c | |
parent | bdf4328b04544ac3759d689d0a68e514b6df1025 (diff) |
Linux 2.6.29 compat, credentials
As of Linux 2.6.29 a clean credential API was added to the Linux kernel.
Previously the credential was embedded in the task_struct. Because the
SPL already has considerable support for handling this API change the
ZPL code has been updated to use the Solaris credential API.
Diffstat (limited to 'module/zfs/zpl_xattr.c')
-rw-r--r-- | module/zfs/zpl_xattr.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/module/zfs/zpl_xattr.c b/module/zfs/zpl_xattr.c index 7a1ecec8f..82787cb2d 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; |