]> granicus.if.org Git - zfs/commitdiff
Add cond_resched to zfs_zget to prevent infinite loop
authortuxoko <tuxoko@gmail.com>
Fri, 1 May 2015 03:11:01 +0000 (11:11 +0800)
committerNed Bass <bass6@llnl.gov>
Tue, 23 Jun 2015 01:14:41 +0000 (18:14 -0700)
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 <jalavoy@gmail.com>
Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3349

module/zfs/zfs_znode.c

index 0c0091f0445e27deeeb31a643189c4d6183e3302..a3d64fe01b592be8b3944513235abc334994e515 100644 (file)
@@ -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;