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
   1 /*
   2  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2015 by Delphix. All rights reserved.

   4  */
   5 
   6 /*
   7  * BSD 3 Clause License
   8  *
   9  * Copyright (c) 2007, The Storage Networking Industry Association.
  10  *
  11  * Redistribution and use in source and binary forms, with or without
  12  * modification, are permitted provided that the following conditions
  13  * are met:
  14  *      - Redistributions of source code must retain the above copyright
  15  *        notice, this list of conditions and the following disclaimer.
  16  *
  17  *      - Redistributions in binary form must reproduce the above copyright
  18  *        notice, this list of conditions and the following disclaimer in
  19  *        the documentation and/or other materials provided with the
  20  *        distribution.
  21  *
  22  *      - Neither the name of The Storage Networking Industry Association (SNIA)
  23  *        nor the names of its contributors may be used to endorse or promote


  39 #ifndef _TLM_H_
  40 #define _TLM_H_
  41 
  42 #include <sys/types.h>
  43 #include <synch.h>
  44 #include <limits.h>
  45 #include <cstack.h>
  46 #include <sys/acl.h>
  47 #include <stdio.h>
  48 #include <errno.h>
  49 #include <fcntl.h>
  50 #include <strings.h>
  51 #include <sys/stat.h>
  52 #include <time.h>
  53 #include <sys/queue.h>
  54 #include <sys/fs/zfs.h>
  55 #include <libzfs.h>
  56 
  57 #define IS_SET(f, m)    (((f) & (m)) != 0)
  58 
  59 #define TLM_MAX_BACKUP_JOB_NAME 32      /* max size of a job's name */
  60 #define TLM_TAPE_BUFFERS        10      /* number of rotating tape buffers */
  61 #define TLM_LINE_SIZE           128     /* size of text messages */
  62 
  63 
  64 #define TLM_BACKUP_RUN          0x00000001
  65 #define TLM_RESTORE_RUN         0x00000002
  66 #define TLM_STOP                0x00000009      /* graceful stop */
  67 #define TLM_ABORT               0x99999999      /* abandon the run */
  68 
  69 #define TLM_EXTRA_SPACE         64
  70 #define TLM_MAX_PATH_NAME       (PATH_MAX + TLM_EXTRA_SPACE)
  71 
  72 #define ENTRYTYPELEN    14
  73 #define PERMS           4
  74 #define ID_STR_MAX      20
  75 #define APPENDED_ID_MAX (ID_STR_MAX + 1)
  76 #define ACL_ENTRY_SIZE  (ENTRYTYPELEN + ID_STR_MAX + PERMS + APPENDED_ID_MAX)
  77 #define TLM_MAX_ACL_TXT MAX_ACL_ENTRIES * ACL_ENTRY_SIZE
  78 
  79 


 419  * such a vector interface in order to be invoked by NDMP
 420  * server.
 421  * The reserved callbacks are kept for different backup
 422  * types which are volume-based rather than file-based
 423  * e.g. zfs send.
 424  */
 425 typedef struct tm_ops {
 426         char *tm_name;
 427         int (*tm_putfile)();
 428         int (*tm_putdir)();
 429         int (*tm_putvol)();     /* Reserved */
 430         int (*tm_getfile)();
 431         int (*tm_getdir)();
 432         int (*tm_getvol)();     /* Reserved */
 433 } tm_ops_t;
 434 
 435 /* The checksum field is filled with this while the checksum is computed. */
 436 #define CHKBLANKS       "        "      /* 8 blanks, no null */
 437 
 438 #define LONGNAME_PREFIX "././_LoNg_NaMe_"
 439 extern void ndmp_log(ulong_t, char *, char *, ...);
 440 char ndmp_log_info[256];
 441 #define NDMP_LOG(p, ...) { \
 442                                 (void) snprintf(ndmp_log_info, \
 443                                     sizeof (ndmp_log_info), \
 444                                     "[%d][%s:%d]", \
 445                                     (int)pthread_self(), __func__, __LINE__); \
 446                                 ndmp_log(p, ndmp_log_info, __VA_ARGS__); \
 447                         }
 448 extern void *ndmp_malloc(size_t size);
 449 
 450 /*
 451  * ZFS metadata plug-in module structures
 452  */
 453 #define ZFS_MAX_PROPS           100
 454 #define ZFS_META_MAGIC          "ZFSMETA"
 455 #define ZFS_META_MAGIC_EXT      "ZFSMETA2"
 456 
 457 /* Add new major/minor for header changes */
 458 typedef enum {
 459         META_HDR_MAJOR_0,       /* Original format */
 460         META_HDR_MAJOR_1,       /* Extended format */
 461 } ndmp_metadata_header_major_t;
 462 
 463 #define META_HDR_MAJOR_VERSION  META_HDR_MAJOR_1
 464 
 465 typedef enum {
 466         META_HDR_MINOR_0,
 467 } ndmp_metadata_header_minor_t;


   1 /*
   2  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2015 by Delphix. All rights reserved.
   4  * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
   5  */
   6 
   7 /*
   8  * BSD 3 Clause License
   9  *
  10  * Copyright (c) 2007, The Storage Networking Industry Association.
  11  *
  12  * Redistribution and use in source and binary forms, with or without
  13  * modification, are permitted provided that the following conditions
  14  * are met:
  15  *      - Redistributions of source code must retain the above copyright
  16  *        notice, this list of conditions and the following disclaimer.
  17  *
  18  *      - Redistributions in binary form must reproduce the above copyright
  19  *        notice, this list of conditions and the following disclaimer in
  20  *        the documentation and/or other materials provided with the
  21  *        distribution.
  22  *
  23  *      - Neither the name of The Storage Networking Industry Association (SNIA)
  24  *        nor the names of its contributors may be used to endorse or promote


  40 #ifndef _TLM_H_
  41 #define _TLM_H_
  42 
  43 #include <sys/types.h>
  44 #include <synch.h>
  45 #include <limits.h>
  46 #include <cstack.h>
  47 #include <sys/acl.h>
  48 #include <stdio.h>
  49 #include <errno.h>
  50 #include <fcntl.h>
  51 #include <strings.h>
  52 #include <sys/stat.h>
  53 #include <time.h>
  54 #include <sys/queue.h>
  55 #include <sys/fs/zfs.h>
  56 #include <libzfs.h>
  57 
  58 #define IS_SET(f, m)    (((f) & (m)) != 0)
  59 
  60 #define TLM_MAX_BACKUP_JOB_NAME 16      /* format is 'NdmpBackup.nnnn\0' */
  61 #define TLM_TAPE_BUFFERS        10      /* number of rotating tape buffers */
  62 #define TLM_LINE_SIZE           128     /* size of text messages */
  63 
  64 
  65 #define TLM_BACKUP_RUN          0x00000001
  66 #define TLM_RESTORE_RUN         0x00000002
  67 #define TLM_STOP                0x00000009      /* graceful stop */
  68 #define TLM_ABORT               0x99999999      /* abandon the run */
  69 
  70 #define TLM_EXTRA_SPACE         64
  71 #define TLM_MAX_PATH_NAME       (PATH_MAX + TLM_EXTRA_SPACE)
  72 
  73 #define ENTRYTYPELEN    14
  74 #define PERMS           4
  75 #define ID_STR_MAX      20
  76 #define APPENDED_ID_MAX (ID_STR_MAX + 1)
  77 #define ACL_ENTRY_SIZE  (ENTRYTYPELEN + ID_STR_MAX + PERMS + APPENDED_ID_MAX)
  78 #define TLM_MAX_ACL_TXT MAX_ACL_ENTRIES * ACL_ENTRY_SIZE
  79 
  80 


 420  * such a vector interface in order to be invoked by NDMP
 421  * server.
 422  * The reserved callbacks are kept for different backup
 423  * types which are volume-based rather than file-based
 424  * e.g. zfs send.
 425  */
 426 typedef struct tm_ops {
 427         char *tm_name;
 428         int (*tm_putfile)();
 429         int (*tm_putdir)();
 430         int (*tm_putvol)();     /* Reserved */
 431         int (*tm_getfile)();
 432         int (*tm_getdir)();
 433         int (*tm_getvol)();     /* Reserved */
 434 } tm_ops_t;
 435 
 436 /* The checksum field is filled with this while the checksum is computed. */
 437 #define CHKBLANKS       "        "      /* 8 blanks, no null */
 438 
 439 #define LONGNAME_PREFIX "././_LoNg_NaMe_"









 440 extern void *ndmp_malloc(size_t size);
 441 
 442 /*
 443  * ZFS metadata plug-in module structures
 444  */
 445 #define ZFS_MAX_PROPS           100
 446 #define ZFS_META_MAGIC          "ZFSMETA"
 447 #define ZFS_META_MAGIC_EXT      "ZFSMETA2"
 448 
 449 /* Add new major/minor for header changes */
 450 typedef enum {
 451         META_HDR_MAJOR_0,       /* Original format */
 452         META_HDR_MAJOR_1,       /* Extended format */
 453 } ndmp_metadata_header_major_t;
 454 
 455 #define META_HDR_MAJOR_VERSION  META_HDR_MAJOR_1
 456 
 457 typedef enum {
 458         META_HDR_MINOR_0,
 459 } ndmp_metadata_header_minor_t;