summaryrefslogtreecommitdiffstats
path: root/include/sys/zfs_znode.h
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2012-11-29 16:10:03 -0800
committerBrian Behlendorf <[email protected]>2012-12-03 12:10:46 -0800
commite89260a1c8851ce05ea04b23606ba438b271d890 (patch)
tree599a29ba4468cec0231809ba0defa4ccc7876024 /include/sys/zfs_znode.h
parent645fb9cc214c79c77378dd1e1fd2e3ef668bc848 (diff)
Directory xattr znodes hold a reference on their parent
Unlike normal file or directory znodes, an xattr znode is guaranteed to only have a single parent. Therefore, we can take a refernce on that parent if it is provided at create time and cache it. Additionally, we take care to cache it on any subsequent zfs_zaccess() where the parent is provided as an optimization. This allows us to avoid needing to do a zfs_zget() when setting up the SELinux security xattr in the create path. This is critical because a hash lookup on the directory will deadlock since it is locked. The zpl_xattr_security_init() call has also been moved up to the zpl layer to ensure TXs to create the required xattrs are performed after the create TX. Otherwise we run the risk of deadlocking on the open create TX. Ideally the security xattr should be fully constructed before the new inode is unlocked. However, doing so would require far more extensive changes to ZFS. This change may also have the benefitial side effect of ensuring xattr directory znodes are evicted from the cache before normal file or directory znodes due to the extra reference. Signed-off-by: Brian Behlendorf <[email protected]> Closes #671
Diffstat (limited to 'include/sys/zfs_znode.h')
-rw-r--r--include/sys/zfs_znode.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/sys/zfs_znode.h b/include/sys/zfs_znode.h
index 8af5798ba..0b75d5295 100644
--- a/include/sys/zfs_znode.h
+++ b/include/sys/zfs_znode.h
@@ -209,6 +209,7 @@ typedef struct znode {
zfs_acl_t *z_acl_cached; /* cached acl */
krwlock_t z_xattr_lock; /* xattr data lock */
nvlist_t *z_xattr_cached;/* cached xattrs */
+ struct znode *z_xattr_parent;/* xattr parent znode */
list_node_t z_link_node; /* all znodes in fs link */
sa_handle_t *z_sa_hdl; /* handle to sa data */
boolean_t z_is_sa; /* are we native sa? */