summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/lib/libvscan/common/libvscan.c43
-rw-r--r--usr/src/uts/common/io/vscan/vscan_door.c17
2 files changed, 45 insertions, 15 deletions
diff --git a/usr/src/lib/libvscan/common/libvscan.c b/usr/src/lib/libvscan/common/libvscan.c
index cfd012c2b2..7813cb64da 100644
--- a/usr/src/lib/libvscan/common/libvscan.c
+++ b/usr/src/lib/libvscan/common/libvscan.c
@@ -23,8 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@@ -44,6 +42,8 @@
#include <libintl.h>
#include <libvscan.h>
+#define VS_DOOR_CALL_RETRIES 3
+
#define VS_INSTANCE_FMRI "svc:/system/filesystem/vscan:icap"
/* SMF property group and property names */
@@ -175,6 +175,7 @@ static int vs_validate(const vs_prop_hd_t *, uint64_t);
static int vs_is_valid_types(const char *);
static int vs_is_valid_host(const char *);
static int vs_checkauth(char *);
+static int vs_door_call(int, door_arg_t *);
static int vs_props_get_engines(char *[], int *);
static void vs_engid_to_pgname(const char *, char [VS_PGNAME_ENGINE_LEN]);
@@ -1371,12 +1372,12 @@ vs_statistics(vs_stats_t *stats)
arg.rbuf = (char *)rsp;
arg.rsize = sizeof (vs_stats_rsp_t);
- if ((door_call(door_fd, &arg) < 0) ||
- (rsp->vsr_magic != VS_STATS_DOOR_MAGIC)) {
- rc = VS_ERR_DAEMON_COMM;
- } else {
+ rc = vs_door_call(door_fd, &arg);
+
+ if ((rc == VS_ERR_NONE) && (rsp->vsr_magic == VS_STATS_DOOR_MAGIC))
*stats = rsp->vsr_stats;
- }
+ else
+ rc = VS_ERR_DAEMON_COMM;
(void) close(door_fd);
@@ -1418,16 +1419,36 @@ vs_statistics_reset()
arg.rbuf = NULL;
arg.rsize = 0;
- if (door_call(door_fd, &arg) < 0)
- rc = VS_ERR_DAEMON_COMM;
- else
- rc = VS_ERR_NONE;
+ rc = vs_door_call(door_fd, &arg);
(void) close(door_fd);
free(req);
return (rc);
}
+/*
+ * Door call with retries.
+ *
+ * Returns VS_ERR_NONE on success, otherwise VS_ERR_DAEMON_COMM.
+ */
+static int
+vs_door_call(int fd, door_arg_t *arg)
+{
+ int rc = -1;
+ int i;
+
+ for (i = 0; i < VS_DOOR_CALL_RETRIES; ++i) {
+ errno = 0;
+
+ if ((rc = door_call(fd, arg)) == 0)
+ break;
+
+ if (errno != EAGAIN && errno != EINTR)
+ break;
+ }
+
+ return ((rc == 0) ? VS_ERR_NONE : VS_ERR_DAEMON_COMM);
+}
/*
* vs_checkauth
diff --git a/usr/src/uts/common/io/vscan/vscan_door.c b/usr/src/uts/common/io/vscan/vscan_door.c
index ab02c93934..674a61f382 100644
--- a/usr/src/uts/common/io/vscan/vscan_door.c
+++ b/usr/src/uts/common/io/vscan/vscan_door.c
@@ -24,9 +24,8 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
+#include <sys/errno.h>
#include <sys/kmem.h>
#include <sys/vnode.h>
#include <sys/pathname.h>
@@ -35,6 +34,7 @@
#include <sys/sunddi.h> /* for string functions */
#include <sys/vscan.h>
+#define VS_DOOR_RETRIES 3
/* max time (secs) to wait for door calls to complete during door_close */
#define VS_DOOR_CLOSE_TIMEOUT_DEFAULT 30
@@ -131,6 +131,7 @@ int
vscan_door_scan_file(vs_scan_req_t *scan_req)
{
int err;
+ int i;
door_arg_t arg;
uint32_t result = 0;
@@ -148,8 +149,16 @@ vscan_door_scan_file(vs_scan_req_t *scan_req)
arg.rbuf = (char *)&result;
arg.rsize = sizeof (uint32_t);
- if ((err = door_ki_upcall_limited(vscan_door_handle, &arg, NULL,
- SIZE_MAX, 0)) != 0) {
+ for (i = 0; i < VS_DOOR_RETRIES; ++i) {
+ if ((err = door_ki_upcall_limited(vscan_door_handle, &arg,
+ NULL, SIZE_MAX, 0)) == 0)
+ break;
+
+ if (err != EAGAIN && err != EINTR)
+ break;
+ }
+
+ if (err != 0) {
cmn_err(CE_WARN, "Internal communication error (%d)"
"- failed to send scan request to vscand", err);
result = VS_STATUS_ERROR;