libceph: move away from global osd_req_flags
authorIlya Dryomov <idryomov@gmail.com>
Thu, 4 Jun 2020 09:12:34 +0000 (11:12 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Tue, 16 Jun 2020 14:01:53 +0000 (16:01 +0200)
commit22d2cfdffa5bff3566e16cb7320e13ceb814674b
tree46af02e13d487babdca4b26486a04d7786a465a0
parentb3a9e3b9622ae10064826dccb4f7a52bd88c7407
libceph: move away from global osd_req_flags

osd_req_flags is overly general and doesn't suit its only user
(read_from_replica option) well:

- applying osd_req_flags in account_request() affects all OSD
  requests, including linger (i.e. watch and notify).  However,
  linger requests should always go to the primary even though
  some of them are reads (e.g. notify has side effects but it
  is a read because it doesn't result in mutation on the OSDs).

- calls to class methods that are reads are allowed to go to
  the replica, but most such calls issued for "rbd map" and/or
  exclusive lock transitions are requested to be resent to the
  primary via EAGAIN, doubling the latency.

Get rid of global osd_req_flags and set read_from_replica flag
only on specific OSD requests instead.

Fixes: 8ad44d5e0d1e ("libceph: read_from_replica option")
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
drivers/block/rbd.c
include/linux/ceph/libceph.h
net/ceph/ceph_common.c
net/ceph/osd_client.c