aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJohn Gallagher <[email protected]>2018-08-02 14:03:56 -0700
committerBrian Behlendorf <[email protected]>2018-08-02 14:03:56 -0700
commit499b5497cbc62a4db35227bc98c6244454dfab4c (patch)
tree1c99c8fb899c10fba9ba6a6028b644c0e061df6b /include
parent010d12474cb1572c0c9b729615fa45cf43f59d14 (diff)
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 <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: John Gallagher <[email protected]> Closes #5866 Closes #7761
Diffstat (limited to 'include')
-rw-r--r--include/sys/zfs_znode.h51
1 files changed, 29 insertions, 22 deletions
diff --git a/include/sys/zfs_znode.h b/include/sys/zfs_znode.h
index a34d24532..e82ac9941 100644
--- a/include/sys/zfs_znode.h
+++ b/include/sys/zfs_znode.h
@@ -259,28 +259,35 @@ zfs_inherit_projid(znode_t *dzp)
#define S_ISDEV(mode) (S_ISCHR(mode) || S_ISBLK(mode) || S_ISFIFO(mode))
-/* Called on entry to each ZFS vnode and vfs operation */
-#define ZFS_ENTER(zfsvfs) \
- { \
- rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \
- if ((zfsvfs)->z_unmounted) { \
- ZFS_EXIT(zfsvfs); \
- return (EIO); \
- } \
- }
-
-/* Must be called before exiting the vop */
-#define ZFS_EXIT(zfsvfs) \
- { \
- rrm_exit(&(zfsvfs)->z_teardown_lock, FTAG); \
- }
-
-/* Verifies the znode is valid */
-#define ZFS_VERIFY_ZP(zp) \
- if ((zp)->z_sa_hdl == NULL) { \
- ZFS_EXIT(ZTOZSB(zp)); \
- return (EIO); \
- }
+/* Called on entry to each ZFS inode and vfs operation. */
+#define ZFS_ENTER_ERROR(zfsvfs, error) \
+do { \
+ rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \
+ if ((zfsvfs)->z_unmounted) { \
+ ZFS_EXIT(zfsvfs); \
+ return (error); \
+ } \
+} while (0)
+#define ZFS_ENTER(zfsvfs) ZFS_ENTER_ERROR(zfsvfs, EIO)
+#define ZPL_ENTER(zfsvfs) ZFS_ENTER_ERROR(zfsvfs, -EIO)
+
+/* Must be called before exiting the operation. */
+#define ZFS_EXIT(zfsvfs) \
+do { \
+ rrm_exit(&(zfsvfs)->z_teardown_lock, FTAG); \
+} while (0)
+#define ZPL_EXIT(zfsvfs) ZFS_EXIT(zfsvfs)
+
+/* Verifies the znode is valid. */
+#define ZFS_VERIFY_ZP_ERROR(zp, error) \
+do { \
+ if ((zp)->z_sa_hdl == NULL) { \
+ ZFS_EXIT(ZTOZSB(zp)); \
+ return (error); \
+ } \
+} while (0)
+#define ZFS_VERIFY_ZP(zp) ZFS_VERIFY_ZP_ERROR(zp, EIO)
+#define ZPL_VERIFY_ZP(zp) ZFS_VERIFY_ZP_ERROR(zp, -EIO)
/*
* Macros for dealing with dmu_buf_hold