ceph: choose readdir frag based on previous readdir reply
authorYan, Zheng <zyan@redhat.com>
Mon, 24 Apr 2017 03:56:50 +0000 (11:56 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 Jul 2017 13:01:02 +0000 (15:01 +0200)
commit9403514ba1a239e7d5844e37977f4c5a190ba99f
tree1ceb64377e82a8075d8d40edddb6f659f0c2a499
parentc4c592b2c137e4451b7fdf76700ae9c98db133f5
ceph: choose readdir frag based on previous readdir reply

commit b50c2de51e611da90cf3cf04c058f7e9bbe79e93 upstream.

The dirfragtree is lazily updated, it's not always accurate. Infinite
loops happens in following circumstance.

- client send request to read frag A
- frag A has been fragmented into frag B and C. So mds fills the reply
  with contents of frag B
- client wants to read next frag C. ceph_choose_frag(frag value of C)
  return frag A.

The fix is using previous readdir reply to calculate next readdir frag
when possible.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ceph/dir.c