s3: Add more helpful debugging to some of the streams code
authorTim Prouty <tprouty@samba.org>
Fri, 28 Aug 2009 22:53:05 +0000 (22:53 +0000)
committerTim Prouty <tprouty@samba.org>
Thu, 24 Sep 2009 17:59:33 +0000 (10:59 -0700)
source3/modules/onefs_streams.c
source3/modules/onefs_system.c
source3/smbd/filename.c

index da2666130c3da7c4d1666dc3fa7c939c87455986..fa65b519966136515e6412d621e1036d927cec09 100644 (file)
@@ -71,6 +71,13 @@ NTSTATUS onefs_stream_prep_smb_fname(TALLOC_CTX *ctx,
                                            stream_name, &smb_fname_in->st,
                                            smb_fname_out);
        TALLOC_FREE(stream_name);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(5, ("Failed to prep stream name for %s: %s\n",
+                         *smb_fname_out ?
+                         smb_fname_str_dbg(*smb_fname_out) : "NULL",
+                         nt_errstr(status)));
+       }
        return status;
 }
 
@@ -96,6 +103,9 @@ static int get_stream_dir_fd(connection_struct *conn, const char *base,
        int dir_fd;
        int saved_errno;
 
+       DEBUG(10, ("Getting stream directory fd: %s (%d)\n", base,
+                  base_fdp ? *base_fdp : -1));
+
        /* If a valid base_fdp was given, use it. */
        if (base_fdp && *base_fdp >= 0) {
                base_fd = *base_fdp;
@@ -115,6 +125,8 @@ static int get_stream_dir_fd(connection_struct *conn, const char *base,
                                                0,
                                                NULL);
                if (base_fd < 0) {
+                       DEBUG(5, ("Failed getting base fd: %s\n",
+                                 strerror(errno)));
                        return -1;
                }
        }
@@ -147,6 +159,11 @@ static int get_stream_dir_fd(connection_struct *conn, const char *base,
                *base_fdp = base_fd;
        }
 
+       if (dir_fd < 0) {
+               DEBUG(5, ("Failed getting stream directory fd: %s\n",
+                         strerror(errno)));
+       }
+
        return dir_fd;
 }
 
@@ -173,6 +190,9 @@ int onefs_rename(vfs_handle_struct *handle,
        /* For now don't allow renames from or to the default stream. */
        if (is_ntfs_default_stream_smb_fname(smb_fname_src) ||
            is_ntfs_default_stream_smb_fname(smb_fname_dst)) {
+               DEBUG(3, ("Unable to rename to/from a default stream: %s -> "
+                         "%s\n", smb_fname_str_dbg(smb_fname_src),
+                         smb_fname_str_dbg(smb_fname_dst)));
                errno = ENOSYS;
                goto done;
        }
@@ -311,6 +331,9 @@ static int stat_stream(struct connection_struct *conn, const char *base,
        /* Stat the stream. */
        ret = onefs_sys_fstat_at(dir_fd, stream, sbuf, flags);
        if (ret != -1) {
+               DEBUG(10, ("stat of stream '%s' failed: %s\n", stream,
+                          strerror(errno)));
+       } else {
                /* Now stat the base file and merge the results. */
                ret = onefs_sys_fstat(base_fd, &base_sbuf);
                if (ret != -1) {
index e3edc81608c2b1de6002627cab64e6a308a61edc..33bec2658ba95e3861cedc7ce971d7ff112b29e0 100644 (file)
@@ -178,7 +178,7 @@ int onefs_sys_create_file(connection_struct *conn,
                             open_access_mask));
        }
 
-       DEBUG(10,("onefs_sys_create_file: base_fd = %d, fname = %s"
+       DEBUG(10,("onefs_sys_create_file: base_fd = %d, fname = %s "
                  "open_access_mask = 0x%x, flags = 0x%x, mode = 0%o, "
                  "desired_oplock = %s, id = 0x%x, secinfo = 0x%x, sd = %p, "
                  "dos_attributes = 0x%x, path = %s, "
index ee97388da28c925e1b66b923765308c9734fcf0e..a64ca271144896c9e37743e31c0ade4b748c97c9 100644 (file)
@@ -973,8 +973,8 @@ static NTSTATUS build_stream_path(TALLOC_CTX *mem_ctx,
        }
 
        if (errno != ENOENT) {
+               DEBUG(10, ("vfs_stat failed: %s\n", strerror(errno)));
                status = map_nt_error_from_unix(errno);
-               DEBUG(10, ("vfs_stat failed: %s\n", nt_errstr(status)));
                goto fail;
        }