diff options
author | Patrick Donnelly <pdonnell@redhat.com> | 2024-07-25 20:23:39 +0200 |
---|---|---|
committer | Patrick Donnelly <pdonnell@redhat.com> | 2024-07-25 20:54:16 +0200 |
commit | 6bfa726fafec4b214faf8121cf7e3a4fafaf61d9 (patch) | |
tree | 86b657fcce1da40492d0cba749030a4fbbc999c1 /src/mds/Locker.cc | |
parent | Merge pull request #58348 from cbodley/wip-async-co-algorithms (diff) | |
download | ceph-6bfa726fafec4b214faf8121cf7e3a4fafaf61d9.tar.xz ceph-6bfa726fafec4b214faf8121cf7e3a4fafaf61d9.zip |
mds: only authpin on wrlock when not a locallock
For example:
2024-07-22T21:48:18.372+0000 7f4751a3d700 7 mds.6.server dispatch_client_request client_request(client.4748:62187 create owner_uid=1000, owner_gid=1000 #0x1000000148d/file.mdtest.145.31073 2024-07-22T21:48:18.371416+0000 caller_uid=1000, caller_gid=1000{})
2024-07-22T21:48:18.372+0000 7f4751a3d700 7 mds.6.server open w/ O_CREAT on #0x1000000148d/file.mdtest.145.31073
2024-07-22T21:48:18.372+0000 7f4751a3d700 10 mds.6.server rdlock_path_xlock_dentry request(client.4748:62187 nref=2 cr=0x55649752bc00) #0x1000000148d/file.mdtest.145.31073
2024-07-22T21:48:18.372+0000 7f4751a3d700 7 mds.6.cache traverse: opening base ino 0x1000000148d snap head
2024-07-22T21:48:18.372+0000 7f4751a3d700 10 mds.6.locker try_rdlock_snap_layout request(client.4748:62187 nref=3 cr=0x55649752bc00) [inode 0x1000000148d [...2,head] /io500/io500/datafiles/2024.07.22-21.44.41/mdtest-easy/test-dir.0-0/mdtest_tree.205.0/ rep@0.1 fragtree_t(*^3) v101539 f(v20 m2024-07-22T21:48:14.075500+0000 30468=30468+0) n(v20 rc2024-07-22T21:48:14.075500+0000 30469=30468+1)/n(v0 rc2024-07-22T21:44:53.839831+0000 155=154+1) (idft lock) (isnap sync r=53) (inest mix w=101 dirty) (ipolicy sync r=53) (ifile mix w=52 dirty) (iquiesce lock w=52 last_client=4748) caps={4748=pAsLsXs/-@30914} | dirtyscattered=2 request=53 lock=5 importing=0 dirfrag=8 caps=1 waiter=0 export_pin=6 0x556494a71b80]
2024-07-22T21:48:18.372+0000 7f4751a3d700 12 mds.6.cache traverse: path seg depth 0 'file.mdtest.145.31073' snapid head
2024-07-22T21:48:18.372+0000 7f4751a3d700 20 mds.6.cache.dir(0x1000000148d.011*) lookup (file.mdtest.145.31073, 'head')
2024-07-22T21:48:18.372+0000 7f4751a3d700 20 mds.6.cache.dir(0x1000000148d.011*) hit -> (file.mdtest.145.31073,head)
2024-07-22T21:48:18.372+0000 7f4751a3d700 10 mds.6.locker acquire_locks request(client.4748:62187 nref=3 cr=0x55649752bc00)
2024-07-22T21:48:18.372+0000 7f4751a3d700 20 mds.6.locker lov = [LockOp(l=(ifile mix w=52 dirty),f=0x2),LockOp(l=(inest mix w=101 dirty),f=0x2),LockOp(l=(iauth sync),f=0x1),LockOp(l=(dn sync),f=0x4)]
2024-07-22T21:48:18.372+0000 7f4751a3d700 20 mds.6.locker auth_pin_nonblocking=0
2024-07-22T21:48:18.372+0000 7f4751a3d700 20 mds.6.locker must wrlock (ifile mix w=52 dirty) [inode 0x1000000148d [...2,head] /io500/io500/datafiles/2024.07.22-21.44.41/mdtest-easy/test-dir.0-0/mdtest_tree.205.0/ rep@0.1 fragtree_t(*^3) v101539 f(v20 m2024-07-22T21:48:14.075500+0000 30468=30468+0) n(v20 rc2024-07-22T21:48:14.075500+0000 30469=30468+1)/n(v0 rc2024-07-22T21:44:53.839831+0000 155=154+1) (idft lock) (isnap sync r=53) (inest mix w=101 dirty) (ipolicy sync r=53) (ifile mix w=52 dirty) (iquiesce lock w=52 last_client=4748) caps={4748=pAsLsXs/-@30914} | dirtyscattered=2 request=53 lock=5 importing=0 dirfrag=8 caps=1 waiter=0 export_pin=6 0x556494a71b80]
2024-07-22T21:48:18.372+0000 7f4751a3d700 20 mds.6.locker need shared quiesce lock for LockOp(l=(ifile mix w=52 dirty),f=0x2) on ifile of 0x556494a71b80
2024-07-22T21:48:18.372+0000 7f4751a3d700 20 mds.6.locker must wrlock (iquiesce lock w=52 last_client=4748) [inode 0x1000000148d [...2,head] /io500/io500/datafiles/2024.07.22-21.44.41/mdtest-easy/test-dir.0-0/mdtest_tree.205.0/ rep@0.1 fragtree_t(*^3) v101539 f(v20 m2024-07-22T21:48:14.075500+0000 30468=30468+0) n(v20 rc2024-07-22T21:48:14.075500+0000 30469=30468+1)/n(v0 rc2024-07-22T21:44:53.839831+0000 155=154+1) (idft lock) (isnap sync r=53) (inest mix w=101 dirty) (ipolicy sync r=53) (ifile mix w=52 dirty) (iquiesce lock w=52 last_client=4748) caps={4748=pAsLsXs/-@30914} | dirtyscattered=2 request=53 lock=5 importing=0 dirfrag=8 caps=1 waiter=0 export_pin=6 0x556494a71b80]
2024-07-22T21:48:18.372+0000 7f4751a3d700 15 mds.6.locker will also auth_pin [inode 0x1000000148d [...2,head] /io500/io500/datafiles/2024.07.22-21.44.41/mdtest-easy/test-dir.0-0/mdtest_tree.205.0/ rep@0.1 fragtree_t(*^3) v101539 f(v20 m2024-07-22T21:48:14.075500+0000 30468=30468+0) n(v20 rc2024-07-22T21:48:14.075500+0000 30469=30468+1)/n(v0 rc2024-07-22T21:44:53.839831+0000 155=154+1) (idft lock) (isnap sync r=53) (inest mix w=101 dirty) (ipolicy sync r=53) (ifile mix w=52 dirty) (iquiesce lock w=52 last_client=4748) caps={4748=pAsLsXs/-@30914} | dirtyscattered=2 request=53 lock=5 importing=0 dirfrag=8 caps=1 waiter=0 export_pin=6 0x556494a71b80] in case we need to request a scatter
Adding the wrlock on ifile adds iquiesce. Consequently, examining the wrlock on
iquiesce will add an authpin for the inode.
The code for adding authpins on a wrlock should normally no-op because the
xlock which adds the versionlock (dn or inode) already has added the authpin
(and the MDS would be auth for the metadata too). In the case of the
quiescelock, we may not be auth so an authpin can be very expensive and
unnecessary. We only require an authpin for an xlock on the quiescelock when
auth.
Fixes: https://tracker.ceph.com/issues/65851
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
Diffstat (limited to 'src/mds/Locker.cc')
-rw-r--r-- | src/mds/Locker.cc | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index f4fb1a114d9..0108192a61d 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -342,21 +342,23 @@ bool Locker::acquire_locks(const MDRequestRef& mdr, } } else if (p.is_wrlock()) { dout(20) << " must wrlock " << *lock << " " << *object << dendl; - client_t _client = p.is_state_pin() ? lock->get_excl_client() : client; - if (object->is_auth()) { - mustpin.insert(object); - } else if (!object->is_auth() && - !lock->can_wrlock(_client) && // we might have to request a scatter - !mdr->is_peer()) { // if we are peer (remote_wrlock), the leader already authpinned - dout(15) << " will also auth_pin " << *object - << " in case we need to request a scatter" << dendl; - mustpin.insert(object); - } - if (need_quiescelock && (lock->get_cap_shift() > 0)) { - dout(20) << "need shared quiesce lock for " << p << " on " << SimpleLock::get_lock_type_name(t) << " of " << object << dendl; - need_quiescelock = false; - CInode *in = static_cast<CInode*>(object); - lov.add_wrlock(&in->quiescelock, i + 1); + if (!lock->is_locallock()) { + client_t _client = p.is_state_pin() ? lock->get_excl_client() : client; + if (object->is_auth()) { + mustpin.insert(object); + } else if (!object->is_auth() && + !lock->can_wrlock(_client) && // we might have to request a scatter + !mdr->is_peer()) { // if we are peer (remote_wrlock), the leader already authpinned + dout(15) << " will also auth_pin " << *object + << " in case we need to request a scatter" << dendl; + mustpin.insert(object); + } + if (need_quiescelock && (lock->get_cap_shift() > 0)) { + dout(20) << "need shared quiesce lock for " << p << " on " << SimpleLock::get_lock_type_name(t) << " of " << object << dendl; + need_quiescelock = false; + CInode *in = static_cast<CInode*>(object); + lov.add_wrlock(&in->quiescelock, i + 1); + } } } else if (p.is_remote_wrlock()) { dout(20) << " must remote_wrlock on mds." << p.wrlock_target << " " @@ -370,6 +372,7 @@ bool Locker::acquire_locks(const MDRequestRef& mdr, } } else if (p.is_rdlock()) { dout(20) << " must rdlock " << *lock << " " << *object << dendl; + ceph_assert(!lock->is_locallock()); if (object->is_auth()) { mustpin.insert(object); } else if (!object->is_auth() && |