From patchwork Thu Aug 13 16:16:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zorro Lang X-Patchwork-Id: 7009271 Return-Path: X-Original-To: patchwork-fstests@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7B7379F344 for ; Thu, 13 Aug 2015 16:16:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A1FF32070E for ; Thu, 13 Aug 2015 16:16:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BAC7C20747 for ; Thu, 13 Aug 2015 16:16:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753289AbbHMQQj (ORCPT ); Thu, 13 Aug 2015 12:16:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48702 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753259AbbHMQQi (ORCPT ); Thu, 13 Aug 2015 12:16:38 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 3620DAA8 for ; Thu, 13 Aug 2015 16:16:38 +0000 (UTC) Received: from localhost (vpn1-7-21.pek2.redhat.com [10.72.7.21]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7DGGaL3010278; Thu, 13 Aug 2015 12:16:37 -0400 From: Zorro Lang To: fstests@vger.kernel.org Cc: eguan@redhat.com, Zorro Lang Subject: [PATCH] generic/084: check inotify limit before tail many files Date: Fri, 14 Aug 2015 00:16:32 +0800 Message-Id: <1439482592-29611-1-git-send-email-zlang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP generic/084 try to run 'tail' command, tail will use inotify, and there're some limit about inotify. I think the most important is fs.inotify.max_user_instances, then fs.inotify.max_user_watches is importand too. When I test on a machine with 154 cpu cores, this case run failed, and hit many warning likes: tail: inotify cannot be used, reverting to polling: Too many open files Because the fs.inotify.max_user_instances is 128, so if we try to tail 154 files, it will be failed. Of course, open files limit will effect this too. But generally max_user_instances is the minimum number, so I don't check open file limit. Signed-off-by: Zorro Lang --- tests/generic/084 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/generic/084 b/tests/generic/084 index 3fec6c2..f34d4b2 100755 --- a/tests/generic/084 +++ b/tests/generic/084 @@ -63,6 +63,15 @@ link_unlink_storm() rm -f $seqres.full nr_cpu=`$here/src/feature -o` +user_watches=`sysctl -n fs.inotify.max_user_watches` +user_instances=`sysctl -n fs.inotify.max_user_instances` + +user_limit=$((user_watches > user_instances ? user_instances : user_watches)) +if [ $nr_cpu -ge $((user_limit/2)) ] +then + nr_cpu=$((user_limit/2)) +fi + echo "Silence is golden" _scratch_mkfs >>$seqres.full 2>&1