From: Yan, Zheng Date: Fri, 28 Feb 2014 08:36:09 +0000 (+0800) Subject: ceph: fix reset_readdir() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dcd3cc05e5f230f8fbc0c3369a5d6ad4f1d23aed;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git ceph: fix reset_readdir() When changing readdir postion, fi->next_offset should be set to 0 if the new postion is not in the first dirfrag. Signed-off-by: Yan, Zheng Reviewed-by: Alex Elder --- diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index a7eaf9692aa6..8ce8833e9c02 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -454,7 +454,7 @@ more: return 0; } -static void reset_readdir(struct ceph_file_info *fi) +static void reset_readdir(struct ceph_file_info *fi, unsigned frag) { if (fi->last_readdir) { ceph_mdsc_put_request(fi->last_readdir); @@ -462,7 +462,10 @@ static void reset_readdir(struct ceph_file_info *fi) } kfree(fi->last_name); fi->last_name = NULL; - fi->next_offset = 2; /* compensate for . and .. */ + if (ceph_frag_is_leftmost(frag)) + fi->next_offset = 2; /* compensate for . and .. */ + else + fi->next_offset = 0; if (fi->dentry) { dput(fi->dentry); fi->dentry = NULL; @@ -507,7 +510,7 @@ static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int whence) fpos_frag(offset) != fi->frag || fpos_off(offset) < fi->offset) { dout("dir_llseek dropping %p content\n", file); - reset_readdir(fi); + reset_readdir(fi, fpos_frag(offset)); } /* bump dir_release_count if we did a forward seek */