diff options
author | Scott Mayhew <smayhew@redhat.com> | 2016-06-21 11:51:40 -0400 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2016-06-21 12:07:50 -0400 |
commit | 0aeb65f5f52903907451cdce7dbf0b4be21d46a3 (patch) | |
tree | b0e1676db4d15a87dc792c96dc8e8620b85c9dd2 /support/nsm/file.c | |
parent | 6a648d46c0fcf28d76e80c4d7eb6509373f3e024 (diff) | |
download | nfs-utils-0aeb65f5f52903907451cdce7dbf0b4be21d46a3.tar.gz nfs-utils-0aeb65f5f52903907451cdce7dbf0b4be21d46a3.tar.xz nfs-utils-0aeb65f5f52903907451cdce7dbf0b4be21d46a3.zip |
statd: suppress a benign log message in nsm_delete_host()
Commit 76f8ce8c (statd: Update existing record if we receive SM_MON with
new cookie) added some logic to unconditionally delete some existing
on-disk monitor records. That works fine in an HA-NFS setup where
there's a good chance of monitor files being left around after service
failovers, but in the case where there isn't an existing monitor file
statd emits a scary looking message like this:
Jun 15 14:14:59 hostname rpc.statd[1368]: Failed to delete: could not
stat original file /var/lib/nfs/statd/sm/nfs.smayhew.test: No such file
or directory
That message can be suppressed.
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'support/nsm/file.c')
-rw-r--r-- | support/nsm/file.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/support/nsm/file.c b/support/nsm/file.c index 7a8b504..aafa755 100644 --- a/support/nsm/file.c +++ b/support/nsm/file.c @@ -1013,7 +1013,7 @@ nsm_load_notify_list(nsm_populate_t func) static void nsm_delete_host(const char *directory, const char *hostname, - const char *mon_name, const char *my_name) + const char *mon_name, const char *my_name, const int chatty) { char line[LINELEN + 1 + SM_MAXSTRLEN + 2]; char *outbuf = NULL; @@ -1029,8 +1029,9 @@ nsm_delete_host(const char *directory, const char *hostname, } if (stat(path, &stb) == -1) { - xlog(L_ERROR, "Failed to delete: " - "could not stat original file %s: %m", path); + if (chatty) + xlog(L_ERROR, "Failed to delete: " + "could not stat original file %s: %m", path); goto out; } remaining = (size_t)stb.st_size + 1; @@ -1109,13 +1110,14 @@ out: * @hostname: '\0'-terminated C string containing hostname of record to delete * @mon_name: '\0'-terminated C string containing monname of record to delete * @my_name: '\0'-terminated C string containing myname of record to delete + * @chatty: should an error be logged if the monitor file doesn't exist? * */ void nsm_delete_monitored_host(const char *hostname, const char *mon_name, - const char *my_name) + const char *my_name, const int chatty) { - nsm_delete_host(NSM_MONITOR_DIR, hostname, mon_name, my_name); + nsm_delete_host(NSM_MONITOR_DIR, hostname, mon_name, my_name, chatty); } /** @@ -1129,5 +1131,5 @@ void nsm_delete_notified_host(const char *hostname, const char *mon_name, const char *my_name) { - nsm_delete_host(NSM_NOTIFY_DIR, hostname, mon_name, my_name); + nsm_delete_host(NSM_NOTIFY_DIR, hostname, mon_name, my_name, 1); } |