summaryrefslogtreecommitdiff
path: root/drivers/block
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2020-11-25 16:41:59 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-30 17:23:11 +0300
commit145248ebe0b2164f7d383cc942ec45fbd3c4b1a0 (patch)
tree4ecdfa469b2d6e6d01e199256fdc4a0cebe74ef9 /drivers/block
parent61c303cfb1353754831aaa82ead4e698d2f6f5ae (diff)
downloadlinux-145248ebe0b2164f7d383cc942ec45fbd3c4b1a0.tar.xz
libceph, rbd: ignore addr->type while comparing in some cases
[ Upstream commit 313771e80fd253d4b5472e61a2d12b03c5293aa9 ] For libceph, this ensures that libceph instance sharing (share option) continues to work. For rbd, this avoids blocklisting alive lock owners (locker addr is always LEGACY, while watcher addr is ANY in nautilus). Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Stable-dep-of: 588159009d5b ("rbd: retrieve and check lock owner twice before blocklisting") Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/rbd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 63491748dc8d..7b8731cddd9e 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -3979,8 +3979,12 @@ static int find_watcher(struct rbd_device *rbd_dev,
sscanf(locker->id.cookie, RBD_LOCK_COOKIE_PREFIX " %llu", &cookie);
for (i = 0; i < num_watchers; i++) {
- if (!memcmp(&watchers[i].addr, &locker->info.addr,
- sizeof(locker->info.addr)) &&
+ /*
+ * Ignore addr->type while comparing. This mimics
+ * entity_addr_t::get_legacy_str() + strcmp().
+ */
+ if (ceph_addr_equal_no_type(&watchers[i].addr,
+ &locker->info.addr) &&
watchers[i].cookie == cookie) {
struct rbd_client_id cid = {
.gid = le64_to_cpu(watchers[i].name.num),