Print this page
NEX-5801 Snapshots left over after failed backups
Reviewed by: Rick Mesta <rick.mesta@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Revert "NEX-5801 Snapshots left over after failed backups"
This reverts commit f182fb95f09036db71fbfc6f0a6b90469b761f21.
NEX-5801 Snapshots left over after failed backups
Reviewed by: Rick Mesta <rick.mesta@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
NEX-2911 NDMP logging should use syslog and is too chatty

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/ndmpd/tlm/tlm_util.c
          +++ new/usr/src/cmd/ndmpd/tlm/tlm_util.c
↓ open down ↓ 29 lines elided ↑ open up ↑
  30   30   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  31   31   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  32   32   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  33   33   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  34   34   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  35   35   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  36   36   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  37   37   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  38   38   * POSSIBILITY OF SUCH DAMAGE.
  39   39   */
       40 +/* Copyright 2016 Nexenta Systems, Inc. All rights reserved. */
       41 +
       42 +#include <syslog.h>
  40   43  #include <stdio.h>
  41   44  #include <stdlib.h>
  42   45  #include <string.h>
  43   46  #include <strings.h>
  44   47  #include <cstack.h>
  45   48  #include <ctype.h>
  46   49  #include <tlm.h>
  47   50  #include "tlm_proto.h"
  48   51  
  49   52  /*
↓ open down ↓ 29 lines elided ↑ open up ↑
  79   82   * Deallocate the stack. This goes through the list freeing all of the
  80   83   * cstack nodes but not the data because we don't know how the data was
  81   84   * allocated. A stack really should be empty before it is deleted.
  82   85   */
  83   86  void
  84   87  cstack_delete(cstack_t *stk)
  85   88  {
  86   89          cstack_t *tmp;
  87   90  
  88   91          if (stk == NULL) {
  89      -                NDMP_LOG(LOG_DEBUG, "cstack_delete: invalid stack");
  90   92                  return;
  91   93          }
  92   94  
  93   95          while ((tmp = stk->next) != NULL) {
  94   96                  stk->next = tmp->next;
  95      -                NDMP_LOG(LOG_DEBUG, "cstack_delete(element): 0x%p", tmp);
  96   97                  free(tmp);
  97   98          }
  98   99  
  99      -        NDMP_LOG(LOG_DEBUG, "cstack_delete: 0x%p", stk);
 100  100          free(stk);
 101  101  }
 102  102  
 103  103  
 104  104  /*
 105  105   * cstack_push
 106  106   *
 107  107   * Push an element onto the stack. Allocate a new node and assign the
 108  108   * data and len values. We don't care what about the real values of
 109  109   * data or len and we never try to access them. The stack head will
 110  110   * point to the new node.
 111  111   *
 112  112   * Returns 0 on success. Otherwise returns -1 to indicate overflow.
 113  113   */
 114  114  int
 115  115  cstack_push(cstack_t *stk, void *data, int len)
 116  116  {
 117  117          cstack_t *stk_node;
 118  118  
 119  119          if (stk == NULL) {
 120      -                NDMP_LOG(LOG_DEBUG, "cstack_push: invalid stack");
 121  120                  return (-1);
 122  121          }
 123  122  
 124  123          if ((stk_node = ndmp_malloc(sizeof (cstack_t))) == NULL)
 125  124                  return (-1);
 126  125  
 127  126          stk_node->data = data;
 128  127          stk_node->len = len;
 129  128          stk_node->next = stk->next;
 130  129          stk->next = stk_node;
 131  130  
 132      -        NDMP_LOG(LOG_DEBUG, "cstack_push(0x%p): 0x%p", stk, stk_node);
 133  131          return (0);
 134  132  }
 135  133  
 136  134  
 137  135  /*
 138  136   * cstack_pop
 139  137   *
 140  138   * Pop an element off the stack. Set up the data and len references for
 141  139   * the caller, advance the stack head and free the popped stack node.
 142  140   *
 143  141   * Returns 0 on success. Otherwise returns -1 to indicate underflow.
 144  142   */
 145  143  int
 146  144  cstack_pop(cstack_t *stk, void **data, int *len)
 147  145  {
 148  146          cstack_t *stk_node;
 149  147  
 150  148          if (stk == NULL) {
 151      -                NDMP_LOG(LOG_DEBUG, "cstack_pop: invalid stack");
 152  149                  return (-1);
 153  150          }
 154  151  
 155  152          if ((stk_node = stk->next) == NULL) {
 156      -                NDMP_LOG(LOG_DEBUG, "cstack_pop: underflow");
 157  153                  return (-1);
 158  154          }
 159  155  
 160  156          if (data)
 161  157                  *data = stk_node->data;
 162  158  
 163  159          if (len)
 164  160                  *len = stk_node->len;
 165  161  
 166  162          stk->next = stk_node->next;
 167      -        NDMP_LOG(LOG_DEBUG, "cstack_pop(0x%p): 0x%p", stk, stk_node);
 168  163  
 169  164          free(stk_node);
 170  165          return (0);
 171  166  }
 172  167  
 173  168  /*
 174  169   * cstack_top
 175  170   *
 176  171   * Returns the top data element on the stack without removing it.
 177  172   *
 178  173   * Returns 0 on success. Otherwise returns -1 to indicate underflow.
 179  174   */
 180  175  int
 181  176  cstack_top(cstack_t *stk, void **data, int *len)
 182  177  {
 183  178          if (stk == NULL) {
 184      -                NDMP_LOG(LOG_DEBUG, "cstack_pop: invalid stack");
 185  179                  return (-1);
 186  180          }
 187  181  
 188  182          if (stk->next == NULL) {
 189      -                NDMP_LOG(LOG_DEBUG, "cstack_pop: underflow");
 190  183                  return (-1);
 191  184          }
 192  185  
 193  186          if (data)
 194  187                  *data = stk->next->data;
 195  188  
 196  189          if (len)
 197  190                  *len = stk->next->len;
 198  191  
 199  192          return (0);
↓ open down ↓ 337 lines elided ↑ open up ↑
 537  530  tlm_new_dir_info(struct  fs_fhandle *fhp, char *dir, char *nm)
 538  531  {
 539  532          struct full_dir_info *fdip;
 540  533  
 541  534          if (!(fdip = ndmp_malloc(sizeof (struct full_dir_info))))
 542  535                  return (NULL);
 543  536  
 544  537          (void) memcpy(&fdip->fd_dir_fh, fhp, sizeof (fs_fhandle_t));
 545  538          if (!tlm_cat_path(fdip->fd_dir_name, dir, nm)) {
 546  539                  free(fdip);
 547      -                NDMP_LOG(LOG_DEBUG, "TAPE BACKUP Find> path too long [%s][%s]",
      540 +                syslog(LOG_DEBUG, "TAPE BACKUP Find> path too long [%s][%s]",
 548  541                      dir, nm);
 549  542                  return (NULL);
 550  543          }
 551  544          return (fdip);
 552  545  }
 553  546  
 554  547  /*
 555  548   * sysattr_rdonly
 556  549   *
 557  550   * Check if the attribute file is one of the readonly system
↓ open down ↓ 19 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX