X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Futils%2Fofd_access_log_reader.c;fp=lustre%2Futils%2Fofd_access_log_reader.c;h=cf72d9e90d23601a968119533086f7bcc5152629;hb=9bf968db56ddbad525dffe6fc4b9fde7d55dbde3;hp=ddba697c051b84ea166c39d45c11e7de6f983cf7;hpb=e3a4dc406f6d429f5535cb8d3a86004991c61b26;p=fs%2Flustre-release.git diff --git a/lustre/utils/ofd_access_log_reader.c b/lustre/utils/ofd_access_log_reader.c index ddba697..cf72d9e 100644 --- a/lustre/utils/ofd_access_log_reader.c +++ b/lustre/utils/ofd_access_log_reader.c @@ -146,6 +146,9 @@ static int alr_print_fraction = 100; static void alr_dev_free(int epoll_fd, struct alr_dev *ad) { + if (ad == NULL) + return; + TRACE("alr_dev_free %s\n", ad->alr_name); if (!(ad->alr_fd < 0)) @@ -891,8 +894,19 @@ int main(int argc, char *argv[]) /* Open control device. */ int ctl_fd = open(ctl_path, O_RDONLY|O_NONBLOCK|O_CLOEXEC); - if (ctl_fd < 0) + if (ctl_fd < 0) { + /* If no OSTs are mounted then the ofd module may not + * be loaded and hence the control device may not be + * present. Handle this in the same way that we handle + * no OSTs and exit_on_close below. */ + if (errno == ENOENT && exit_on_close) { + DEBUG("no control device, exiting\n"); + exit_status = EXIT_SUCCESS; + goto out; + } + FATAL("cannot open '%s': %s\n", ctl_path, strerror(errno)); + } /* Get and print interface version. */ oal_version = ioctl(ctl_fd, LUSTRE_ACCESS_LOG_IOCTL_VERSION);