From a01a93a1f1dd88d733d30a78f502b72f2ac4ce5b Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Fri, 13 Jul 2012 17:24:02 +0200 Subject: s3:smbstatus add --fast option this option skips all checks if the process for the record is still there using it gives a huge performance benefit on busy systems and clusters while it might display stale data if a smbd crashed --- source3/utils/status.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/source3/utils/status.c b/source3/utils/status.c index b87f64c1593..0cb46a5f536 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -56,6 +56,7 @@ static bool locks_only; /* Added by RJS */ static bool processes_only; static bool show_brl; static bool numeric_only; +static bool do_checks = true; const char *username = NULL; @@ -120,7 +121,7 @@ static void print_share_mode(const struct share_mode_entry *e, { static int count; - if (!is_valid_share_mode_entry(e)) { + if (do_checks && !is_valid_share_mode_entry(e)) { return; } @@ -250,7 +251,8 @@ static int traverse_connections(const struct connections_key *key, if (crec->cnum == TID_FIELD_INVALID) return 0; - if (!process_exists(crec->pid) || !Ucrit_checkUid(crec->uid)) { + if (do_checks && + (!process_exists(crec->pid) || !Ucrit_checkUid(crec->uid))) { return 0; } @@ -267,8 +269,9 @@ static int traverse_sessionid(const char *key, struct sessionid *session, { fstring uid_str, gid_str; - if (!process_exists(session->pid) - || !Ucrit_checkUid(session->uid)) { + if (do_checks && + (!process_exists(session->pid) || + !Ucrit_checkUid(session->uid))) { return 0; } @@ -331,6 +334,7 @@ static void print_notify_recs(const char *path, {"profile-rates", 'R', POPT_ARG_NONE, NULL, 'R', "Show call rates" }, {"byterange", 'B', POPT_ARG_NONE, NULL, 'B', "Include byte range locks"}, {"numeric", 'n', POPT_ARG_NONE, NULL, 'n', "Numeric uid/gid"}, + {"fast", 'f', POPT_ARG_NONE, NULL, 'f', "Skip checks if processes still exist"}, POPT_COMMON_SAMBA POPT_TABLEEND }; @@ -385,6 +389,9 @@ static void print_notify_recs(const char *path, case 'n': numeric_only = true; break; + case 'f': + do_checks = false; + break; } } -- cgit