summaryrefslogtreecommitdiff
path: root/usr/src/lib/nsswitch/files/common/files_common.c
diff options
context:
space:
mode:
authorMarcel Telka <marcel.telka@nexenta.com>2014-09-17 15:27:13 +0200
committerRobert Mustacchi <rm@joyent.com>2014-09-18 16:01:17 -0700
commit655967ab7780f789dd00eece4464be60cd9aff5e (patch)
treeb0c615a16dc6c1dd82d62f98ef9e29e79aebd26a /usr/src/lib/nsswitch/files/common/files_common.c
parentdd3928f816b8d87f7ecc81d6ec1eec1257ed0cda (diff)
downloadillumos-gate-655967ab7780f789dd00eece4464be60cd9aff5e.tar.gz
5181 nscd is extremely slow when a local file is missing
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com> Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com> Reviewed by: Josef Sipek <josef.sipek@nexenta.com> Reviewed by: Garrett D'Amore <garrett@damore.org> Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src/lib/nsswitch/files/common/files_common.c')
-rw-r--r--usr/src/lib/nsswitch/files/common/files_common.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/usr/src/lib/nsswitch/files/common/files_common.c b/usr/src/lib/nsswitch/files/common/files_common.c
index 4b7b6753c1..4755aec86b 100644
--- a/usr/src/lib/nsswitch/files/common/files_common.c
+++ b/usr/src/lib/nsswitch/files/common/files_common.c
@@ -21,7 +21,12 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
- *
+ */
+/*
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
+ */
+
+/*
* Common code and structures used by name-service-switch "files" backends.
*/
@@ -406,11 +411,13 @@ retry:
retries = 100;
while (stat64(be->filename, &st) < 0) {
/*
- * On a healthy system this can't happen except during brief
- * periods when the file is being modified/renamed. Keep
- * trying until things settle down, but eventually give up.
+ * This can happen only in two cases: Either the file is
+ * completely missing and we were not able to read it yet
+ * (fh_table is NULL), or there is some brief period when the
+ * file is being modified/renamed. Keep trying until things
+ * settle down, but eventually give up.
*/
- if (--retries == 0)
+ if (fhp->fh_table == NULL || --retries == 0)
goto unavail;
poll(0, 0, 100);
}