mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 10:54:35 +03:00
Add missing checks to zpl_xattr_* functions
Linux specific zpl_* entry points, such as xattrs, must include the same unmounted and sa handle checks as the common zfs_ entry points. The additional ZPL_* wrappers are identical to their ZFS_ counterparts except the errno is negated since they are expected to be used at the zpl_ layer. Reviewed by: Matthew Ahrens <mahrens@delphix.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: John Gallagher <john.gallagher@delphix.com> Closes #5866 Closes #7761
This commit is contained in:
committed by
Brian Behlendorf
parent
010d12474c
commit
499b5497cb
@@ -245,7 +245,8 @@ zpl_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
|
||||
|
||||
crhold(cr);
|
||||
cookie = spl_fstrans_mark();
|
||||
rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG);
|
||||
ZPL_ENTER(zfsvfs);
|
||||
ZPL_VERIFY_ZP(zp);
|
||||
rw_enter(&zp->z_xattr_lock, RW_READER);
|
||||
|
||||
if (zfsvfs->z_use_sa && zp->z_is_sa) {
|
||||
@@ -262,7 +263,7 @@ zpl_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
|
||||
out:
|
||||
|
||||
rw_exit(&zp->z_xattr_lock);
|
||||
rrm_exit(&(zfsvfs)->z_teardown_lock, FTAG);
|
||||
ZPL_EXIT(zfsvfs);
|
||||
spl_fstrans_unmark(cookie);
|
||||
crfree(cr);
|
||||
|
||||
@@ -418,11 +419,12 @@ zpl_xattr_get(struct inode *ip, const char *name, void *value, size_t size)
|
||||
|
||||
crhold(cr);
|
||||
cookie = spl_fstrans_mark();
|
||||
rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG);
|
||||
ZPL_ENTER(zfsvfs);
|
||||
ZPL_VERIFY_ZP(zp);
|
||||
rw_enter(&zp->z_xattr_lock, RW_READER);
|
||||
error = __zpl_xattr_get(ip, name, value, size, cr);
|
||||
rw_exit(&zp->z_xattr_lock);
|
||||
rrm_exit(&(zfsvfs)->z_teardown_lock, FTAG);
|
||||
ZPL_EXIT(zfsvfs);
|
||||
spl_fstrans_unmark(cookie);
|
||||
crfree(cr);
|
||||
|
||||
@@ -590,7 +592,8 @@ zpl_xattr_set(struct inode *ip, const char *name, const void *value,
|
||||
|
||||
crhold(cr);
|
||||
cookie = spl_fstrans_mark();
|
||||
rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG);
|
||||
ZPL_ENTER(zfsvfs);
|
||||
ZPL_VERIFY_ZP(zp);
|
||||
rw_enter(&ITOZ(ip)->z_xattr_lock, RW_WRITER);
|
||||
|
||||
/*
|
||||
@@ -643,7 +646,7 @@ zpl_xattr_set(struct inode *ip, const char *name, const void *value,
|
||||
zpl_xattr_set_sa(ip, name, NULL, 0, 0, cr);
|
||||
out:
|
||||
rw_exit(&ITOZ(ip)->z_xattr_lock);
|
||||
rrm_exit(&(zfsvfs)->z_teardown_lock, FTAG);
|
||||
ZPL_EXIT(zfsvfs);
|
||||
spl_fstrans_unmark(cookie);
|
||||
crfree(cr);
|
||||
ASSERT3S(error, <=, 0);
|
||||
|
||||
Reference in New Issue
Block a user