Project

General

Profile

Actions

Feature #14095

closed

Dtrace probes for nbmand conflict identification

Added by Gordon Ross 8 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

When looking into problems with mandatory locking that unexpectedly blocks I/O, one would like to know exactly what lock or share blocked the I/O.
That's not trivial to determine without a couple additional static dtrace probes.

This change request adds three new dtrace probes, one for locks, and two for share reservations, used like this:

sdt::nbl_lock_conflict:conflict_lock
{
    this->lock = (lock_descriptor_t *)arg0;
    print(this->lock->f_lock);
}
sdt::nbl_share_conflict:conflict_shrlock
{
    this->shrl = (struct shrlock *)arg0;
    print(*(this->shrl));
}
sdt::add_share:conflict_shrlock
{
    this->shrl = (struct shrlock *)arg0;
    print(*(this->shrl));
}

This comes from nexenta@fd263784213324d4c80e05443e47055d9ab8cf15
(with minor changes)

Actions #1

Updated by Electric Monk 8 months ago

  • Gerrit CR set to 1719
Actions #2

Updated by Gordon Ross 7 months ago

  • Description updated (diff)

Changed the share.c probe slightly to make life a little easier for the consuming script.

Actions #3

Updated by Gordon Ross 4 months ago

My testing revealed that the probes for showing share reservation conflicts did not show conflicts during open (add_share calls).
I've fixed that and updated the review. I also added a sample dtrace script to this CR.

Here's the test output, with I/O against conflicting mandatory locks and then conflicting share reservations.


root@oitest:/export/home/gwr# dtrace -s /usr/lib/smbsrv/dtrace/nbl-conflict.d 
dtrace: script '/usr/lib/smbsrv/dtrace/nbl-conflict.d' matched 3 probes
CPU     ID                    FUNCTION:NAME
  3   9533  nbl_lock_conflict:conflict_lock flock64_t {
    short l_type = 0x2
    short l_whence = 0
    off64_t l_start = 0
    off64_t l_len = 0x1
    int l_sysid = 0
    pid_t l_pid = 0x18b01
    long [4] l_pad = [ 0xfffffe0008941f00, 0x8045ced, 0x3, 0xfffffe0008941ec0 ]
}
  2   9321       add_share:conflict_shrlock struct shrlock {
    short s_access = 0x2
    short s_deny = 0x11
    int32_t s_sysid = 0
    pid_t s_pid = 0x18abc
    int s_own_len = 0x8
    caddr_t s_owner = 0xfffffe068744bb80
}
  3   9321       add_share:conflict_shrlock struct shrlock {
    short s_access = 0x2
    short s_deny = 0x11
    int32_t s_sysid = 0
    pid_t s_pid = 0x18abc
    int s_own_len = 0x8
    caddr_t s_owner = 0xfffffe068744bb80
}
  3   9321       add_share:conflict_shrlock struct shrlock {
    short s_access = 0x2
    short s_deny = 0x11
    int32_t s_sysid = 0
    pid_t s_pid = 0x18abc
    int s_own_len = 0x8
    caddr_t s_owner = 0xfffffe068744bb80
}
  1   9320 nbl_share_conflict:conflict_shrlock struct shrlock {
    short s_access = 0x2
    short s_deny = 0x11
    int32_t s_sysid = 0
    pid_t s_pid = 0x18abc
    int s_own_len = 0x8
    caddr_t s_owner = 0xfffffe068744bb80
}
  0   9320 nbl_share_conflict:conflict_shrlock struct shrlock {
    short s_access = 0x2
    short s_deny = 0x11
    int32_t s_sysid = 0
    pid_t s_pid = 0x18abc
    int s_own_len = 0x8
    caddr_t s_owner = 0xfffffe068744bb80
}
^C

Actions #4

Updated by Gordon Ross 4 months ago

  • Description updated (diff)
Actions #5

Updated by Gordon Ross 4 months ago

  • Description updated (diff)
Actions #6

Updated by Electric Monk 4 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit 1c53c56f27c8091f8066fb65aceeca8ee8b6df7a

commit  1c53c56f27c8091f8066fb65aceeca8ee8b6df7a
Author: Gordon Ross <gwr@nexenta.com>
Date:   2022-01-24T13:07:18.000Z

    14095 Dtrace probes for nbmand conflict identification
    Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
    Reviewed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>
    Reviewed by: Evan Layton <evan.layton@nexenta.com>
    Approved by: Robert Mustacchi <rm@fingolfin.org>

Actions

Also available in: Atom PDF