summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
d634e66)
Add an --exit-on-close (-e), option to ofd_access_log_reader.
Test-Parameters: trivial
Signed-off-by: John L. Hammond <jhammond@whamcloud.com>
Change-Id: Ifded63318026b0ad3f9f077dc74008469df877d9
Reviewed-on: https://review.whamcloud.com/40312
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
}
run_test 165e "ofd_access_log MDT index filter works"
}
run_test 165e "ofd_access_log MDT index filter works"
+test_165f() {
+ local trace="/tmp/${tfile}.trace"
+ local rc
+ local count
+
+ setup_165
+ do_facet ost1 timeout 60 ofd_access_log_reader \
+ --exit-on-close --debug=- --trace=- > "${trace}" &
+ sleep 5
+ stop ost1
+
+ wait
+ rc=$?
+
+ if ((rc != 0)); then
+ error_noexit "ofd_access_log_reader exited with rc = '${rc}'"
+ cat "${trace}"
+ exit 1
+ fi
+}
+run_test 165f "ofd_access_log_reader --exit-on-close works"
+
test_169() {
# do directio so as not to populate the page cache
log "creating a 10 Mb file"
test_169() {
# do directio so as not to populate the page cache
log "creating a 10 Mb file"
+static unsigned int alr_log_count;
static struct alr_log *alr_log[1 << 20]; /* 20 == MINORBITS */
static int oal_version; /* FIXME ... major version, minor version */
static __u32 alr_filter = 0xffffffff; /* no filter by default */
static struct alr_log *alr_log[1 << 20]; /* 20 == MINORBITS */
static int oal_version; /* FIXME ... major version, minor version */
static __u32 alr_filter = 0xffffffff; /* no filter by default */
free(al->alr_buf);
al->alr_buf = NULL;
al->alr_buf_size = 0;
free(al->alr_buf);
al->alr_buf = NULL;
al->alr_buf_size = 0;
}
/* Add an access log (identified by path) to the epoll set. */
}
/* Add an access log (identified by path) to the epoll set. */
FATAL("cannot allocate struct alr_dev of size %zu: %s\n",
sizeof(*al), strerror(errno));
FATAL("cannot allocate struct alr_dev of size %zu: %s\n",
sizeof(*al), strerror(errno));
al->alr_dev.alr_io = &alr_log_io;
al->alr_dev.alr_destroy = &alr_log_destroy;
al->alr_dev.alr_fd = fd;
al->alr_dev.alr_io = &alr_log_io;
al->alr_dev.alr_destroy = &alr_log_destroy;
al->alr_dev.alr_fd = fd;
" -F, --batch-fraction=P set batch printing fraction to P/100\n"
" -i, --batch-interval=INTERVAL print batch every INTERVAL seconds\n"
" -o, --batch-offset=OFFSET print batch at OFFSET seconds\n"
" -F, --batch-fraction=P set batch printing fraction to P/100\n"
" -i, --batch-interval=INTERVAL print batch every INTERVAL seconds\n"
" -o, --batch-offset=OFFSET print batch at OFFSET seconds\n"
+" -e, --exit-on-close exit on close of all log devices\n"
" -I, --mdt-index-filter=INDEX set log MDT index filter to INDEX\n"
" -h, --help display this help and exit\n"
" -l, --list print YAML list of available access logs\n"
" -I, --mdt-index-filter=INDEX set log MDT index filter to INDEX\n"
" -h, --help display this help and exit\n"
" -l, --list print YAML list of available access logs\n"
struct alr_dev *alr_batch_timer = NULL;
struct alr_dev *alr_batch_file_hup = NULL;
struct alr_dev *alr_ctl = NULL;
struct alr_dev *alr_batch_timer = NULL;
struct alr_dev *alr_batch_file_hup = NULL;
struct alr_dev *alr_ctl = NULL;
time_t batch_interval = 0;
time_t batch_offset = 0;
unsigned int m;
time_t batch_interval = 0;
time_t batch_offset = 0;
unsigned int m;
{ .name = "batch-fraction", .has_arg = required_argument, .val = 'F', },
{ .name = "batch-interval", .has_arg = required_argument, .val = 'i', },
{ .name = "batch-offset", .has_arg = required_argument, .val = 'o', },
{ .name = "batch-fraction", .has_arg = required_argument, .val = 'F', },
{ .name = "batch-interval", .has_arg = required_argument, .val = 'i', },
{ .name = "batch-offset", .has_arg = required_argument, .val = 'o', },
+ { .name = "exit-on-close", .has_arg = no_argument, .val = 'e', },
{ .name = "mdt-index-filter", .has_arg = required_argument, .val = 'I' },
{ .name = "debug", .has_arg = optional_argument, .val = 'd', },
{ .name = "help", .has_arg = no_argument, .val = 'h', },
{ .name = "mdt-index-filter", .has_arg = required_argument, .val = 'I' },
{ .name = "debug", .has_arg = optional_argument, .val = 'd', },
{ .name = "help", .has_arg = no_argument, .val = 'h', },
- while ((c = getopt_long(argc, argv, "d::f:F:hi:I:ls:t::", options, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "d::ef:F:hi:I:ls:t::", options, NULL)) != -1) {
+ case 'e':
+ exit_on_close = 1;
+ break;
case 'f':
alr_batch_file_path = optarg;
break;
case 'f':
alr_batch_file_path = optarg;
break;
+
+ if (exit_on_close && alr_log_count == 0) {
+ DEBUG("no open logs devices, exiting\n");
+ exit_status = EXIT_SUCCESS;
+ goto out;
+ }
} while (!list_info);
exit_status = EXIT_SUCCESS;
} while (!list_info);
exit_status = EXIT_SUCCESS;