From e07306687d0862e8d43b5a0e32003748dedcfa3b Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 7 Jan 2014 09:21:20 -0800 Subject: [PATCH] Enable /etc/mtab cache to improve performance Re-enable the /etc/mtab cache to prevent the zfs command from having to repeatedly open and read from the /etc/mtab file. Instead an AVL tree of the mounted filesystems is created and used to vastly speed up lookups. This means that if non-zfs filesystems are mounted concurrently the 'zfs mount' will not immediately detect them. In practice that will rarely happen and even if it does the absolute worst case would be a failed mount. This was originally disabled out of an abundance of paranoia. NOTE: There may still be some parts of the code which do not consult the mtab cache. They should be updated to check the mtab cache as they as discovered to be a problem. Signed-off-by: Brian Behlendorf Signed-off-by: Turbo Fredriksson Signed-off-by: Chris Dunlop Issue #845 --- cmd/zfs/zfs_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index cea421238..836979bdf 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -6477,7 +6477,7 @@ main(int argc, char **argv) /* * Run the appropriate command. */ - libzfs_mnttab_cache(g_zfs, B_FALSE); + libzfs_mnttab_cache(g_zfs, B_TRUE); if (find_command_idx(cmdname, &i) == 0) { current_command = &command_table[i]; ret = command_table[i].func(argc - 1, argv + 1); -- 2.39.5