User-deleted folders still on disk?

Derrick J Brashear shadow at dementia.org
Mon Apr 25 12:40:55 EDT 2005


On Mon, 25 Apr 2005, Jeff Blaine wrote:

> Using cyrus-2.2.12
>
> We're experiencing a situation where user-deleted folders still
> remain on disk.
>
> Running 'reconstruct -r user.USERNAME' does not address the
> problem.
>
> Is this expected behavior?  If so, I'm curious to hear the
> reasoning.

Well, a while ago there was a discussion about this related to NFS, and 
it's quite possibly the same problem, though it's much less an issue if 
you're not show your users du output.

http://64.233.187.104/search?q=cache:9aAtHxcLfIUJ:asg.web.cmu.edu/archive/message.php%3Fmailbox%3Darchive.info-cyrus%26msg%3D34476+cyrus+nfs+rmdir+site:asg.web.cmu.edu&hl=en

Of course solving it in 2.3 is a little harder but this will probably do 
it:
Index: mailbox.c
===================================================================
RCS file: /afs/andrew.cmu.edu/system/cvs/src/cyrus/imap/mailbox.c,v
retrieving revision 1.147.2.28
diff -u -r1.147.2.28 mailbox.c
--- mailbox.c	7 Apr 2005 00:27:09 -0000	1.147.2.28
+++ mailbox.c	25 Apr 2005 16:39:25 -0000
@@ -2606,7 +2606,7 @@
      int r, rquota = 0;
      DIR *dirp;
      struct dirent *f;
-    char buf[MAX_MAILBOX_PATH+1], *path;
+    char buf[MAX_MAILBOX_PATH+1], *path, *lpath, *mpath = NULL;
      char *tail;
      struct txn *tid = NULL;

@@ -2640,7 +2640,11 @@
      }

      /* remove data (message file) directory */
-    path = mailbox->path;
+    lpath = strdup(mailbox->path);
+    if (mailbox->mpath) 
+      mpath = strdup(mailbox->mpath);
+    mailbox_close(mailbox);
+    path = lpath;

      do {
  	/* remove all files in directory */
@@ -2686,10 +2690,11 @@
  	} while (rmdir(buf) == 0 && (tail = strrchr(buf, '/')));

  	/* remove metadata directory (if exists) */
-    } while (mailbox->mpath && (path != mailbox->mpath) &&
-	     (path = mailbox->mpath));
+    } while (mpath && (path != mpath) &&
+	     (path = mpath));
+    free(lpath);
+    if (mpath) free(mpath);

-    mailbox_close(mailbox);
      return 0;
  }

---
Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html




More information about the Info-cyrus mailing list