Unionfs: fix ->readdir
authorErez Zadok <ezk@cs.sunysb.edu>
Fri, 9 May 2014 18:57:43 +0000 (14:57 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Tue, 11 Nov 2014 01:24:44 +0000 (20:24 -0500)
It's enough to use llseek to set lower dir pos.  No need to also set
lower_file->f_pos directly, as it breaks readdir for ext4 and other
ext-based file systems.  Reported by Vaibhav Nagarnaik and Ted Ts'o.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/dirfops.c

index d29b50d754a01f2278d1ffe5583a2d3717dadd44..bf609ce1f8e331a29f10755a55259f612068afda 100644 (file)
@@ -156,9 +156,8 @@ static int unionfs_readdir(struct file *file, struct dir_context *ctx)
                        goto out;
                }
 
-               lower_file->f_pos = ctx->pos;
                err = iterate_dir(lower_file, &buf.ctx);
-               ctx->pos = buf.ctx.pos;
+               ctx->pos = buf.ctx.pos; /* XXX: not sure if needed (cf. ecryptfs) */
 
                /* Save the position for when we continue. */
                offset = vfs_llseek(lower_file, 0, SEEK_CUR);