From patchwork Wed Nov 28 01:11:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 1813451 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 769B93FC54 for ; Wed, 28 Nov 2012 01:12:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752910Ab2K1BMq (ORCPT ); Tue, 27 Nov 2012 20:12:46 -0500 Received: from cantor2.suse.de ([195.135.220.15]:47475 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752452Ab2K1BMq (ORCPT ); Tue, 27 Nov 2012 20:12:46 -0500 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id AB130A30B9; Wed, 28 Nov 2012 02:12:45 +0100 (CET) From: Neil Brown To: Steve Dickson Date: Wed, 28 Nov 2012 12:11:23 +1100 Subject: [PATCH 3/3] gssd: base the size of the fd array on the RLIMIT_NOFILE limit. Cc: linux-nfs@vger.kernel.org Message-ID: <20121128011123.2475.13691.stgit@notabene.brown> In-Reply-To: <20121128010939.2475.13123.stgit@notabene.brown> References: <20121128010939.2475.13123.stgit@notabene.brown> User-Agent: StGit/0.16 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org We have previously raised the size of the 'pollarray' once (32 -> 256) and I have had another request to make it bigger. Rather than changing the hard-coded value, make it depend on RLIMIT_NOFILE. This is an upper limit on the size of the array that can be passed to poll() anyway. Signed-off-by: NeilBrown --- utils/gssd/gssd_proc.c | 5 +++++ 1 file changed, 5 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c index 425b582..e32b2f0 100644 --- a/utils/gssd/gssd_proc.c +++ b/utils/gssd/gssd_proc.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -483,9 +484,13 @@ fail_keep_client: void init_client_list(void) { + struct rlimit rlim; TAILQ_INIT(&clnt_list); /* Eventually plan to grow/shrink poll array: */ pollsize = FD_ALLOC_BLOCK; + if (getrlimit(RLIMIT_NOFILE, &rlim) < 0 && + rlim.rlim_cur != RLIM_INFINITY) + pollsize = rlim.rlim_cur; pollarray = calloc(pollsize, sizeof(struct pollfd)); }