]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
orangefs: count directory pieces correctly
authorMartin Brandenburg <martin@omnibond.com>
Thu, 4 May 2017 17:16:04 +0000 (13:16 -0400)
committerMike Marshall <hubcap@omnibond.com>
Thu, 4 May 2017 18:38:24 +0000 (14:38 -0400)
A large directory full of differently sized file names triggered this.
Most directories, even very large directories with shorter names, would
be lucky enough to fit in one server response.

Signed-off-by: Martin Brandenburg <martin@omnibond.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
fs/orangefs/dir.c

index cac601498925febed61febf6aa574843c942e55c..d327cbd17756dcbc18ca787602e436c24e70d198 100644 (file)
@@ -135,9 +135,12 @@ static int parse_readdir(struct orangefs_dir *od,
 
        count = 1;
        part = od->part;
-       while (part && part->next) {
-               part = part->next;
+       while (part) {
                count++;
+               if (part->next)
+                       part = part->next;
+               else
+                       break;
        }
 
        new = (void *)op->downcall.trailer_buf;