Print this page
NEX-9532 NDMP: readdir errors when file/directory has special characters
Reviewed by: Peer Dampmann <peer.dampmann@nexenta.com>
Reviewed by: Alexander Eremin <alexander.eremin@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
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

@@ -36,12 +36,14 @@
  * 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 2017 Nexenta Systems, Inc. All rights reserved. */
 
 #include <sys/types.h>
+#include <syslog.h>
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <stdlib.h>
 #include "ndmpd_common.h"

@@ -101,11 +103,11 @@
 {
         ndmp_scsi_close_reply reply;
         ndmpd_session_t *session = ndmp_get_client_data(connection);
 
         if (session->ns_scsi.sd_is_open == -1) {
-                NDMP_LOG(LOG_ERR, "SCSI device is not open.");
+                syslog(LOG_ERR, "SCSI device is not open.");
                 reply.error = NDMP_DEV_NOT_OPEN_ERR;
                 ndmp_send_reply(connection, (void *) &reply,
                     "sending scsi_close reply");
                 return;
         }

@@ -224,20 +226,18 @@
 
         ndmpd_session_t *session = ndmp_get_client_data(connection);
         struct uscsi_cmd  cmd;
 
         if (session->ns_scsi.sd_devid == -1) {
-                NDMP_LOG(LOG_ERR, "SCSI device is not open.");
+                syslog(LOG_ERR, "SCSI device is not open.");
                 reply.error = NDMP_DEV_NOT_OPEN_ERR;
         } else {
                 reply.error = NDMP_NO_ERR;
                 (void) memset((void*)&cmd, 0, sizeof (cmd));
                 cmd.uscsi_flags |= USCSI_RESET;
                 if (ioctl(session->ns_scsi.sd_devid, USCSICMD, &cmd) < 0) {
-                        NDMP_LOG(LOG_ERR, "USCSI reset failed: %m.");
-                        NDMP_LOG(LOG_DEBUG,
-                            "ioctl(USCSICMD) USCSI_RESET failed: %m.");
+                        syslog(LOG_ERR, "USCSI reset failed: %m.");
                         reply.error = NDMP_IO_ERR;
                 }
         }
 
         ndmp_send_reply(connection, (void *) &reply,

@@ -263,11 +263,10 @@
 void
 ndmpd_scsi_reset_bus_v2(ndmp_connection_t *connection, void *body)
 {
         ndmp_scsi_reset_bus_reply reply;
 
-        NDMP_LOG(LOG_DEBUG, "request not supported");
         reply.error = NDMP_NOT_SUPPORTED_ERR;
 
         ndmp_send_reply(connection, (void *) &reply,
             "sending scsi_reset_bus reply");
 }

@@ -294,11 +293,10 @@
 
         if (session->ns_scsi.sd_is_open == -1 ||
             !session->ns_scsi.sd_valid_target_set) {
                 (void) memset((void *) &reply, 0, sizeof (reply));
 
-                NDMP_LOG(LOG_ERR, "SCSI device is not open.");
                 reply.error = NDMP_DEV_NOT_OPEN_ERR;
                 ndmp_send_reply(connection, (void *) &reply,
                     "sending scsi_execute_cdb reply");
         } else {
                 ndmp_execute_cdb(session, session->ns_scsi.sd_adapter_name,

@@ -414,33 +412,30 @@
         ndmpd_session_t *session = ndmp_get_client_data(connection);
         char adptnm[SCSI_MAX_NAME];
         int sid, lun;
         int err;
         scsi_adapter_t *sa;
-        int devid;
+        int devid = -1;
 
         err = NDMP_NO_ERR;
 
         if (session->ns_tape.td_fd != -1 || session->ns_scsi.sd_is_open != -1) {
-                NDMP_LOG(LOG_ERR,
-                    "Session already has a tape or scsi device open.");
                 err = NDMP_DEVICE_OPENED_ERR;
         } else if ((sa = scsi_get_adapter(0)) != NULL) {
-                NDMP_LOG(LOG_DEBUG, "Adapter device found: %s", devname);
                 (void) strlcpy(adptnm, devname, SCSI_MAX_NAME-2);
                 adptnm[SCSI_MAX_NAME-1] = '\0';
                 sid = lun = -1;
 
                 scsi_find_sid_lun(sa, devname, &sid, &lun);
                 if (ndmp_open_list_find(devname, sid, lun) == NULL &&
                     (devid = open(devname, O_RDWR | O_NDELAY)) < 0) {
-                        NDMP_LOG(LOG_ERR, "Failed to open device %s: %m.",
+                        syslog(LOG_ERR, "Failed to open device %s: %m.",
                             devname);
                         err = NDMP_NO_DEVICE_ERR;
                 }
         } else {
-                NDMP_LOG(LOG_ERR, "%s: No such SCSI adapter.", devname);
+                syslog(LOG_ERR, "%s: No such SCSI adapter.", devname);
                 err = NDMP_NO_DEVICE_ERR;
         }
 
         if (err != NDMP_NO_ERR) {
                 scsi_open_send_reply(connection, err);

@@ -510,18 +505,18 @@
 
         if (session->ns_scsi.sd_is_open == -1) {
                 reply.error = NDMP_DEV_NOT_OPEN_ERR;
         } else if (!scsi_dev_exists(session->ns_scsi.sd_adapter_name, sid,
             lun)) {
-                NDMP_LOG(LOG_ERR, "No such SCSI device: target %d lun %d.",
+                syslog(LOG_ERR, "No such SCSI device: target %d lun %d.",
                     sid, lun);
                 reply.error = NDMP_NO_DEVICE_ERR;
         } else {
                 type = scsi_get_devtype(session->ns_scsi.sd_adapter_name, sid,
                     lun);
                 if (type != DTYPE_SEQUENTIAL && type != DTYPE_CHANGER) {
-                        NDMP_LOG(LOG_ERR,
+                        syslog(LOG_ERR,
                             "Not a tape or robot device: target %d lun %d.",
                             sid, lun);
                         reply.error = NDMP_ILLEGAL_ARGS_ERR;
                 }
         }

@@ -555,11 +550,10 @@
                         reply.error = NDMP_IO_ERR;
                 }
         }
 
         if (reply.error == NDMP_NO_ERR) {
-                NDMP_LOG(LOG_DEBUG, "Updated sid %d lun %d", sid, lun);
                 session->ns_scsi.sd_sid = sid;
                 session->ns_scsi.sd_lun = lun;
                 session->ns_scsi.sd_valid_target_set = TRUE;
         }