![Linus Torvalds](/assets/img/avatar_default.png)
Pull AFS fixes from David Howells: "Here's a set of patches that fix a number of bugs in the in-kernel AFS client, including: - Fix directory locking to not use individual page locks for directory reading/scanning but rather to use a semaphore on the afs_vnode struct as the directory contents must be read in a single blob and data from different reads must not be mixed as the entire contents may be shuffled about between reads. - Fix address list parsing to handle port specifiers correctly. - Only give up callback records on a server if we actually talked to that server (we might not be able to access a server). - Fix some callback handling bugs, including refcounting, whole-volume callbacks and when callbacks actually get broken in response to a CB.CallBack op. - Fix some server/address rotation bugs, including giving up if we can't probe a server; giving up if a server says it doesn't have a volume, but there are more servers to try. - Fix the decoding of fetched statuses to be OpenAFS compatible. - Fix the handling of server lookups in Cache Manager ops (such as CB.InitCallBackState3) to use a UUID if possible and to handle no server being found. - Fix a bug in server lookup where not all addresses are compared. - Fix the non-encryption of calls that prevents some servers from being accessed (this also requires an AF_RXRPC patch that has already gone in through the net tree). There's also a patch that adds tracepoints to log Cache Manager ops that don't find a matching server, either by UUID or by address" * tag 'afs-fixes-20180514' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs: afs: Fix the non-encryption of calls afs: Fix CB.CallBack handling afs: Fix whole-volume callback handling afs: Fix afs_find_server search loop afs: Fix the handling of an unfound server in CM operations afs: Add a tracepoint to record callbacks from unlisted servers afs: Fix the handling of CB.InitCallBackState3 to find the server by UUID afs: Fix VNOVOL handling in address rotation afs: Fix AFSFetchStatus decoder to provide OpenAFS compatibility afs: Fix server rotation's handling of fileserver probe failure afs: Fix refcounting in callback registration afs: Fix giving up callbacks on server destruction afs: Fix address list parsing afs: Fix directory page locking
193 lines
4.1 KiB
Perl
193 lines
4.1 KiB
Perl
package Perf::Trace::Core;
|
|
|
|
use 5.010000;
|
|
use strict;
|
|
use warnings;
|
|
|
|
require Exporter;
|
|
|
|
our @ISA = qw(Exporter);
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw(
|
|
) ] );
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
|
|
|
|
our @EXPORT = qw(
|
|
define_flag_field define_flag_value flag_str dump_flag_fields
|
|
define_symbolic_field define_symbolic_value symbol_str dump_symbolic_fields
|
|
trace_flag_str
|
|
);
|
|
|
|
our $VERSION = '0.01';
|
|
|
|
my %trace_flags = (0x00 => "NONE",
|
|
0x01 => "IRQS_OFF",
|
|
0x02 => "IRQS_NOSUPPORT",
|
|
0x04 => "NEED_RESCHED",
|
|
0x08 => "HARDIRQ",
|
|
0x10 => "SOFTIRQ");
|
|
|
|
sub trace_flag_str
|
|
{
|
|
my ($value) = @_;
|
|
|
|
my $string;
|
|
|
|
my $print_delim = 0;
|
|
|
|
foreach my $idx (sort {$a <=> $b} keys %trace_flags) {
|
|
if (!$value && !$idx) {
|
|
$string .= "NONE";
|
|
last;
|
|
}
|
|
|
|
if ($idx && ($value & $idx) == $idx) {
|
|
if ($print_delim) {
|
|
$string .= " | ";
|
|
}
|
|
$string .= "$trace_flags{$idx}";
|
|
$print_delim = 1;
|
|
$value &= ~$idx;
|
|
}
|
|
}
|
|
|
|
return $string;
|
|
}
|
|
|
|
my %flag_fields;
|
|
my %symbolic_fields;
|
|
|
|
sub flag_str
|
|
{
|
|
my ($event_name, $field_name, $value) = @_;
|
|
|
|
my $string;
|
|
|
|
if ($flag_fields{$event_name}{$field_name}) {
|
|
my $print_delim = 0;
|
|
foreach my $idx (sort {$a <=> $b} keys %{$flag_fields{$event_name}{$field_name}{"values"}}) {
|
|
if (!$value && !$idx) {
|
|
$string .= "$flag_fields{$event_name}{$field_name}{'values'}{$idx}";
|
|
last;
|
|
}
|
|
if ($idx && ($value & $idx) == $idx) {
|
|
if ($print_delim && $flag_fields{$event_name}{$field_name}{'delim'}) {
|
|
$string .= " $flag_fields{$event_name}{$field_name}{'delim'} ";
|
|
}
|
|
$string .= "$flag_fields{$event_name}{$field_name}{'values'}{$idx}";
|
|
$print_delim = 1;
|
|
$value &= ~$idx;
|
|
}
|
|
}
|
|
}
|
|
|
|
return $string;
|
|
}
|
|
|
|
sub define_flag_field
|
|
{
|
|
my ($event_name, $field_name, $delim) = @_;
|
|
|
|
$flag_fields{$event_name}{$field_name}{"delim"} = $delim;
|
|
}
|
|
|
|
sub define_flag_value
|
|
{
|
|
my ($event_name, $field_name, $value, $field_str) = @_;
|
|
|
|
$flag_fields{$event_name}{$field_name}{"values"}{$value} = $field_str;
|
|
}
|
|
|
|
sub dump_flag_fields
|
|
{
|
|
for my $event (keys %flag_fields) {
|
|
print "event $event:\n";
|
|
for my $field (keys %{$flag_fields{$event}}) {
|
|
print " field: $field:\n";
|
|
print " delim: $flag_fields{$event}{$field}{'delim'}\n";
|
|
foreach my $idx (sort {$a <=> $b} keys %{$flag_fields{$event}{$field}{"values"}}) {
|
|
print " value $idx: $flag_fields{$event}{$field}{'values'}{$idx}\n";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
sub symbol_str
|
|
{
|
|
my ($event_name, $field_name, $value) = @_;
|
|
|
|
if ($symbolic_fields{$event_name}{$field_name}) {
|
|
foreach my $idx (sort {$a <=> $b} keys %{$symbolic_fields{$event_name}{$field_name}{"values"}}) {
|
|
if (!$value && !$idx) {
|
|
return "$symbolic_fields{$event_name}{$field_name}{'values'}{$idx}";
|
|
last;
|
|
}
|
|
if ($value == $idx) {
|
|
return "$symbolic_fields{$event_name}{$field_name}{'values'}{$idx}";
|
|
}
|
|
}
|
|
}
|
|
|
|
return undef;
|
|
}
|
|
|
|
sub define_symbolic_field
|
|
{
|
|
my ($event_name, $field_name) = @_;
|
|
|
|
# nothing to do, really
|
|
}
|
|
|
|
sub define_symbolic_value
|
|
{
|
|
my ($event_name, $field_name, $value, $field_str) = @_;
|
|
|
|
$symbolic_fields{$event_name}{$field_name}{"values"}{$value} = $field_str;
|
|
}
|
|
|
|
sub dump_symbolic_fields
|
|
{
|
|
for my $event (keys %symbolic_fields) {
|
|
print "event $event:\n";
|
|
for my $field (keys %{$symbolic_fields{$event}}) {
|
|
print " field: $field:\n";
|
|
foreach my $idx (sort {$a <=> $b} keys %{$symbolic_fields{$event}{$field}{"values"}}) {
|
|
print " value $idx: $symbolic_fields{$event}{$field}{'values'}{$idx}\n";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
1;
|
|
__END__
|
|
=head1 NAME
|
|
|
|
Perf::Trace::Core - Perl extension for perf script
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
use Perf::Trace::Core
|
|
|
|
=head1 SEE ALSO
|
|
|
|
Perf (script) documentation
|
|
|
|
=head1 AUTHOR
|
|
|
|
Tom Zanussi, E<lt>tzanussi@gmail.com<gt>
|
|
|
|
=head1 COPYRIGHT AND LICENSE
|
|
|
|
Copyright (C) 2009 by Tom Zanussi
|
|
|
|
This library is free software; you can redistribute it and/or modify
|
|
it under the same terms as Perl itself, either Perl version 5.10.0 or,
|
|
at your option, any later version of Perl 5 you may have available.
|
|
|
|
Alternatively, this software may be distributed under the terms of the
|
|
GNU General Public License ("GPL") version 2 as published by the Free
|
|
Software Foundation.
|
|
|
|
=cut
|