This file is indexed.

/var/lib/pcp/testsuite/common.gfs2 is in pcp-testsuite 3.8.12ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#
# Common pre-test checking and settings for GFS2 QA. Handles setup for
# the basic environment needed for GFS2 pmda testing.
#
# Copyright (c) 2013 Red Hat, Inc.  All Rights Reserved.
#

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check

_gfs2_filesystem_support_tests()
{
    [ $PCP_VER -ge 3611 ] || _notrun "Installed pcp version is too old"
    [ $PCP_PLATFORM = linux ] || _notrun "GFS2 test, only works with Linux"

    grep gfs2 /proc/filesystems >/dev/null
    if [ $? -ne 0 ]; then
        $sudo modprobe gfs2
        if [ $? -ne 0 ]; then 
            _notrun "no GFS2 module to load and not builtin" 
        fi

        grep gfs2 /proc/filesystems >/dev/null
        if [ $? -ne 0 ]; then 
            _notrun "failed to load the gfs2 module successfully, sorry" 
        fi
    fi
 
    if ! type "mkfs.gfs2" > /dev/null; then
        _notrun "mkfs.gfs2 not found, please install gfs2-utils"
    fi
}

_debugfs_mount_tests()
{
    if [ ! -d /sys/kernel/debug/gfs2/ ]; then
        $sudo mount -t debugfs none /sys/kernel/debug
   
        if [ ! -d /sys/kernel/debug/gfs2/ ]; then
            _notrun "debugfs not mounted and have been unable to mount debugfs"
        fi
    fi
}

_gfs2_tracepoints_support_tests()
{
    [ -d /sys/kernel/debug/tracing/events/gfs2 ] || \
	_notrun "No kernel support for GFS2 tracepoint stats"
}

_gfs2_filter_pminfo()
{
    # The order in which loop device paths are evaluated is non-deterministic
    # but that's ok; we just want to check both are found and have some value
    #
    tee -a $here/$seq.full | sed \
        -e 's/value [0-9][0-9]*/value NUMBER/' \
        -e 's/"loop[01]"/"loopN"/g'
}

_pmcount()
{
    pminfo $1 | grep -c .
}

_filter_gfs2()
{
    sed -e 's/ and [0-9[0-9]* values/ and N values/g'
}

_setup_gfs2_mounts()
{
    # create a couple of filesystems on sparse files, mount.
    for fs in 1 0
    do
	echo "creating pseudo device $fs"
	dd of=$tmp.loop$fs if=/dev/zero bs=1048576 seek=1024 count=1 2>/dev/null
	echo "creating a mount point $fs"
	mkfs.gfs2 -O -p lock_nolock -j 1 $tmp.loop$fs >/dev/null
	echo "creating device file $fs"
	$sudo losetup /dev/loop$fs $tmp.loop$fs
	echo "creating a mount point $fs"
	mkdir -p $tmp.mount$fs.dir
	echo "mounting pseudo device $fs"
	$sudo mount -t gfs2 /dev/loop$fs $tmp.mount$fs.dir
    done
}

_setup_gfs2_tracepoints()
{
    enable_tracing=$1
    [ "X$enable_tracing" == X ] && enable_tracing=false

    file=/sys/kernel/debug/tracing/events/gfs2/enable
    [ -f $file ] || _notrun "Cannot enable gfs2 tracepoints"

    $enable_tracing || continue
    echo "enabling gfs2 tracepoints"
    $sudo sh -c "echo 1 > $file"
}

_install_pmda()
{
    # install the PMDA
    cd $PCP_PMDAS_DIR/$iam
    $sudo ./Remove < /dev/null >/dev/null 2>&1
    $sudo ./Install < /dev/null >$tmp.out 2>&1
    cat $tmp.out | _filter_pmda_install | sed \
    -e '/.*pmcd.*/d' \
    -e '/.*pmlogger.*/d' \
    -e '/Latest.*/d' \
    -e '/Duplicate.*/d'
}

_remove_pmda()
{
    cd $PCP_PMDAS_DIR/$iam
    $sudo ./Remove < /dev/null > /dev/null 2>&1
}

_cleanup()
{
    for fs in 0 1
    do
	$sudo umount $tmp.mount$fs.dir
	$sudo losetup -d /dev/loop$fs
    done

    _restore_pmda_install $iam
    $sudo rm -fr $tmp.*.dir
    $sudo rm -f $tmp.*
    exit $status
}