Hi,
attached patch fix problem with segfault when EMLINK happend when file has too many hard link.
On Fri, 30 May 2014 17:02:47 +0200 Pavel Stano <stano@websupport.sk> wrote:
Hi,
we use attachment dedup with lots of emails (still migrating to it from maildir). We use netapp storage with wafl filesystem over nfs. Problem is that netapp has hard limit of 100k hardlinks to one file. And we encountered it.
Problem is that dovecot start do segfault (lmtp,dsync,pop3 etc) when it happend when tried to deliver new emails with that attachment. Here is strace of dsync:
6740 link("/nfsmnt/mailatch1/f9/10/hashes/f9108ddaa156ac15738e41ed3bedec1eda50175d", "/nfsmnt/mailatch1/f9/10/f9108ddaa156ac15738e41ed3bedec1eda50175d-7bb7a20ddb598853541a000028db4a9f") = -1 EMLINK (Too many links) 6740 --- SIGSEGV (Segmentation fault) @ 0 (0) ---
ls -lh: -rw------- 100000 vmail vmail 4.7K Apr 28 16:54 /nfsmnt/mailatch1/f9/10/hashes/f9108ddaa156ac15738e41ed3bedec1eda50175d
We were using mail_attachment_min_size=4kb, we solve it by increasing it to 8kb.
It would be nice to somehow fix this problem. Like not crash when EMLINK happend and maybe do not deduplicate attachments but deliver email without dedup. Or create second file in hashes/ and start hardlinking it instead of original.
AFAIK ext4 has also hard-link limit 64k (http://en.wikipedia.org/wiki/Hard_link#Limitations_of_hard_links) So this can happen to anyone with lots of emails.
Thanks
-- [ Ohodnotte kvalitu mailu: http://nicereply.com/websupport/Stano/ ]
Pavel Stano | Troubleshooter
http://WebSupport.sk *** BERTE A VYCHUTNAVAJTE ***