MacBook Pro (Late2011) fails to boot and repair HDD volume: I have a MacBookPro ("late 2011"/ MD313LL/A) (i5, 4GB, 500 GB Toshiba HDD) with MacOSX 10.9.x on it.
The MacBook won't boot. In verbose mode I see the following information:

During boot, after mounting the drive fsck_hfs is being started, and it states "Incorrect number of thread records (4,23121)". Then the machine enters a repair, checking, failing loop that doesn't end successfully. It aborts after 3 or 4 attempts and machine is shut down.

(I have also started recovery mode and ran the Disk Check Utility from there but same result, Volume could not be repaired.

I booted a Linux live system and checked the HDD with a tool that read S.M.A.R.T. data. According to this, there is no issue with the drive at all.

What does Incorrect number of thread records (4,23121) mean?

Any ideas what to do will be appreciated.
The error that you are seeing, Incorrect number of thread records, means that there is a problem/corruption in the HFS catalog.

The Catalog File is another B-tree that contains records for all the
files and directories stored in the volume. It stores four types of
records. Each file consists of a File Thread Record and a File Record
while each directory consists of a Directory Thread Record and a
Directory Record. Files and directories in the Catalog File are
located by their unique Catalog Node ID (or CNID).
A File Thread Record stores just the name of the file and the CNID of its parent directory.


The Fix...
First and foremost.... you do have a (Time Machine) backup, right?
Next, (personally) I wouldn't repair this HDD.  I would get an SSD drive (see this answer for reference), do a clean install of macOS and then migrate your data back over.
Can you repair it?  It's possible.  It's unlikely that Disk Utility will have the capability of fixing it so you will need something like DiskDrill or DiskWarrior.  Even still, you are fixing a 6+ year old drive which is now outside it's useful life.
If the drive is still good (physically) but you can't repair the volume, you could format and reinstall macOS, but if this is the route you have to take, I would go with an SSD upgrade; thus my initial recommendation.