diff options
author | Andrew Bartlett <abartlet@samba.org> | 2009-03-05 11:11:19 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-03-05 11:11:19 +1100 |
commit | ebe5b2835331ab259dd32bf6dc574ae999e2d36d (patch) | |
tree | b7ce49ef619de869dd03bfd48b65f0fa175b0f33 /source3/utils | |
parent | 5a10d804919af205b027ee519b9fa05519913ebe (diff) | |
parent | f85aa66ca22f29734bdacaa559737990fbe28d8a (diff) | |
download | samba-ebe5b2835331ab259dd32bf6dc574ae999e2d36d.tar.gz samba-ebe5b2835331ab259dd32bf6dc574ae999e2d36d.tar.bz2 samba-ebe5b2835331ab259dd32bf6dc574ae999e2d36d.zip |
Merge branch 'master' of ssh://git.samba.org/data/git/samba into master-devel
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net_conf.c | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 05b552c00d..38a2553e53 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -331,12 +331,6 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx, "would import the following configuration:\n\n"); } - werr = smbconf_transaction_start(conf_ctx); - if (!W_ERROR_IS_OK(werr)) { - d_printf("error starting transaction: %s\n", win_errstr(werr)); - goto done; - } - if (servicename != NULL) { struct smbconf_service *service = NULL; @@ -366,12 +360,45 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx, goto cancel; } } + + /* + * Wrap the importing of shares into a transaction, + * but only 100 at a time, in order to serve memory. + * The allocated memory accumulates across the actions + * within the transaction, and for me, some 1500 + * imported shares, the MAX_TALLOC_SIZE of 256 MB + * was exceeded. + */ + werr = smbconf_transaction_start(conf_ctx); + if (!W_ERROR_IS_OK(werr)) { + d_printf("error starting transaction: %s\n", + win_errstr(werr)); + goto done; + } + for (sidx = 0; sidx < num_shares; sidx++) { werr = import_process_service(c, conf_ctx, services[sidx]); if (!W_ERROR_IS_OK(werr)) { goto cancel; } + + if (sidx % 100) { + continue; + } + + werr = smbconf_transaction_commit(conf_ctx); + if (!W_ERROR_IS_OK(werr)) { + d_printf("error committing transaction: %s\n", + win_errstr(werr)); + goto done; + } + werr = smbconf_transaction_start(conf_ctx); + if (!W_ERROR_IS_OK(werr)) { + d_printf("error starting transaction: %s\n", + win_errstr(werr)); + goto done; + } } } |