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
NEX-1123 NDMP commands can not uniquely identify Nexenta and the file server version (currently 4.0.1) and Sun Microsystems.
OS-49 Switch back to illumos' version of wcwidth()
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
NEX-426 ndmp_config_get_ext_list failed
NEX-250 Failed to open device /dev/rmt/0n because of too many files open
*** 35,51 ****
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Copyright (c) 2007, The Storage Networking Industry Association. */
/* Copyright (c) 1996, 1997 PDC, Network Appliance. All Rights Reserved */
! /* Copyright 2014 Nexenta Systems, Inc. All rights reserved. */
#include <dirent.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/mnttab.h>
#include <sys/mntent.h>
#include <sys/mntio.h>
#include <sys/statvfs.h>
--- 35,52 ----
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Copyright (c) 2007, The Storage Networking Industry Association. */
/* Copyright (c) 1996, 1997 PDC, Network Appliance. All Rights Reserved */
! /* Copyright 2016 Nexenta Systems, Inc. All rights reserved. */
#include <dirent.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+ #include <syslog.h>
#include <sys/stat.h>
#include <sys/mnttab.h>
#include <sys/mntent.h>
#include <sys/mntio.h>
#include <sys/statvfs.h>
*** 120,130 ****
(void) uname(&uts);
reply.os_type = uts.sysname;
reply.os_vers = uts.release;
if (sysinfo(SI_HW_SERIAL, hostidstr, sizeof (hostidstr)) < 0) {
! NDMP_LOG(LOG_DEBUG, "sysinfo error: %m.");
reply.error = NDMP_UNDEFINED_ERR;
}
/*
* Convert the hostid to hex. The returned string must match
--- 121,131 ----
(void) uname(&uts);
reply.os_type = uts.sysname;
reply.os_vers = uts.release;
if (sysinfo(SI_HW_SERIAL, hostidstr, sizeof (hostidstr)) < 0) {
! syslog(LOG_ERR, "sysinfo error: %m.");
reply.error = NDMP_UNDEFINED_ERR;
}
/*
* Convert the hostid to hex. The returned string must match
*** 169,180 ****
if (strcmp(request->name, "dump") == 0) {
(void) simple_get_attrs(&reply.attrs);
} else if (strcmp(request->name, "tar") == 0) {
reply.attrs = NDMP_NO_BACKUP_FILELIST;
} else {
! NDMP_LOG(LOG_ERR, "Invalid backup type: %s.", request->name);
! NDMP_LOG(LOG_ERR,
"Supported backup types are 'dump' and 'tar' only.");
reply.error = NDMP_ILLEGAL_ARGS_ERR;
}
ndmp_send_reply(connection, (void *) &reply,
--- 170,181 ----
if (strcmp(request->name, "dump") == 0) {
(void) simple_get_attrs(&reply.attrs);
} else if (strcmp(request->name, "tar") == 0) {
reply.attrs = NDMP_NO_BACKUP_FILELIST;
} else {
! syslog(LOG_ERR, "Invalid backup type: %s.", request->name);
! syslog(LOG_ERR,
"Supported backup types are 'dump' and 'tar' only.");
reply.error = NDMP_ILLEGAL_ARGS_ERR;
}
ndmp_send_reply(connection, (void *) &reply,
*** 250,262 ****
session->ns_challenge, MD5_CHALLENGE_SIZE);
break;
case NDMP_AUTH_NONE:
/* FALL THROUGH */
default:
! NDMP_LOG(LOG_ERR, "Invalid authentication type: %d.",
request->auth_type);
! NDMP_LOG(LOG_ERR,
"Supported authentication types are md5 and cleartext.");
reply.error = NDMP_ILLEGAL_ARGS_ERR;
break;
}
--- 251,263 ----
session->ns_challenge, MD5_CHALLENGE_SIZE);
break;
case NDMP_AUTH_NONE:
/* FALL THROUGH */
default:
! syslog(LOG_ERR, "Invalid authentication type: %d.",
request->auth_type);
! syslog(LOG_ERR,
"Supported authentication types are md5 and cleartext.");
reply.error = NDMP_ILLEGAL_ARGS_ERR;
break;
}
*** 305,315 ****
reply.os_type = uts.sysname;
reply.os_vers = uts.release;
if (sysinfo(SI_HW_SERIAL, hostidstr, sizeof (hostidstr)) < 0) {
! NDMP_LOG(LOG_DEBUG, "sysinfo error: %m.");
reply.error = NDMP_UNDEFINED_ERR;
}
/*
* Convert the hostid to hex. The returned string must match
--- 306,316 ----
reply.os_type = uts.sysname;
reply.os_vers = uts.release;
if (sysinfo(SI_HW_SERIAL, hostidstr, sizeof (hostidstr)) < 0) {
! syslog(LOG_ERR, "sysinfo error: %m.");
reply.error = NDMP_UNDEFINED_ERR;
}
/*
* Convert the hostid to hex. The returned string must match
*** 396,408 ****
session->ns_challenge, MD5_CHALLENGE_SIZE);
break;
case NDMP_AUTH_NONE:
/* FALL THROUGH */
default:
! NDMP_LOG(LOG_ERR, "Invalid authentication type: %d.",
request->auth_type);
! NDMP_LOG(LOG_ERR,
"Supported authentication types are md5 and cleartext.");
reply.error = NDMP_ILLEGAL_ARGS_ERR;
break;
}
--- 397,409 ----
session->ns_challenge, MD5_CHALLENGE_SIZE);
break;
case NDMP_AUTH_NONE:
/* FALL THROUGH */
default:
! syslog(LOG_ERR, "Invalid authentication type: %d.",
request->auth_type);
! syslog(LOG_ERR,
"Supported authentication types are md5 and cleartext.");
reply.error = NDMP_ILLEGAL_ARGS_ERR;
break;
}
*** 541,566 ****
(void) memset((void*)&reply, 0, sizeof (reply));
reply.error = NDMP_NO_ERR;
if ((fd = open(MNTTAB, O_RDONLY)) == -1) {
! NDMP_LOG(LOG_ERR, "File mnttab open error: %m.");
reply.error = NDMP_UNDEFINED_ERR;
goto send_reply;
}
/* nothing was found, send an empty reply */
if (ioctl(fd, MNTIOC_NMNTS, &nmnt) != 0 || nmnt <= 0) {
(void) close(fd);
! NDMP_LOG(LOG_ERR, "No file system found.");
goto send_reply;
}
fp = fdopen(fd, "r");
if (!fp) {
(void) close(fd);
! NDMP_LOG(LOG_ERR, "File mnttab open error: %m.");
reply.error = NDMP_UNDEFINED_ERR;
goto send_reply;
}
fsip_save = fsip = ndmp_malloc(sizeof (ndmp_fs_info_v3) * nmnt);
--- 542,567 ----
(void) memset((void*)&reply, 0, sizeof (reply));
reply.error = NDMP_NO_ERR;
if ((fd = open(MNTTAB, O_RDONLY)) == -1) {
! syslog(LOG_ERR, "File mnttab open error: %m.");
reply.error = NDMP_UNDEFINED_ERR;
goto send_reply;
}
/* nothing was found, send an empty reply */
if (ioctl(fd, MNTIOC_NMNTS, &nmnt) != 0 || nmnt <= 0) {
(void) close(fd);
! syslog(LOG_ERR, "No file system found.");
goto send_reply;
}
fp = fdopen(fd, "r");
if (!fp) {
(void) close(fd);
! syslog(LOG_ERR, "File mnttab open error: %m.");
reply.error = NDMP_UNDEFINED_ERR;
goto send_reply;
}
fsip_save = fsip = ndmp_malloc(sizeof (ndmp_fs_info_v3) * nmnt);
*** 595,605 ****
(void) snprintf(fsip->fs_logical_device, log_dev_len, "%s",
fs->mnt_mountp);
fsip->invalid = 0;
if (statvfs64(fs->mnt_mountp, &stat_buf) < 0) {
! NDMP_LOG(LOG_DEBUG,
"statvfs(%s) error.", fs->mnt_mountp);
fsip->fs_status =
"statvfs error: unable to determine filesystem"
" attributes";
} else {
--- 596,606 ----
(void) snprintf(fsip->fs_logical_device, log_dev_len, "%s",
fs->mnt_mountp);
fsip->invalid = 0;
if (statvfs64(fs->mnt_mountp, &stat_buf) < 0) {
! syslog(LOG_ERR,
"statvfs(%s) error.", fs->mnt_mountp);
fsip->fs_status =
"statvfs error: unable to determine filesystem"
" attributes";
} else {
*** 719,729 ****
* Don't report dead links.
*/
if ((access(sd->sd_name, F_OK) == -1) && (errno == ENOENT))
continue;
! NDMP_LOG(LOG_DEBUG,
"model \"%s\" dev \"%s\"", sd->sd_id, sd->sd_name);
envp_head = envp;
NDMP_SETENV(envp, "EXECUTE_CDB", "b");
NDMP_SETENV(envp, "SERIAL_NUMBER", sd->sd_serial);
--- 720,730 ----
* Don't report dead links.
*/
if ((access(sd->sd_name, F_OK) == -1) && (errno == ENOENT))
continue;
! syslog(LOG_DEBUG,
"model \"%s\" dev \"%s\"", sd->sd_id, sd->sd_name);
envp_head = envp;
NDMP_SETENV(envp, "EXECUTE_CDB", "b");
NDMP_SETENV(envp, "SERIAL_NUMBER", sd->sd_serial);
*** 739,750 ****
tip++;
dcp++;
n++;
}
- NDMP_LOG(LOG_DEBUG, "n %d", n);
-
/*
* We should not receive the get_tape_info when three-way backup is
* running and we are acting as just data, but some clients try
* to get the Tape information anyway.
*/
--- 740,749 ----
*** 821,831 ****
* Don't report dead links.
*/
if ((access(sd->sd_name, F_OK) == -1) && (errno == ENOENT))
continue;
! NDMP_LOG(LOG_DEBUG,
"model \"%s\" dev \"%s\"", sd->sd_id, sd->sd_name);
envp_head = envp;
NDMP_SETENV(envp, "SERIAL_NUMBER", sd->sd_serial);
NDMP_SETENV(envp, "WORLD_WIDE_NAME", sd->sd_wwn);
--- 820,830 ----
* Don't report dead links.
*/
if ((access(sd->sd_name, F_OK) == -1) && (errno == ENOENT))
continue;
! syslog(LOG_DEBUG,
"model \"%s\" dev \"%s\"", sd->sd_id, sd->sd_name);
envp_head = envp;
NDMP_SETENV(envp, "SERIAL_NUMBER", sd->sd_serial);
NDMP_SETENV(envp, "WORLD_WIDE_NAME", sd->sd_wwn);
*** 841,852 ****
sip++;
dcp++;
n++;
}
- NDMP_LOG(LOG_DEBUG, "n %d", n);
-
reply.scsi_info.scsi_info_len = n;
reply.scsi_info.scsi_info_val = sip_save;
ndmp_send_reply(connection, (void *)&reply,
"error sending ndmp_config_get_scsi_info reply");
--- 840,849 ----
*** 876,906 ****
{
ndmp_config_get_server_info_reply_v3 reply;
ndmp_auth_type auth_types[2];
char rev_number[10];
ndmpd_session_t *session = ndmp_get_client_data(connection);
(void) memset((void*)&reply, 0, sizeof (reply));
reply.error = NDMP_NO_ERR;
if (connection->conn_authorized ||
session->ns_protocol_version != NDMPV4) {
reply.vendor_name = VENDOR_NAME;
reply.product_name = PRODUCT_NAME;
(void) snprintf(rev_number, sizeof (rev_number), "%d",
ndmp_ver);
reply.revision_number = rev_number;
} else {
reply.vendor_name = "\0";
reply.product_name = "\0";
reply.revision_number = "\0";
}
- NDMP_LOG(LOG_DEBUG,
- "vendor \"%s\", product \"%s\" rev \"%s\"",
- reply.vendor_name, reply.product_name, reply.revision_number);
-
auth_types[0] = NDMP_AUTH_TEXT;
auth_types[1] = NDMP_AUTH_MD5;
reply.auth_type.auth_type_len = ARRAY_LEN(auth_types, ndmp_auth_type);
reply.auth_type.auth_type_val = auth_types;
--- 873,911 ----
{
ndmp_config_get_server_info_reply_v3 reply;
ndmp_auth_type auth_types[2];
char rev_number[10];
ndmpd_session_t *session = ndmp_get_client_data(connection);
+ char *vendor;
+ char *product;
(void) memset((void*)&reply, 0, sizeof (reply));
reply.error = NDMP_NO_ERR;
if (connection->conn_authorized ||
session->ns_protocol_version != NDMPV4) {
+ if ((vendor = ndmpd_get_prop(NDMP_VENDOR_NAME)) == NULL ||
+ *vendor == 0) {
reply.vendor_name = VENDOR_NAME;
+ } else {
+ reply.vendor_name = vendor;
+ }
+ if ((product = ndmpd_get_prop(NDMP_PRODUCT_NAME)) == NULL ||
+ *product == 0) {
reply.product_name = PRODUCT_NAME;
+ } else {
+ reply.product_name = product;
+ }
(void) snprintf(rev_number, sizeof (rev_number), "%d",
ndmp_ver);
reply.revision_number = rev_number;
} else {
reply.vendor_name = "\0";
reply.product_name = "\0";
reply.revision_number = "\0";
}
auth_types[0] = NDMP_AUTH_TEXT;
auth_types[1] = NDMP_AUTH_MD5;
reply.auth_type.auth_type_len = ARRAY_LEN(auth_types, ndmp_auth_type);
reply.auth_type.auth_type_val = auth_types;
*** 1053,1063 ****
if (session->ns_set_ext_list) {
/*
* Illegal request if extensions have already been selected.
*/
! NDMP_LOG(LOG_ERR, "Extensions have already been selected.");
reply.error = NDMP_EXT_DANDN_ILLEGAL_ERR;
} else {
/*
* Reply with an empty set of extensions.
*/
--- 1058,1068 ----
if (session->ns_set_ext_list) {
/*
* Illegal request if extensions have already been selected.
*/
! syslog(LOG_ERR, "Extensions have already been selected.");
reply.error = NDMP_EXT_DANDN_ILLEGAL_ERR;
} else {
/*
* Reply with an empty set of extensions.
*/
*** 1098,1114 ****
if (!session->ns_get_ext_list) {
/*
* The DMA is required to issue a NDMP_GET_EXT_LIST request
* prior sending a NDMP_SET_EXT_LIST request.
*/
! NDMP_LOG(LOG_ERR, "No prior ndmp_config_get_ext_list issued.");
reply.error = NDMP_PRECONDITION_ERR;
} else if (session->ns_set_ext_list) {
/*
* Illegal request if extensions have already been selected.
*/
! NDMP_LOG(LOG_ERR, "Extensions have already been selected.");
reply.error = NDMP_EXT_DANDN_ILLEGAL_ERR;
} else {
/*
* We currently do not support any extensions, but the DMA
* may test NDMP_CONFIG_SET_EXT_LIST with an empty list.
--- 1103,1119 ----
if (!session->ns_get_ext_list) {
/*
* The DMA is required to issue a NDMP_GET_EXT_LIST request
* prior sending a NDMP_SET_EXT_LIST request.
*/
! syslog(LOG_ERR, "No prior ndmp_config_get_ext_list issued.");
reply.error = NDMP_PRECONDITION_ERR;
} else if (session->ns_set_ext_list) {
/*
* Illegal request if extensions have already been selected.
*/
! syslog(LOG_ERR, "Extensions have already been selected.");
reply.error = NDMP_EXT_DANDN_ILLEGAL_ERR;
} else {
/*
* We currently do not support any extensions, but the DMA
* may test NDMP_CONFIG_SET_EXT_LIST with an empty list.