diff options
author | Gunnar Beutner <[email protected]> | 2011-11-03 06:48:13 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2011-11-03 10:13:09 -0700 |
commit | a7b125e9a577cbf66ddbd7cf9701028ff150ee8e (patch) | |
tree | 3adf43ab282030419cc9fdc37d5645a1754fc326 /module | |
parent | c47516762758c989a443c0a6a9e38ae8fb46e6f1 (diff) |
Fix a race condition in zfs_getattr_fast()
zfs_getattr_fast() was missing a lock on the ZFS superblock which
could result in zfs_znode_dmu_fini() clearing the zp->z_sa_hdl member
while zfs_getattr_fast() was accessing the znode. The result of this
would usually be a panic.
Signed-off-by: Brian Behlendorf <[email protected]>
Fixes #431
Diffstat (limited to 'module')
-rw-r--r-- | module/zfs/zfs_vnops.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index 3331a1706..b7f5daaaf 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -2301,6 +2301,9 @@ zfs_getattr_fast(struct inode *ip, struct kstat *sp) znode_t *zp = ITOZ(ip); zfs_sb_t *zsb = ITOZSB(ip); + ZFS_ENTER(zsb); + ZFS_VERIFY_ZP(zp); + mutex_enter(&zp->z_lock); generic_fillattr(ip, sp); @@ -2316,6 +2319,8 @@ zfs_getattr_fast(struct inode *ip, struct kstat *sp) mutex_exit(&zp->z_lock); + ZFS_EXIT(zsb); + return (0); } EXPORT_SYMBOL(zfs_getattr_fast); |