Skip to content

Commit 58df861

Browse files
committed
Merge PR ceph#52290 into main
* refs/pull/52290/head: pybind/rbd: drop GIL when calling into librbd pybind/cephfs: drop gil during cephfs callouts Reviewed-by: Greg Farnum <[email protected]> Reviewed-by: Ilya Dryomov <[email protected]>
2 parents 4de76bf + 1a60f66 commit 58df861

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

src/pybind/cephfs/cephfs.pyx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,8 @@ cdef class LibCephFS(object):
11691169
cdef:
11701170
char* _path = path
11711171
char* _name = name
1172-
ret = ceph_rmsnap(self.cluster, _path, _name)
1172+
with nogil:
1173+
ret = ceph_rmsnap(self.cluster, _path, _name)
11731174
if ret < 0:
11741175
raise make_ex(ret, "rmsnap error")
11751176
return 0
@@ -1188,7 +1189,8 @@ cdef class LibCephFS(object):
11881189
cdef:
11891190
char* _path = path
11901191
snap_info info
1191-
ret = ceph_get_snap_info(self.cluster, _path, &info)
1192+
with nogil:
1193+
ret = ceph_get_snap_info(self.cluster, _path, &info)
11921194
if ret < 0:
11931195
raise make_ex(ret, "snap_info error")
11941196
md = {}
@@ -1353,7 +1355,8 @@ cdef class LibCephFS(object):
13531355
self.require_state("mounted")
13541356
path = cstr(path, 'path')
13551357
cdef char* _path = path
1356-
ret = ceph_rmdir(self.cluster, _path)
1358+
with nogil:
1359+
ret = ceph_rmdir(self.cluster, _path)
13571360
if ret < 0:
13581361
raise make_ex(ret, "error in rmdir {}".format(path.decode('utf-8')))
13591362

src/pybind/rbd/rbd.pyx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,8 +1397,10 @@ class RBD(object):
13971397
char *_client_name = client_name
13981398
try:
13991399
_uuid = <char *>realloc_chk(_uuid, _uuid_max_length)
1400-
ret = rbd_mirror_peer_site_add(_ioctx, _uuid, _uuid_max_length,
1401-
_direction, _site_name, _client_name)
1400+
with nogil:
1401+
ret = rbd_mirror_peer_site_add(_ioctx, _uuid, _uuid_max_length,
1402+
_direction, _site_name,
1403+
_client_name)
14021404
if ret != 0:
14031405
raise make_ex(ret, 'error adding mirror peer')
14041406
return decode_cstr(_uuid)
@@ -3132,7 +3134,11 @@ cdef class Image(object):
31323134
31333135
:returns: int - the pool id
31343136
"""
3135-
return rbd_get_data_pool_id(self.image)
3137+
with nogil:
3138+
ret = rbd_get_data_pool_id(self.image)
3139+
if ret < 0:
3140+
raise make_ex(ret, 'error getting data pool id for image %s' % self.name)
3141+
return ret
31363142

31373143
@requires_not_closed
31383144
def get_parent_image_spec(self):

src/test/pybind/test_rbd.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
from datetime import datetime, timedelta
1414
from nose import with_setup, SkipTest
1515
from nose.plugins.attrib import attr
16-
from nose.tools import eq_ as eq, assert_raises, assert_not_equal
16+
from nose.tools import (eq_ as eq, assert_raises, assert_not_equal,
17+
assert_greater_equal)
1718
from rados import (Rados,
1819
LIBRADOS_OP_FLAG_FADVISE_DONTNEED,
1920
LIBRADOS_OP_FLAG_FADVISE_NOCACHE,
@@ -607,6 +608,9 @@ def test_id(self):
607608
def test_block_name_prefix(self):
608609
assert_not_equal(b'', self.image.block_name_prefix())
609610

611+
def test_data_pool_id(self):
612+
assert_greater_equal(self.image.data_pool_id(), 0)
613+
610614
def test_create_timestamp(self):
611615
timestamp = self.image.create_timestamp()
612616
assert_not_equal(0, timestamp.year)

0 commit comments

Comments
 (0)