omfs: make readdir stop when filldir says so
Al Viro [Fri, 4 Mar 2011 06:43:36 +0000 (01:43 -0500)]
filldir returning an error does *not* mean "skip this entry, try the
next one"...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Bob Copeland <me@bobcopeland.com>

fs/omfs/dir.c

index fd91f62..de4ff29 100644 (file)
@@ -361,9 +361,10 @@ static int omfs_fill_chain(struct file *filp, void *dirent, filldir_t filldir,
 
                res = filldir(dirent, oi->i_name, strnlen(oi->i_name,
                        OMFS_NAMELEN), filp->f_pos, self, d_type);
-               if (res == 0)
-                       filp->f_pos++;
                brelse(bh);
+               if (res < 0)
+                       break;
+               filp->f_pos++;
        }
 out:
        return res;