diff options
Diffstat (limited to 'module/zfs/zfs_vnops.c')
-rw-r--r-- | module/zfs/zfs_vnops.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index 2292ff652..53d02a3aa 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -4096,10 +4096,16 @@ zfs_inactive(struct inode *ip) znode_t *zp = ITOZ(ip); zfs_sb_t *zsb = ITOZSB(ip); int error; + int need_unlock = 0; - rw_enter(&zsb->z_teardown_inactive_lock, RW_READER); + /* Only read lock if we haven't already write locked, e.g. rollback */ + if (!RW_WRITE_HELD(&zsb->z_teardown_inactive_lock)) { + need_unlock = 1; + rw_enter(&zsb->z_teardown_inactive_lock, RW_READER); + } if (zp->z_sa_hdl == NULL) { - rw_exit(&zsb->z_teardown_inactive_lock); + if (need_unlock) + rw_exit(&zsb->z_teardown_inactive_lock); return; } @@ -4122,7 +4128,8 @@ zfs_inactive(struct inode *ip) } zfs_zinactive(zp); - rw_exit(&zsb->z_teardown_inactive_lock); + if (need_unlock) + rw_exit(&zsb->z_teardown_inactive_lock); } EXPORT_SYMBOL(zfs_inactive); |