From: NeilBrown fsnotify has been reported as source of soft-lockups when iterating a long ->d_children list. Change it to use d_for_each_positive_child() which will call cond_resched() as needed to avoid soft-lockups. Link https://lwn.net/Articles/1079407/ Reviewed-by: Jan Kara Signed-off-by: NeilBrown --- fs/notify/fsnotify.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index 58566e6b9679..33c5d10f78ba 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c @@ -86,16 +86,12 @@ void fsnotify_set_children_dentry_flags(struct inode *inode) * their d_flags to indicate parental interest (their parent is * the original inode) */ - spin_lock(&alias->d_lock); - hlist_for_each_entry(child, &alias->d_children, d_sib) { - if (!child->d_inode) - continue; + d_for_each_positive_child(child, alias) { spin_lock_nested(&child->d_lock, DENTRY_D_LOCK_NESTED); child->d_flags |= DCACHE_FSNOTIFY_PARENT_WATCHED; spin_unlock(&child->d_lock); } - spin_unlock(&alias->d_lock); dput(alias); } -- 2.50.0.107.gf914562f5916.dirty