]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
librbd: Read request need exclusive-lock when enable pwl-cache. 44199/head
authorJianpeng Ma <jianpeng.ma@intel.com>
Wed, 8 Sep 2021 01:51:19 +0000 (09:51 +0800)
committerDeepika Upadhyay <dupadhya@redhat.com>
Fri, 10 Dec 2021 07:18:54 +0000 (12:48 +0530)
commit4d8cf8c2ee270212dd3d676c4d65cb9ea6111711
treecb7ed609b40554044244c9214f14b3287eecdf82
parent4d8c6cf2c268505dd654e26ed264a22e733f46b9
librbd: Read request need exclusive-lock when enable  pwl-cache.

TestLibRBD.TestFUA descript the following workload:
a)write/read the same image w/ pwl-cache
  write_image = open(image_name);
  read_image  = open(image_name);
b)i/o workload is:
   write(write_image)
      write need EXLock and require EXLOCK

  read(read_image)
     in ExclusiveLock<I>::init(), firstly read need EXLOCK
     so will require EXLOCK. write_image release EXLOCK(will
     flush data to osd and remove cache). read_image init pwl-cache
     and read-io firstly enter pwl-cache and missed and then read
     from osd.

   write(write_image)
     write need EXLOCK and require EXLOCK. This make read_image remove
     empty cache. write_image init cache pool and write data to cache.

   read(read_image)
       In send_set_require_lock(), it set write need EXLOCK.
       So read don't require EXLOCK and dirtyly read from osd.

Because second-read  don't need EXLOCK and make write_image don't
release EXLOCK(flush dirty data to osd and  shutdown pwl-cache).
This make second-read don't read the latest data.

So we should make read also need EXLOCK when enable pwl-cache.

Fixes: https://tracker.ceph.com/issues/51438
Tested-by: Feng Hualong <hualong.feng@intel.com>
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
(cherry picked from commit 621facb6e66ce92ca36d566c78bc065a9666639e)
src/librbd/exclusive_lock/PreReleaseRequest.cc
src/test/librbd/exclusive_lock/test_mock_PreReleaseRequest.cc