omfs: make readdir stop when filldir says so
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 4 Mar 2011 06:43:36 +0000 (01:43 -0500)
committerBob Copeland <me@bobcopeland.com>
Sat, 5 Mar 2011 21:24:12 +0000 (16:24 -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 fd91f629ceb8bb14414eb7cabb65879410d4c903..de4ff29f1e0595c549877d16144064dae9bcbb7a 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;