Skip to content

Commit 6bfa726

Browse files
committed
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/ [email protected] 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/ [email protected] 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/ [email protected] 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/ [email protected] 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 <[email protected]>
1 parent e5d33fa commit 6bfa726

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

src/mds/Locker.cc

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -342,21 +342,23 @@ bool Locker::acquire_locks(const MDRequestRef& mdr,
342342
}
343343
} else if (p.is_wrlock()) {
344344
dout(20) << " must wrlock " << *lock << " " << *object << dendl;
345-
client_t _client = p.is_state_pin() ? lock->get_excl_client() : client;
346-
if (object->is_auth()) {
347-
mustpin.insert(object);
348-
} else if (!object->is_auth() &&
349-
!lock->can_wrlock(_client) && // we might have to request a scatter
350-
!mdr->is_peer()) { // if we are peer (remote_wrlock), the leader already authpinned
351-
dout(15) << " will also auth_pin " << *object
352-
<< " in case we need to request a scatter" << dendl;
353-
mustpin.insert(object);
354-
}
355-
if (need_quiescelock && (lock->get_cap_shift() > 0)) {
356-
dout(20) << "need shared quiesce lock for " << p << " on " << SimpleLock::get_lock_type_name(t) << " of " << object << dendl;
357-
need_quiescelock = false;
358-
CInode *in = static_cast<CInode*>(object);
359-
lov.add_wrlock(&in->quiescelock, i + 1);
345+
if (!lock->is_locallock()) {
346+
client_t _client = p.is_state_pin() ? lock->get_excl_client() : client;
347+
if (object->is_auth()) {
348+
mustpin.insert(object);
349+
} else if (!object->is_auth() &&
350+
!lock->can_wrlock(_client) && // we might have to request a scatter
351+
!mdr->is_peer()) { // if we are peer (remote_wrlock), the leader already authpinned
352+
dout(15) << " will also auth_pin " << *object
353+
<< " in case we need to request a scatter" << dendl;
354+
mustpin.insert(object);
355+
}
356+
if (need_quiescelock && (lock->get_cap_shift() > 0)) {
357+
dout(20) << "need shared quiesce lock for " << p << " on " << SimpleLock::get_lock_type_name(t) << " of " << object << dendl;
358+
need_quiescelock = false;
359+
CInode *in = static_cast<CInode*>(object);
360+
lov.add_wrlock(&in->quiescelock, i + 1);
361+
}
360362
}
361363
} else if (p.is_remote_wrlock()) {
362364
dout(20) << " must remote_wrlock on mds." << p.wrlock_target << " "
@@ -370,6 +372,7 @@ bool Locker::acquire_locks(const MDRequestRef& mdr,
370372
}
371373
} else if (p.is_rdlock()) {
372374
dout(20) << " must rdlock " << *lock << " " << *object << dendl;
375+
ceph_assert(!lock->is_locallock());
373376
if (object->is_auth()) {
374377
mustpin.insert(object);
375378
} else if (!object->is_auth() &&

0 commit comments

Comments
 (0)