From patchwork Fri Aug 14 08:24:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zorro Lang X-Patchwork-Id: 7012631 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 9C9249F373 for ; Fri, 14 Aug 2015 08:25:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CF57C207C6 for ; Fri, 14 Aug 2015 08:25:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E0EF3207CC for ; Fri, 14 Aug 2015 08:25:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754009AbbHNIZa (ORCPT ); Fri, 14 Aug 2015 04:25:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59753 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753327AbbHNIY6 (ORCPT ); Fri, 14 Aug 2015 04:24:58 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 9D5CB40C50 for ; Fri, 14 Aug 2015 08:24:58 +0000 (UTC) Received: from localhost (dhcp-12-118.nay.redhat.com [10.66.12.118]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7E8Ou9A001407; Fri, 14 Aug 2015 04:24:57 -0400 From: Zorro Lang To: fstests@vger.kernel.org Cc: eguan@redhat.com, Zorro Lang Subject: [PATCH v2] generic/084: check inotify limit before tail many files Date: Fri, 14 Aug 2015 16:24:54 +0800 Message-Id: <1439540694-30259-1-git-send-email-zlang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Spam-Status: No, score=-7.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. 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, fs.inotify.max_user_instances and open files limit will effect this too. But generally max_user_instances is the minimum number, so I don't check the others. Signed-off-by: Zorro Lang Reviewed-by: Eryu Guan --- tests/generic/084 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/generic/084 b/tests/generic/084 index 3fec6c2..38ae932 100755 --- a/tests/generic/084 +++ b/tests/generic/084 @@ -63,6 +63,16 @@ link_unlink_storm() rm -f $seqres.full nr_cpu=`$here/src/feature -o` +# max_user_instances limit the number of inotify instances that +# can be created by per real user ID. +user_instances=`sysctl -n fs.inotify.max_user_instances` + +# Generally already some processes have occupied a few of inotify instances +# So maybe use user_instances/2 will be safe +if [ $nr_cpu -ge $((user_instances/2)) ];then + nr_cpu=$((user_instances/2)) +fi + echo "Silence is golden" _scratch_mkfs >>$seqres.full 2>&1