From 655967ab7780f789dd00eece4464be60cd9aff5e Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Wed, 17 Sep 2014 15:27:13 +0200 Subject: 5181 nscd is extremely slow when a local file is missing Reviewed by: Alek Pinchuk Reviewed by: Igor Kozhukhov Reviewed by: Josef Sipek Reviewed by: Garrett D'Amore Approved by: Robert Mustacchi --- usr/src/lib/nsswitch/files/common/files_common.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'usr/src/lib/nsswitch/files/common/files_common.c') 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); } -- cgit v1.2.3