From 78848e9bad62a450cf1656712017006ac14698b9 Mon Sep 17 00:00:00 2001 From: Timothy Day Date: Mon, 24 Apr 2023 01:44:38 +0000 Subject: [PATCH] LU-16694 misc: remove, update old scripts There are two old checkstack.pl in-tree. Remove both and pull down a new one from upstream. There's only one script in lustre/contrib (lustre_server.sh). It is meant for ClusterLabs resource-agents. But the script hasn't been maintained. Hence, remove it. Test-Parameters: trivial Signed-off-by: Timothy Day Change-Id: Id52ff11a7fa525b7ef20656df77c66a728e2b77a Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50720 Reviewed-by: Andreas Dilger Reviewed-by: Olaf Faaland Reviewed-by: Nathaniel Clark Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- contrib/scripts/checkstack.pl | 157 +++++++------ lustre/autoMakefile.am | 2 +- lustre/autoconf/lustre-core.m4 | 1 - lustre/contrib/.gitignore | 1 - lustre/contrib/Makefile.am | 4 - lustre/contrib/lustre_server.sh | 474 ---------------------------------------- lustre/tests/checkstack.pl | 83 ------- 7 files changed, 91 insertions(+), 631 deletions(-) delete mode 100644 lustre/contrib/.gitignore delete mode 100644 lustre/contrib/Makefile.am delete mode 100644 lustre/contrib/lustre_server.sh delete mode 100644 lustre/tests/checkstack.pl diff --git a/contrib/scripts/checkstack.pl b/contrib/scripts/checkstack.pl index d35b58a..d48dfed 100644 --- a/contrib/scripts/checkstack.pl +++ b/contrib/scripts/checkstack.pl @@ -1,4 +1,5 @@ -#!/usr/bin/perl +#!/usr/bin/env perl +# SPDX-License-Identifier: GPL-2.0 # Check the stack usage of functions # @@ -12,19 +13,18 @@ # sh64 port by Paul Mundt # Random bits by Matt Mackall # M68k port by Geert Uytterhoeven and Andreas Schwab -# AVR32 port by Haavard Skinnemoen -# PARISC port by Kyle McMartin +# AArch64, PARISC ports by Kyle McMartin # sparc port by Martin Habets +# ppc64le port by Breno Leitao +# riscv port by Wadim Mueller # # Usage: # objdump -d vmlinux | scripts/checkstack.pl [arch] # -# find -name "*.o" | while read M; do -# objdump -d $M | perl ~/checkstack.pl | \ -# sed "s/^/`basename $M`: /" ; done | \ -# awk '/esp/ { print $5, $2, $4 }' | sort -nr # TODO : Port to all architectures (one regex per arch) +use strict; + # check for arch # # $re is used for two matches: @@ -35,8 +35,10 @@ # $& (whole re) matches the complete objdump line with the stack growth # $1 (first bracket) matches the dynamic amount of the stack growth # +# $sub: subroutine for special handling to check stack usage. +# # use anything else and feel the pain ;) -my (@stack, $re, $dre, $x, $xs); +my (@stack, $re, $dre, $sub, $x, $xs, $funcre, $min_stack); { my $arch = shift; if ($arch eq "") { @@ -44,23 +46,29 @@ my (@stack, $re, $dre, $x, $xs); chomp($arch); } + $min_stack = shift; + if ($min_stack eq "" || $min_stack !~ /^\d+$/) { + $min_stack = 100; + } + $x = "[0-9a-f]"; # hex character $xs = "[0-9a-f ]"; # hex character or space - if ($arch eq 'arm') { + $funcre = qr/^$x* <(.*)>:$/; + if ($arch =~ '^(aarch|arm)64$') { + #ffffffc0006325cc: a9bb7bfd stp x29, x30, [sp, #-80]! + #a110: d11643ff sub sp, sp, #0x590 + $re = qr/^.*stp.*sp, \#-([0-9]{1,8})\]\!/o; + $dre = qr/^.*sub.*sp, sp, #(0x$x{1,8})/o; + } elsif ($arch eq 'arm') { #c0008ffc: e24dd064 sub sp, sp, #100 ; 0x64 - $re = qr/.*sub.*sp, sp, #(([0-9]{2}|[3-9])[0-9]{2})/o; - } elsif ($arch eq 'avr32') { - #8000008a: 20 1d sub sp,4 - #80000ca8: fa cd 05 b0 sub sp,sp,1456 - $re = qr/^.*sub.*sp.*,([0-9]{1,8})/o; - } elsif ($arch =~ /^i[3456]86$/) { + $re = qr/.*sub.*sp, sp, #([0-9]{1,4})/o; + $sub = \&arm_push_handling; + } elsif ($arch =~ /^x86(_64)?$/ || $arch =~ /^i[3456]86$/) { #c0105234: 81 ec ac 05 00 00 sub $0x5ac,%esp - $re = qr/^.*[as][du][db] \$(0x$x{1,8}),\%esp$/o; - $dre = qr/^.*[as][du][db] (%.*),\%esp$/o; - } elsif ($arch eq 'x86_64') { - # 2f60: 48 81 ec e8 05 00 00 sub $0x5e8,%rsp - $re = qr/^.*[as][du][db] \$(0x$x{1,8}),\%rsp$/o; - $dre = qr/^.*[as][du][db] (\%.*),\%rsp$/o; + # or + # 2f60: 48 81 ec e8 05 00 00 sub $0x5e8,%rsp + $re = qr/^.*[as][du][db] \$(0x$x{1,8}),\%(e|r)sp$/o; + $dre = qr/^.*[as][du][db] (%.*),\%(e|r)sp$/o; } elsif ($arch eq 'ia64') { #e0000000044011fc: 01 0f fc 8c adds r12=-384,r12 $re = qr/.*adds.*r12=-(([0-9]{2}|[3-9])[0-9]{2}),r12/o; @@ -74,15 +82,17 @@ my (@stack, $re, $dre, $x, $xs); } elsif ($arch eq 'mips') { #88003254: 27bdffe0 addiu sp,sp,-32 $re = qr/.*addiu.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o; + } elsif ($arch eq 'nios2') { + #25a8: defffb04 addi sp,sp,-20 + $re = qr/.*addi.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o; + } elsif ($arch eq 'openrisc') { + # c000043c: 9c 21 fe f0 l.addi r1,r1,-272 + $re = qr/.*l\.addi.*r1,r1,-(([0-9]{2}|[3-9])[0-9]{2})/o; } elsif ($arch eq 'parisc' || $arch eq 'parisc64') { $re = qr/.*ldo ($x{1,8})\(sp\),sp/o; - } elsif ($arch eq 'ppc') { - #c00029f4: 94 21 ff 30 stwu r1,-208(r1) - $re = qr/.*stwu.*r1,-($x{1,8})\(r1\)/o; - } elsif ($arch eq 'ppc64') { - #XXX - $re = qr/.*stdu.*r1,-($x{1,8})\(r1\)/o; - } elsif ($arch eq 'powerpc') { + } elsif ($arch eq 'powerpc' || $arch =~ /^ppc(64)?(le)?$/ ) { + # powerpc : 94 21 ff 30 stwu r1,-208(r1) + # ppc64(le) : 81 ff 21 f8 stdu r1,-128(r1) $re = qr/.*st[dw]u.*r1,-($x{1,8})\(r1\)/o; } elsif ($arch =~ /^s390x?$/) { # 11160: a7 fb ff 60 aghi %r15,-160 @@ -96,35 +106,63 @@ my (@stack, $re, $dre, $x, $xs); # pair for larger users. -- PFM. #a00048e0: d4fc40f0 addi.l r15,-240,r15 $re = qr/.*addi\.l.*r15,-(([0-9]{2}|[3-9])[0-9]{2}),r15/o; - } elsif ($arch =~ /^blackfin$/) { - # 0: 00 e8 38 01 LINK 0x4e0; - $re = qr/.*[[:space:]]LINK[[:space:]]*(0x$x{1,8})/o; } elsif ($arch eq 'sparc' || $arch eq 'sparc64') { # f0019d10: 9d e3 bf 90 save %sp, -112, %sp $re = qr/.*save.*%sp, -(([0-9]{2}|[3-9])[0-9]{2}), %sp/o; + } elsif ($arch =~ /^riscv(64)?$/) { + #ffffffff8036e868: c2010113 addi sp,sp,-992 + $re = qr/.*addi.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o; } else { print("wrong or unknown architecture \"$arch\"\n"); exit } } -sub bysize($) { - my ($asize, $bsize); - ($asize = $a) =~ s/.*: *(.*)$/$1/; - ($bsize = $b) =~ s/.*: *(.*)$/$1/; - $bsize <=> $asize +# +# To count stack usage of push {*, fp, ip, lr, pc} instruction in ARM, +# if FRAME POINTER is enabled. +# e.g. c01f0d48: e92ddff0 push {r4, r5, r6, r7, r8, r9, sl, fp, ip, lr, pc} +# +sub arm_push_handling { + my $regex = qr/.*push.*fp, ip, lr, pc}/o; + my $size = 0; + my $line_arg = shift; + + if ($line_arg =~ m/$regex/) { + $size = $line_arg =~ tr/,//; + $size = ($size + 1) * 4; + } + + return $size; } # # main() # -my $funcre = qr/^$x* <(.*)>:$/; -my $func; -my $file, $lastslash; +my ($func, $file, $lastslash, $total_size, $addr, $intro); + +$total_size = 0; while (my $line = ) { if ($line =~ m/$funcre/) { $func = $1; + next if $line !~ m/^($xs*)/; + if ($total_size > $min_stack) { + push @stack, "$intro$total_size\n"; + } + + $addr = $1; + $addr =~ s/ /0/g; + $addr = "0x$addr"; + + $intro = "$addr $func [$file]:"; + my $padlen = 56 - length($intro); + while ($padlen > 0) { + $intro .= ' '; + $padlen -= 8; + } + + $total_size = 0; } elsif ($line =~ m/(.*):\s*file format/) { $file = $1; @@ -145,38 +183,23 @@ while (my $line = ) { } next if ($size > 0x10000000); - next if $line !~ m/^($xs*)/; - my $addr = $1; - $addr =~ s/ /0/g; - $addr = "0x$addr"; - -# my $intro = "$addr $func [$file]:"; -# my $padlen = 56 - length($intro); -# while ($padlen > 0) { -# $intro .= ' '; -# $padlen -= 8; -# } -# next if ($size < 100); -# push @stack, "$intro$size\n"; - push @stack, "$size $file:$func\n"; + $total_size += $size; } elsif (defined $dre && $line =~ m/$dre/) { - my $size = "Dynamic ($1)"; + my $size = $1; - next if $line !~ m/^($xs*)/; - my $addr = $1; - $addr =~ s/ /0/g; - $addr = "0x$addr"; + $size = hex($size) if ($size =~ /^0x/); + $total_size += $size; + } + elsif (defined $sub) { + my $size = &$sub($line); -# my $intro = "$addr $func [$file]:"; -# my $padlen = 56 - length($intro); -# while ($padlen > 0) { -# $intro .= ' '; -# $padlen -= 8; -# } -# push @stack, "$intro$size\n"; - push @stack, "$size $file:$func\n"; + $total_size += $size; } } +if ($total_size > $min_stack) { + push @stack, "$intro$total_size\n"; +} -print sort bysize @stack; +# Sort output by size (last field) +print sort { ($b =~ /:\t*(\d+)$/)[0] <=> ($a =~ /:\t*(\d+)$/)[0] } @stack; diff --git a/lustre/autoMakefile.am b/lustre/autoMakefile.am index 9ceb6e3..61f0e97 100644 --- a/lustre/autoMakefile.am +++ b/lustre/autoMakefile.am @@ -35,7 +35,7 @@ AUTOMAKE_OPTIONS = foreign # also update lustre/autoconf/lustre-core.m4 AC_CONFIG_FILES ALWAYS_SUBDIRS = include obdclass ldlm ptlrpc obdecho ec \ - mgc fid fld doc utils tests tests/kernel scripts autoconf contrib conf + mgc fid fld doc utils tests tests/kernel scripts autoconf conf SERVER_SUBDIRS = ost mgs mdt mdd ofd osd-zfs osd-ldiskfs \ quota osp lod target lfsck diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 3200c7a..ee485d3 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -4651,7 +4651,6 @@ lustre/autoMakefile lustre/autoconf/Makefile lustre/conf/Makefile lustre/conf/resource/Makefile -lustre/contrib/Makefile lustre/doc/Makefile lustre/include/Makefile lustre/include/lustre/Makefile diff --git a/lustre/contrib/.gitignore b/lustre/contrib/.gitignore deleted file mode 100644 index 10a7e8d..0000000 --- a/lustre/contrib/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/Makefile.in diff --git a/lustre/contrib/Makefile.am b/lustre/contrib/Makefile.am deleted file mode 100644 index f5c1e23..0000000 --- a/lustre/contrib/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -# Contributions Makefile - -EXTRA_DIST = -pkgdata_DATA = $(EXTRA_DIST) diff --git a/lustre/contrib/lustre_server.sh b/lustre/contrib/lustre_server.sh deleted file mode 100644 index 7b4e3a7..0000000 --- a/lustre/contrib/lustre_server.sh +++ /dev/null @@ -1,474 +0,0 @@ -#!/bin/bash -# -# License: GNU General Public License (GPL) -# -# lustre_server -# Description: Manages a lustre_server on a shared storage medium. -# Original Author: Eric Z. Ayers (eric.ayers@compgen.com) -# Original Release: 25 Oct 2000 -# -# Rewritten Filesystem agent to lustre_server agent by bschubert@ddn.com -# -# usage: ./lustre_server {start|stop|status|monitor|validate-all|meta-data} -# -# OCF parameters are as below: -# OCF_RESKEY_device -# OCF_RESKEY_directory -# OCF_RESKEY_options -# -#OCF_RESKEY_device : name of block device for the filesystem. e.g. /dev/sda1, /dev/md0 -# Or a -U or -L option for mount, or an NFS mount specification -#OCF_RESKEY_directory : the mount point for the filesystem -#OCF_RESKEY_options : options to be given to the mount command via -o -# -# -# NOTE: There is no locking (such as a SCSI reservation) being done here. -# I would if the SCSI driver could properly maintain the reservation, -# which it cannot, even with the 'scsi reservation' patch submitted -# earlier this year by James Bottomley. The patch minimizes the -# bus resets caused by a RESERVATION_CONFLICT return, and helps the -# reservation stay when 2 nodes contend for a reservation, -# but it does not attempt to recover the reservation in the -# case of a bus reset. -# -# What all this means is that if 2 nodes mount the same file system -# read-write, the filesystem is going to become corrupted. However -# Lustre provides the Multi-Mount-Protection feature (MMP). -# -# As a result, you should use this together with the stonith option -# and redundant, independent communications paths. -# -# If you don't do this, don't blame us when you scramble your disk. -# -# Note: the ServeRAID controller does prohibit concurrent acess -# In this case, you don't actually need STONITH, but redundant comm is -# still an excellent idea. -# - -####################################################################### -# Initialization: - -. ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs - -####################################################################### -HOSTOS=`uname` -FSTYPE="lustre" - -# FIXME: OCF_DEBUG officially supported in the the mean time? -#OCF_DEBUG=yes - -usage() { - cat <<-EOT - usage: $0 {start|stop|status|monitor|validate-all|meta-data} - EOT -} - -meta_data() { - cat < - - -1.0 - - - - Resource script for lustre_server. It manages a lustre_server on a shared storage medium. - -lustre_server resource agent - - - - - The name of block device for the filesystem - - block device - - - - - - The mount point for the filesystem. - - mount point - - - - - - Any extra options to be given as -o options to mount. - - options - - - - - - - - - - - - -END -} - -# -# Make sure the kernel does the right thing with the FS buffers -# This function should be called after unmounting and before mounting -# It may not be necessary in 2.4 and later kernels, but it shouldn't hurt -# anything either... -# -# It's really a bug that you have to do this at all... -# -flushbufs() { - if have_binary $BLOCKDEV ; then - $BLOCKDEV --flushbufs $1 - fi - return 0 -} - -# Figure out the real device number of external journals -# we need to provide as mount options, since the block -# device only know major/minor of the the journal device and it -# might/will change dynamically on reboots and between servers -# It would be MUCH better if 'mount' would do it on its own -# and in fact mount is already linked against libblkid to do -# this job -get_external_journal_device() -{ - UUID=`dumpe2fs -h $DEVICE 2>/dev/null | awk '/^Journal UUID/{print $3}'` - if [ -z "$UUID" ]; then - # device has internal journal, not need to proceed - return - fi - - # prefer /dev/mapper/ - JDEV="`blkid -t UUID=$UUID /dev/mapper/* | awk -F: '{print $1}'`" - if [ -z "$JDEV" ]; then - JDEV="`blkid -t UUID=$UUID | awk -F: '{print $1}'`" - fi - - if [ -z "$JDEV" ]; then - # know the journal is on an external device, but we can't find it - ocf_log err "Cannot find device with journal UUID $UUID" - return $OCF_ERR_GENERIC - fi - - DEVNUM="`stat -c %02t%02T $JDEV`" - if [ -z "$DEVNUM" ]; then - ocf_log err "Failed to retrieve device number of Journal device" - return $OCF_ERR_GENERIC - fi - - # add 0x only here, because we couldn't check for an empty string otherwise - DEVNUM="0x$DEVNUM" - - echo $DEVNUM - return 0 -} - -# Take advantage of /proc/mounts if present, use portable mount command -# otherwise. Normalize format to "dev mountpoint fstype". -list_mounts() { - mtab=/proc/mounts - if [ ! -f $mtab ]; then - ocf_log err "$mtab is missing!" - exit $OCF_ERR_GENERIC - fi - cat $mtab | cut -d' ' -f1,2,3 -} - -lustre_health_check() -{ - check=$(lctl get_param -n health_check 2>&1) - # on first check the lustre modules are not loaded yet - if [ $? != 0 ]; then - return 0 - fi - - if [ "$check" = "healthy" ]; then - return 0 - else - ocf_log err "health_check is $check" - return 1 - fi -} - -# -# START: Start up the filesystem -# -lustre_server_start() -{ - lustre_health_check - if [ $? -ne 0 ]; then - return ${OCF_ERR_GENERIC} - fi - - # See if the device is currently mounted - lustre_server_status >/dev/null 2>&1 - rc=$? - if [ $rc -ne $OCF_NOT_RUNNING -a $rc -ne $OCF_SUCCESS ]; then - ocf_log err "Unexpected status ($c) before mounting $DEVICE to $MOUNTPOINT" - elif [ $rc -eq $OCF_SUCCESS ]; then - return $OCF_SUCCESS - fi - - if [ ! -d "$MOUNTPOINT" ] ; then - ocf_log err "Couldn't find directory [$MOUNTPOINT] to use as a mount point" - exit $OCF_ERR_ARGS - fi - - flushbufs $DEVICE - - jdev=`get_external_journal_device` - rc=$? - if [ $rc -ne 0 ]; then - ocf_log err "Failure to get journal device" - return $rc - fi - - if [ -n "$jdev" ]; then - if [ -n "$options" ]; then - options="$options,journal_dev=$jdev" - else - options="-ojournal_dev=$jdev" - fi - fi - - # Mount the filesystem. - cmd="$MOUNT -t $FSTYPE $options $DEVICE $MOUNTPOINT" - ocf_log info "Running $cmd" - res=`eval $cmd 2>&1` - if [ $? -ne 0 ]; then - ocf_log err "cmd \"$cmd\" failed: $res" - return $OCF_ERR_GENERIC - fi - - return 0 -} -# end of lustre_server_start - -# -# STOP: Unmount the filesystem -# -lustre_server_stop() -{ - # See if the device is currently mounted - lustre_server_mounted >/dev/null 2>&1 - if [ $? -eq $OCF_NOT_RUNNING ]; then - # Already unmounted, wonderful. - rc=$OCF_SUCCESS - else - # Umount $MOUNTPOINT. - ocf_log info "Trying to unmount $MOUNTPOINT" - cmd="$UMOUNT $MOUNTPOINT" - ocf_log info "Running $cmd" - res=`eval $cmd 2>&1` - rc=$? - if [ $rc -eq 0 ] ; then - rc=$OCF_SUCCESS - ocf_log info "unmounted $MOUNTPOINT successfully" - else - rc=$OCF_ERR_GENERIC - ocf_log err "\"$cmd\" failed ($rc): $res" - fi - fi - - flushbufs $DEVICE - - return $rc -} -# end of lustre_server_stop - -# -# MOUNTED: is the filesystem mounted or not? -# -lustre_server_mounted() -{ - if list_mounts | grep -q " $MOUNTPOINT " >/dev/null 2>&1; then - rc=$OCF_SUCCESS - msg="$MOUNTPOINT is mounted (running)" - else - rc=$OCF_NOT_RUNNING - msg="$MOUNTPOINT is unmounted (stopped)" - fi - - # check in all mntdevs if really not mounted - # lustre bug 21359 (https://bugzilla.lustre.org/show_bug.cgi?id=21359) - if [ $rc -eq $OCF_NOT_RUNNING ]; then - dev=$(lctl get_param -n mds.*.mntdev 2>&1) - if [ $? = 0 ]; then - MNTDEVS=$dev - fi - dev=$(lctl get_param -n obdfilter.*.mntdev 2>&1) - if [ $? = 0 ]; then - MNTDEVS="$MNTDEVS $dev" - fi - dev=$(lctl get_param -n mgs.MGS.mntdev 2>&1) - if [ $? = 0 ]; then - MNTDEVS="$MNTDEVS $dev" - fi - for i in $MNTDEVS; do - if [ "$i" = "$DEVICE" ]; then - ocf_log err "Bug21359, /proc/mounts claims device is not mounted, but $i proves this is wrong" - rc=$OCF_ERR_GENERIC - fi - done - - fi - - if [ "$OCF_DEBUG" = "yes" ]; then - ocf_log info "$msg" - fi - - case "$OP" in - status) ocf_log info "$msg" - ;; - monitor) - if [ $rc -ne $OCF_SUCCESS ]; then - ocf_log err "$msg" - fi - esac - - return $rc -} -# end of lustre_server_mounted - -# -# STATUS: is the filesystem mounted and healthy or not? -# -lustre_server_status() -{ - lustre_health_check - if [ $? -ne 0 ]; then - return ${OCF_ERR_GENERIC} - fi - - lustre_server_mounted - rc=$? - - return $rc -} -# end of lustre_server_status - -# -# Check if Lustre is available at all -# -lustre_server_validate_all() -{ - var=$(lctl get_param -n version 2>&1) - if [ $? != 0 ]; then - modprobe lustre - - for i in `seq 1 10`; do - var=$(lctl get_param -n version 2>&1) - if [ $? != 0 ]; then - sleep 1 - else - break - fi - done - - var=$(lctl get_param -n version 2>&1) - if [ $? != 0 ]; then - ocf_log err "Failed to load the lustre module" - return $OCF_ERR_GENERIC - fi - fi - - return $OCF_SUCCESS -} - -# Check the arguments passed to this script -if [ $# -ne 1 ]; then - usage - exit $OCF_ERR_ARGS -fi - -# Check the OCF_RESKEY_ environment variables... -DEVICE=$OCF_RESKEY_device -if [ ! -z "$OCF_RESKEY_options" ]; then - options="-o $OCF_RESKEY_options" -fi - -OP=$1 - -if [ "$OCF_DEBUG" = "yes" ]; then - ocf_log info "OP = $OP" -fi - -# These operations do not require instance parameters -case $OP in -meta-data) meta_data - exit $OCF_SUCCESS - ;; -usage) usage - exit $OCF_SUCCESS - ;; -esac - -# Normalize instance parameters: - -# It is possible that OCF_RESKEY_directory has one or even multiple trailing "/". -# But the output of `mount` and /proc/mounts do not. -if [ -z "$OCF_RESKEY_directory" ]; then - ocf_log err "Please specify the directory" - exit $OCF_ERR_ARGS -else - MOUNTPOINT=$(echo $OCF_RESKEY_directory | sed 's/\/*$//') - : ${MOUNTPOINT:=/} - # At this stage, $MOUNTPOINT does not contain trailing "/" unless it is "/" - # TODO: / mounted via lustre_server sounds dangerous. On stop, we'll - # kill the whole system. Is that a good idea? -fi - -MOUNTPOINT=`echo $MOUNTPOINT | sed -e 's/\s*//'` -if [ -z "$MOUNTPOINT" ]; then - ocf_log err "Empty mount point!" - ocf_log err "Please specify the directory" - exit $OCF_ERR_ARGS -fi - -# Check to make sure the utilites are found -check_binary $MODPROBE -check_binary $FSCK -check_binary $MOUNT -check_binary $UMOUNT - -if [ "$OP" != "monitor" ]; then - ocf_log info "Running $OP for $DEVICE on $MOUNTPOINT" -fi - -# These operations do not require the clone checking + OCFS2 -# initialization. -case $OP in -status|monitor) lustre_server_status - exit $? - ;; -validate-all) lustre_server_validate_all - exit $? - ;; -stop) lustre_server_stop - exit $? - ;; -esac - -if [ -n "$OCF_RESKEY_CRM_meta_clone" ]; then - ocf_log err "DANGER! $FSTYPE on $DEVICE is NOT cluster-aware!" - ocf_log err "DO NOT RUN IT AS A CLONE!" - ocf_log err "Politely refusing to proceed to avoid data corruption." - exit $OCF_ERR_GENERIC -fi - -case $OP in -start) lustre_server_start - ;; -*) usage - exit $OCF_ERR_UNIMPLEMENTED - ;; -esac -exit $? - - - diff --git a/lustre/tests/checkstack.pl b/lustre/tests/checkstack.pl deleted file mode 100644 index c59c970..0000000 --- a/lustre/tests/checkstack.pl +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/perl -# Check the stack usage of functions -# -# Copyright Joern Engel -# Inspired by Linus Torvalds -# Original idea maybe from Keith Owens -# s390 port and big speedup by Arnd Bergmann -# Modified to have simpler output format by Dan Kegel -# -# Usage: -# objdump -d vmlinux | stackcheck.pl [arch] -# -# find -name "*.o" | while read M; do -# objdump -d $M | perl ~/checkstack.pl | \ -# sed "s/^/`basename $M`: /" ; done | \ -# awk '/esp/ { print $5, $2, $4 }' | sort -nr - -# TODO : Port to all architectures (one regex per arch) - -# check for arch -# -# $re is used for three matches: -# $& (whole re) matches the complete objdump line with the stack growth -# $1 (first bracket) matches the code that will be displayed in the output -# $2 (second bracket) matches the size of the stack growth -# -# use anything else and feel the pain ;) -{ - my $arch = shift; - $x = "[0-9a-f]{1,5}"; # hex number - $d = "[0-9]{1,5}"; # decimal number - if ($arch eq "") { - $arch = `uname -m`; - } - if ($arch =~ /^i[3456]86$/) { - #c0105234: 81 ec ac 05 00 00 sub $0x5ac,%esp - $re = qr/^.*(sub \$(0x$x),\%esp)$/o; - $todec = sub { return hex($_[0]); }; - } elsif ($arch =~ /^ia64$/) { - #e0000000044011fc: 01 0f fc 8c adds r12=-384,r12 - $re = qr/.*(adds.*r12=-($d),r12)/o; - $todec = sub { return $_[0]; }; - } elsif ($arch =~ /^mips64$/) { - #8800402c: 67bdfff0 daddiu sp,sp,-16 - $re = qr/.*(daddiu.*sp,sp,-($d))/o; - $todec = sub { return $_[0]; }; - } elsif ($arch =~ /^mips$/) { - #88003254: 27bdffe0 addiu sp,sp,-32 - $re = qr/.*(addiu.*sp,sp,-($d))/o; - $todec = sub { return $_[0]; }; - } elsif ($arch =~ /^ppc$/) { - #c00029f4: 94 21 ff 30 stwu r1,-208(r1) - $re = qr/.*(stwu.*r1,-($x)\(r1\))/o; - $todec = sub { return hex($_[0]); }; - } elsif ($arch =~ /^s390x?$/) { - # 11160: a7 fb ff 60 aghi %r15,-160 - $re = qr/.*(ag?hi.*\%r15,-($d))/o; - $todec = sub { return $_[0]; }; - } else { - print "Usage: objdump -d vmlinux | checkstack.pl [arch]\n"; - print "where arch is i386, ia64, mips, mips64, ppc, or s390\n"; - print "Each output line gives a function's stack usage, name\n"; - print "Lines are output in order of decreasing stack usage\n"; - die("wrong or unknown architecture\n"); - } -} - -$funcre = qr/^[0-9a-f]* \<(.*)\>:$/; -while ($line = ) { - if ($line =~ m/$funcre/) { - ($func = $line) =~ s/$funcre/\1/; - chomp($func); - } - if ($line =~ m/$re/) { - push(@stack, &$todec($2)." ".$func); - # don't expect more than one stack allocation per function - $func .= " ** bug **"; - } -} - -foreach (sort { $b - $a } (@stack)) { - print $_."\n"; -} -- 1.8.3.1