--- x/fs/kernfs/dir.c +++ d/fs/kernfs/dir.c @@ -705,7 +705,9 @@ struct kernfs_node *kernfs_find_and_get_ goto err_unlock; } - if (unlikely(!kernfs_active(kn) || !atomic_inc_not_zero(&kn->count))) + if (atomic_read(&kn->active) < 0) + goto err_unlock; + if (!atomic_inc_not_zero(&kn->count)) goto err_unlock; spin_unlock(&kernfs_idr_lock);