From owner-freebsd-bugs@FreeBSD.ORG Wed Apr 23 16:00:02 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAE701065672 for ; Wed, 23 Apr 2008 16:00:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id AF3F48FC27 for ; Wed, 23 Apr 2008 16:00:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m3NG027H084782 for ; Wed, 23 Apr 2008 16:00:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m3NG02BF084781; Wed, 23 Apr 2008 16:00:02 GMT (envelope-from gnats) Resent-Date: Wed, 23 Apr 2008 16:00:02 GMT Resent-Message-Id: <200804231600.m3NG02BF084781@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Oleg Koreshkov Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F48E10656BE for ; Wed, 23 Apr 2008 15:56:44 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 0B0D88FC23 for ; Wed, 23 Apr 2008 15:56:44 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m3NFuHRF089132 for ; Wed, 23 Apr 2008 15:56:17 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id m3NFuHl1089131; Wed, 23 Apr 2008 15:56:17 GMT (envelope-from nobody) Message-Id: <200804231556.m3NFuHl1089131@www.freebsd.org> Date: Wed, 23 Apr 2008 15:56:17 GMT From: Oleg Koreshkov To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/123019: mkdir(2) can return EMLINK, but EMLINK is not listed as possible error code in mkdir(2) manpage X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Apr 2008 16:00:03 -0000 >Number: 123019 >Category: misc >Synopsis: mkdir(2) can return EMLINK, but EMLINK is not listed as possible error code in mkdir(2) manpage >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: doc-bug >Submitter-Id: current-users >Arrival-Date: Wed Apr 23 16:00:02 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Oleg Koreshkov >Release: 6.3-RELEASE >Organization: a lot of >Environment: FreeBSD 6.3-RELEASE-p2 i386 >Description: Create directory that contains 32766(7?) subdirectories. try to create another one subdirectory and you would get: mkdir: Too many links However man 2 mkdir doesn't list EMLINK in ERRORS section. It looks like it happen due to overflow of st_nlink in inode, but nlink_t is defined as __uint16_t in /usr/include/sys/_types.h: typedef __uint16_t __nlink_t; /* link count */ So there should be possible to create 65534 subdirectories? >How-To-Repeat: Create directory that contains 32766(7?) subdirectories. try to create another one subdirectory and you would get: # ls -al | wc -l 32768 # mkdir 9999999999999 mkdir: 9999999999999: Too many links >Fix: For example you can update mkdir(2) manpage with following patch: --- mkdir.2 2008-04-23 19:42:06.000000000 +0400 +++ mkdir.2 2008-04-23 19:45:13.000000000 +0400 @@ -104,6 +104,8 @@ .Fa path argument points outside the process's allocated address space. +.It Bq Er EMLINK +The directory contains too many subdirectories. .El .Sh SEE ALSO .Xr chmod 2 , >Release-Note: >Audit-Trail: >Unformatted: