]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
zfs: getnewvnode_reserve must be called outside of a zfs transaction
authoravg <avg@FreeBSD.org>
Thu, 16 Jan 2014 12:22:46 +0000 (12:22 +0000)
committeravg <avg@FreeBSD.org>
Thu, 16 Jan 2014 12:22:46 +0000 (12:22 +0000)
commit97986ccb0b599062a18e0153ae8cba713fde7df5
tree04715115a71000f63de3ed5641fbd5db2741a863
parentf9bc6dc89c596d9c742b7f12fbbaad8656b640fe
zfs: getnewvnode_reserve must be called outside of a zfs transaction

Otherwise we could run into the following deadlock.
A thread has a transaction open and assigned to a transaction group.
That would prevent the transaction group from be quiesced and synced.
The thread is blocked in getnewvnode_reserve waiting for a vnode to
a be reclaimed.  vnlru thread is blocked trying to enter ZFS VOP because
a filesystem is suspended by an ongoing rollback or receive operation.
In its turn the operation is waiting for the current transaction group
to be synced.

zfs_zget is always used outside of active transactions, but zfs_mknode
is always used in a transaction context.  Thus, we hoist
getnewvnode_reserve from zfs_mknode to its callers.

While there, assert that ZFS always calls getnewvnode while having
a vnode reserved.

Reported by: adrian
Tested by: adrian
MFC after: 17 days
Sponsored by: HybridCluster
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c