bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#27739: Link counter of ls stops working at 65'000 hard links


From: Christoph Michelbach
Subject: bug#27739: Link counter of ls stops working at 65'000 hard links
Date: Mon, 17 Jul 2017 20:58:42 +0200

The link counter of ls stops working if a directory exceeds being linked to
64'999 times.

You can replicate this by first creating a folder on an ext4 file system

    $ mkdir deleteMe

and then filling it with 64'997 additional directories.

    $ mkdir deleteMe/{1..64997}

At this point, ls still reports the correct number of hard links:

    $ ls -l
    total 1376
    drwxrwxr-x 64999 christoph christoph 1404928 Jul 17 20:46 deleteMe

But after creating another folder

    $ mkdir deleteMe/64998

, ll reports only 1 hard link to `deleteMe`:

    $ ls -l
    total 1376
    drwxrwxr-x 1 christoph christoph 1404928 Jul 17 20:46 deleteMe

Even after the latest hard link is removed, ls still reports only 1 hard link:

    $ rm -R deleteMe/64998
    $ ls -l
    total 1376
    drwxrwxr-x 1 christoph christoph 1404928 Jul 17 20:49 deleteMe

I neither understand why this happens, nor why it happens at such a weird
number. It would be obvious that there is a 16 bit counter running out of values
if it stopped working at at or after 65'535, but it stopping to work at 65'000
hard links seems weird.

I tested this on a 64 bit system running Linux 4.4.0-83 and on a 32 bit system
running Linux 4.1.18 with the exact same result.

-- 
Christoph Michelbach <address@hidden>






reply via email to

[Prev in Thread] Current Thread [Next in Thread]