From 6102d0376ecfbcc1f63819bc1046ee78b7f3d4fc Mon Sep 17 00:00:00 2001 From: tuxoko Date: Fri, 1 May 2015 11:11:01 +0800 Subject: [PATCH] Add cond_resched to zfs_zget to prevent infinite loop It's been reported that threads would loop infinitely inside zfs_zget. The speculated cause for this is that if an inode is marked for evict, zfs_zget would see that and loop. However, if the looping thread doesn't yield, the inode may not have a chance to finish evict, thus causing a infinite loop. This patch solve this issue by add cond_resched to zfs_zget, making the looping thread to yield when needed. Tested-by: jlavoy Signed-off-by: Chunwei Chen Signed-off-by: Brian Behlendorf Closes #3349 --- module/zfs/zfs_znode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/zfs/zfs_znode.c b/module/zfs/zfs_znode.c index 0c0091f04..a3d64fe01 100644 --- a/module/zfs/zfs_znode.c +++ b/module/zfs/zfs_znode.c @@ -950,6 +950,8 @@ again: mutex_exit(&zp->z_lock); sa_buf_rele(db, NULL); ZFS_OBJ_HOLD_EXIT(zsb, obj_num); + /* inode might need this to finish evict */ + cond_resched(); goto again; } *zpp = zp; -- 2.40.0