]> git.baikalelectronics.ru Git - kernel.git/commit
ceph: improve fscache revalidation
authorYan, Zheng <zyan@redhat.com>
Wed, 18 May 2016 12:31:55 +0000 (20:31 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 1 Jun 2016 08:31:50 +0000 (10:31 +0200)
commitcf626961694ce5bb3ba6f4fdad39631b18bd8b67
tree3e18ffcddf422deba5b7a10948b15b827defd441
parent51e0ba01316a75977bd416d3972922ecc8710464
ceph: improve fscache revalidation

There are several issues in fscache revalidation code.
- In ceph_revalidate_work(), fscache_invalidate() is called when
  fscache_check_consistency() return 0. This is complete wrong
  because 0 means cache is valid.
- Handle_cap_grant() calls ceph_queue_revalidate() if client
  already has CAP_FILE_CACHE. This code is confusing. Client
  should revalidate the cache each time it got CAP_FILE_CACHE
  anew.
- In Handle_cap_grant(), fscache_invalidate() is called if MDS
  revokes CAP_FILE_CACHE. This is inconsistency with the case
  that inode get evicted. In the later case, the cache is not
  discarded. Client may use the cache when inode is reloaded.

This patch moves the fscache revalidation into ceph_get_caps().
Client revalidates the cache after it gets CAP_FILE_CACHE.
i_rdcache_gen should keep constance while CAP_FILE_CACHE is
used. If i_fscache_gen is not equal to i_rdcache_gen, client
needs to check cache's consistency.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
fs/ceph/cache.c
fs/ceph/cache.h
fs/ceph/caps.c
fs/ceph/super.h