aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/dir.c
diff options
context:
space:
mode:
authorYan, Zheng <zheng.z.yan@intel.com>2014-02-28 03:36:09 -0500
committerYan, Zheng <zheng.z.yan@intel.com>2014-04-02 22:33:52 -0400
commitdcd3cc05e5f230f8fbc0c3369a5d6ad4f1d23aed (patch)
treec1ba50848987dc38cb884e5d5e62162a3ab03a14 /fs/ceph/dir.c
parentf0494206076703aaa0c8005eff41c413216ae26b (diff)
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 <zheng.z.yan@intel.com> Reviewed-by: Alex Elder <elder@linaro.org>
Diffstat (limited to 'fs/ceph/dir.c')
-rw-r--r--fs/ceph/dir.c9
1 files changed, 6 insertions, 3 deletions
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:
454 return 0; 454 return 0;
455} 455}
456 456
457static void reset_readdir(struct ceph_file_info *fi) 457static void reset_readdir(struct ceph_file_info *fi, unsigned frag)
458{ 458{
459 if (fi->last_readdir) { 459 if (fi->last_readdir) {
460 ceph_mdsc_put_request(fi->last_readdir); 460 ceph_mdsc_put_request(fi->last_readdir);
@@ -462,7 +462,10 @@ static void reset_readdir(struct ceph_file_info *fi)
462 } 462 }
463 kfree(fi->last_name); 463 kfree(fi->last_name);
464 fi->last_name = NULL; 464 fi->last_name = NULL;
465 fi->next_offset = 2; /* compensate for . and .. */ 465 if (ceph_frag_is_leftmost(frag))
466 fi->next_offset = 2; /* compensate for . and .. */
467 else
468 fi->next_offset = 0;
466 if (fi->dentry) { 469 if (fi->dentry) {
467 dput(fi->dentry); 470 dput(fi->dentry);
468 fi->dentry = NULL; 471 fi->dentry = NULL;
@@ -507,7 +510,7 @@ static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int whence)
507 fpos_frag(offset) != fi->frag || 510 fpos_frag(offset) != fi->frag ||
508 fpos_off(offset) < fi->offset) { 511 fpos_off(offset) < fi->offset) {
509 dout("dir_llseek dropping %p content\n", file); 512 dout("dir_llseek dropping %p content\n", file);
510 reset_readdir(fi); 513 reset_readdir(fi, fpos_frag(offset));
511 } 514 }
512 515
513 /* bump dir_release_count if we did a forward seek */ 516 /* bump dir_release_count if we did a forward seek */