Btrfs: avoid deadlocks from GFP_KERNEL allocations during btrfs_real_readdir
[firefly-linux-kernel-4.4.55.git] / fs / eventpoll.c
index ea54cdef04ddc94d282c22f8c2b721169ee77293..4d9d3a45e35647a19d9182e28422c397f654abb5 100644 (file)
@@ -988,6 +988,10 @@ static int path_count[PATH_ARR_SIZE];
 
 static int path_count_inc(int nests)
 {
+       /* Allow an arbitrary number of depth 1 paths */
+       if (nests == 0)
+               return 0;
+
        if (++path_count[nests] > path_limits[nests])
                return -1;
        return 0;