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 <[email protected]> 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 ***
diff -ru dovecot-2.2.13/src/lib-fs/fs-sis.c dovecot-2.2.13.fixed/src/lib-fs/fs-sis.c
--- dovecot-2.2.13/src/lib-fs/fs-sis.c 2014-02-04 22:28:38.000000000 +0100
+++ dovecot-2.2.13.fixed/src/lib-fs/fs-sis.c 2014-06-05 16:05:30.768976354 +0200
@@ -395,7 +395,9 @@
return 1;
}
}
- o_stream_unref(&_file->output);
+ if (_file->output != NULL) {
+ o_stream_unref(&_file->output);
+ }
if (fs_write_stream_finish(file->super, &file->fs_output) < 0) {
fs_sis_file_copy_error(file);
signature.asc
Description: PGP signature
