[Dovecot] Patch for second fs quota under solaris

Juergen Obermann Juergen.Obermann at hrz.uni-giessen.de
Thu Jul 8 13:08:42 EEST 2010


Hallo.

We use dovecot 1.2.12 running under Solaris 9 and wanted to set up a
second filesystem quota root because the mail folders are in the users
home directories and the inboxes of all users are in /var/mail. This is
defined in dovecot.conf:

  quota = fs:Home-Verzeichnis:noenforcing
  quota2 = fs:INBOX:noenforcing:mount=/var/mail

This second quota did not work, but now I found the reason why.
The mountpoint_get in src/lib/mountpoint.c needs to call resetmnttab to
find the filesystem for the second quota root (see man resetmnttab).
The following patches correct this and also adds some debugging code to
src/plugins/quota/quota-fs.c to show the processing of quota2.
These patches are only needed for Solaris with filesystem quotas.

dovecot-1.2.12
##############

*** ./src/lib/mountpoint.c.orig	Mon Jan 25 00:14:17 2010
--- ./src/lib/mountpoint.c	Thu Jul  8 11:21:11 2010
***************
*** 164,169 ****
--- 164,170 ----
  		i_error("fopen(%s) failed: %m", MTAB_PATH);
  		return -1;
  	}
+ 	resetmnttab(f);
  	while ((getextmntent(f, &ent.ext, sizeof(ent.ext))) == 0) {
  		if (hasmntopt(&ent.ent, MNTOPT_IGNORE) != NULL)
  			continue;


*** ./src/plugins/quota/quota-fs.c.orig	Sat Jun 19 00:12:44 2010
--- ./src/plugins/quota/quota-fs.c	Wed Jul  7 16:54:20 2010
***************
*** 249,256 ****
  			continue;
  
  		mount = fs_quota_mountpoint_get(root->storage_mount_path);
! 		if (mount != NULL)
  			fs_quota_mount_init(root, mount);
  	}
  }
  
--- 249,263 ----
  			continue;
  
  		mount = fs_quota_mountpoint_get(root->storage_mount_path);
! 		if (mount != NULL) {
! 			if (quota->set->debug) {
! 				i_info("fs quota2 add storage dir = %s", root->storage_mount_path);
! 				i_info("fs quota2 block device = %s", mount->device_path);
! 				i_info("fs quota2 mount point = %s", mount->mount_path);
! 				i_info("fs quota2 mount type = %s", mount->type);
! 			}
  			fs_quota_mount_init(root, mount);
+ 		}
  	}
  }
  

dovecot-2.0.rc1
###############

*** ./src/lib/mountpoint.c.orig	Mon Jan 25 00:16:12 2010
--- ./src/lib/mountpoint.c	Thu Jul  8 11:24:10 2010
***************
*** 164,169 ****
--- 164,170 ----
  		i_error("fopen(%s) failed: %m", MTAB_PATH);
  		return -1;
  	}
+ 	resetmnttab(f);
  	while ((getextmntent(f, &ent.ext, sizeof(ent.ext))) == 0) {
  		if (hasmntopt(&ent.ent, MNTOPT_IGNORE) != NULL)
  			continue;


*** ./src/plugins/quota/quota-fs.c.orig	Fri Jul  2 21:32:40 2010
--- ./src/plugins/quota/quota-fs.c	Wed Jul  7 12:52:38 2010
***************
*** 264,271 ****
  			continue;
  
  		mount = fs_quota_mountpoint_get(root->storage_mount_path);
! 		if (mount != NULL)
  			fs_quota_mount_init(root, mount);
  	}
  }
  
--- 264,278 ----
  			continue;
  
  		mount = fs_quota_mountpoint_get(root->storage_mount_path);
! 		if (mount != NULL) {
! 			if (quota->set->debug) {
! 				i_debug("fs quota2 add mailbox dir = %s", root->storage_mount_path);
! 				i_debug("fs quota2 block device = %s", mount->device_path);
! 				i_debug("fs quota2 mount point = %s", mount->mount_path);
! 				i_debug("fs quota2 mount type = %s", mount->type);
! 			}
  			fs_quota_mount_init(root, mount);
+ 		}
  	}
  }
  
Greetings,
Jürgen Obermann
-- 
Hochschulrechenzentrum der | Mail: Juergen.Obermann at hrz.uni-giessen.de
Justus-Liebig-Universitaet | WWW:  http://www.uni-giessen.de/obermann
Heinrich-Buff-Ring 44      | Tel:  0641-99-13054 (0641-99-13001)
D-35392 Giessen, Germany   | Fax:  0641-99-13009


More information about the dovecot mailing list