mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-04-06 17:49:11 +03:00
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 <behlendorf1@llnl.gov> Fixes #431
This commit is contained in:
parent
c475167627
commit
a7b125e9a5
@ -2301,6 +2301,9 @@ zfs_getattr_fast(struct inode *ip, struct kstat *sp)
|
|||||||
znode_t *zp = ITOZ(ip);
|
znode_t *zp = ITOZ(ip);
|
||||||
zfs_sb_t *zsb = ITOZSB(ip);
|
zfs_sb_t *zsb = ITOZSB(ip);
|
||||||
|
|
||||||
|
ZFS_ENTER(zsb);
|
||||||
|
ZFS_VERIFY_ZP(zp);
|
||||||
|
|
||||||
mutex_enter(&zp->z_lock);
|
mutex_enter(&zp->z_lock);
|
||||||
|
|
||||||
generic_fillattr(ip, sp);
|
generic_fillattr(ip, sp);
|
||||||
@ -2316,6 +2319,8 @@ zfs_getattr_fast(struct inode *ip, struct kstat *sp)
|
|||||||
|
|
||||||
mutex_exit(&zp->z_lock);
|
mutex_exit(&zp->z_lock);
|
||||||
|
|
||||||
|
ZFS_EXIT(zsb);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(zfs_getattr_fast);
|
EXPORT_SYMBOL(zfs_getattr_fast);
|
||||||
|
Loading…
Reference in New Issue
Block a user