Skip to content

Commit

Permalink
RHEL7/CentOS7 check_disk autofs issue
Browse files Browse the repository at this point in the history
Fix for issue #141.
Also put in logic to skip certain system "fake" mountpoints
such as sysfs, proc, fusectl, tmpfs, etc.
  • Loading branch information
John C. Frickson committed Apr 7, 2017
1 parent 4bba6f4 commit a29cd35
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions plugins/check_disk.c
Expand Up @@ -180,7 +180,7 @@ main (int argc, char **argv)
double critical_high_tide;
int temp_result;

struct mount_entry *me;
struct mount_entry *me, *last_me = NULL;
struct fs_usage fsp, tmpfsp;
struct parameter_list *temp_list, *path;

Expand Down Expand Up @@ -211,6 +211,27 @@ main (int argc, char **argv)
*/
if (path_selected == FALSE) {
for (me = mount_list; me; me = me->me_next) {
if (strcmp(me->me_type, "autofs") == 0 && show_local_fs) {
if (last_me == NULL)
mount_list = me;
else
last_me->me_next = me->me_next;
free_mount_entry (me);
continue;
}
if (strcmp(me->me_type, "sysfs") == 0 || strcmp(me->me_type, "proc") == 0
|| strcmp(me->me_type, "debugfs") == 0 || strcmp(me->me_type, "tracefs") == 0
|| strcmp(me->me_type, "fusectl") == 0 || strcmp(me->me_type, "fuse.gvfsd-fuse") == 0
|| strcmp(me->me_type, "cgroup") == 0 || strstr(me->me_type, "tmpfs") != NULL)
{
if (last_me == NULL)
mount_list = me->me_next;
else
last_me->me_next = me->me_next;
free_mount_entry (me);
continue;
}

if (! (path = np_find_parameter(path_select_list, me->me_mountdir))) {
path = np_add_parameter(&path_select_list, me->me_mountdir);
}
Expand Down Expand Up @@ -989,7 +1010,7 @@ stat_path (struct parameter_list *p)
{
/* Stat entry to check that dir exists and is accessible */
if (verbose >= 3)
printf("calling stat on %s\n", p->name);
printf("calling stat on %s (%s %s)\n", p->name, p->best_match->me_devname, p->best_match->me_type);
if (stat (p->name, &stat_buf[0])) {
if (verbose >= 3)
printf("stat failed on %s\n", p->name);
Expand Down

0 comments on commit a29cd35

Please sign in to comment.