changeset 13926:0cd33404a201

quota: Try to avoid logging NFS stale fhandle errors when closing maildirsize file.
author Timo Sirainen <tss@iki.fi>
date Tue, 10 Jan 2012 23:14:18 +0200
parents 81fa0597b8b6
children bc3b343b1999
files src/plugins/quota/quota-maildir.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/quota/quota-maildir.c	Tue Jan 10 23:10:04 2012 +0200
+++ b/src/plugins/quota/quota-maildir.c	Tue Jan 10 23:14:18 2012 +0200
@@ -296,13 +296,10 @@
 		return -1;
 	}
 
-	/* keep the fd open since we might want to update it later */
-	if (file_dotlock_replace(&dotlock,
-				 DOTLOCK_REPLACE_FLAG_DONT_CLOSE_FD) < 0) {
+	if (file_dotlock_replace(&dotlock, 0) < 0) {
 		i_error("file_dotlock_replace(%s) failed: %m", path);
 		return -1;
 	}
-	root->fd = fd;
 	return 0;
 }
 
@@ -872,8 +869,11 @@
 		(void)close(root->fd);
 		root->fd = -1;
 		(void)maildirsize_recalculate(root);
-	} else if (maildirsize_update(root, ctx->count_used, ctx->bytes_used) < 0)
+	} else if (maildirsize_update(root, ctx->count_used, ctx->bytes_used) < 0) {
+		(void)close(root->fd);
+		root->fd = -1;
 		maildirsize_rebuild_later(root);
+	}
 
 	return 0;
 }