Ignore:
Timestamp:
May 24, 2009, 7:51:24 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update Samba 3.3 branch to 3.3.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.3.x/source/utils/net_conf.c

    r221 r223  
    339339                                         &service);
    340340                if (!W_ERROR_IS_OK(werr)) {
    341                         goto done;
     341                        goto cancel;
    342342                }
    343343                werr = import_process_service(c, conf_ctx, service);
    344344                if (!W_ERROR_IS_OK(werr)) {
    345                         goto done;
     345                        goto cancel;
    346346                }
    347347        } else {
     
    353353                                          &services);
    354354                if (!W_ERROR_IS_OK(werr)) {
    355                         goto done;
     355                        goto cancel;
    356356                }
    357357                if (!c->opt_testmode) {
    358358                        werr = smbconf_drop(conf_ctx);
    359359                        if (!W_ERROR_IS_OK(werr)) {
    360                                 goto done;
    361                         }
    362                 }
     360                                goto cancel;
     361                        }
     362                }
     363
     364                /*
     365                 * Wrap the importing of shares into a transaction,
     366                 * but only 100 at a time, in order to serve memory.
     367                 * The allocated memory accumulates across the actions
     368                 * within the transaction, and for me, some 1500
     369                 * imported shares, the MAX_TALLOC_SIZE of 256 MB
     370                 * was exceeded.
     371                 */
     372                werr = smbconf_transaction_start(conf_ctx);
     373                if (!W_ERROR_IS_OK(werr)) {
     374                        d_printf("error starting transaction: %s\n",
     375                                 win_errstr(werr));
     376                        goto done;
     377                }
     378
    363379                for (sidx = 0; sidx < num_shares; sidx++) {
    364380                        werr = import_process_service(c, conf_ctx,
    365381                                                      services[sidx]);
    366382                        if (!W_ERROR_IS_OK(werr)) {
     383                                goto cancel;
     384                        }
     385
     386                        if (sidx % 100) {
     387                                continue;
     388                        }
     389
     390                        werr = smbconf_transaction_commit(conf_ctx);
     391                        if (!W_ERROR_IS_OK(werr)) {
     392                                d_printf("error committing transaction: %s\n",
     393                                         win_errstr(werr));
    367394                                goto done;
    368395                        }
    369                 }
    370         }
    371 
    372         ret = 0;
     396                        werr = smbconf_transaction_start(conf_ctx);
     397                        if (!W_ERROR_IS_OK(werr)) {
     398                                d_printf("error starting transaction: %s\n",
     399                                         win_errstr(werr));
     400                                goto done;
     401                        }
     402                }
     403        }
     404
     405        werr = smbconf_transaction_commit(conf_ctx);
     406        if (!W_ERROR_IS_OK(werr)) {
     407                d_printf("error committing transaction: %s\n",
     408                         win_errstr(werr));
     409        } else {
     410                ret = 0;
     411        }
     412
     413        goto done;
     414
     415cancel:
     416        werr = smbconf_transaction_cancel(conf_ctx);
     417        if (!W_ERROR_IS_OK(werr)) {
     418                d_printf("error cancelling transaction: %s\n",
     419                         win_errstr(werr));
     420        }
    373421
    374422done:
Note: See TracChangeset for help on using the changeset viewer.