Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

librbd: require exclusive lock for reads if pwl cache is enabled #43038

Merged
merged 1 commit into from Sep 13, 2021

Conversation

majianpeng
Copy link
Member

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::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

Checklist

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

@github-actions github-actions bot added the rbd label Sep 3, 2021
@majianpeng
Copy link
Member Author

jenkins test make check

@majianpeng
Copy link
Member Author

@idryomov . although make check faild, i wanted you can riew this. I'm not sure for this and it's a policy of exclusive-lock for cache.
Thanks!

@majianpeng majianpeng changed the title librbd: Read request need exclusive-lock when enable pwl-cache. [RFC]librbd: Read request need exclusive-lock when enable pwl-cache. Sep 3, 2021
@github-actions github-actions bot added the tests label Sep 4, 2021
@majianpeng majianpeng force-pushed the librbd-pwl-exclusive-lock branch 2 times, most recently from 9a92c6f to 7aa8c8b Compare September 4, 2021 02:37
Copy link
Contributor

@idryomov idryomov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems completely reasonable to me. Please remove the RFC tag and sort out the unittest.

@majianpeng majianpeng changed the title [RFC]librbd: Read request need exclusive-lock when enable pwl-cache. librbd: Read request need exclusive-lock when enable pwl-cache. Sep 7, 2021
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>
@majianpeng majianpeng force-pushed the librbd-pwl-exclusive-lock branch 2 times, most recently from 928f853 to 621facb Compare September 8, 2021 01:59
@idryomov idryomov changed the title librbd: Read request need exclusive-lock when enable pwl-cache. librbd: require exclusive lock for reads if pwl cache is enabled Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants