------------------------------------------------------------
revno: 674
revision-id:[EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Andrew Tridgell <[EMAIL PROTECTED]>
branch nick: s3-ctdb-tridge
timestamp: Fri 2007-11-23 12:54:44 +1100
message:
  - fixed a bug in tsmsm_aio_force(). It assumed that VFS_STAT()
    returned a bool, when in fact it returned an int. This made the
    never work. 
  
  - added some more debug messages to track errors in vfs_tsmsm.c
modified:
  source/modules/vfs_tsmsm.c     vfs_tsmsm.c-20070827024912-m3pirz28sej5g6pz-1
=== modified file 'source/modules/vfs_tsmsm.c'
--- a/source/modules/vfs_tsmsm.c        2007-11-12 10:55:44 +0000
+++ b/source/modules/vfs_tsmsm.c        2007-11-23 01:54:44 +0000
@@ -142,8 +142,8 @@
                            SMB_STRUCT_STAT *stbuf,
                            BOOL *offline) {
        struct tsmsm_struct *tsmd = (struct tsmsm_struct *) handle->data;
-       void *dmhandle;
-       size_t dmhandle_len;
+       void *dmhandle=NULL;
+       size_t dmhandle_len=0;
        size_t rlen;
        dm_attrname_t dmname;
        int ret;
@@ -152,6 +152,7 @@
           then assume it is not offline (it may not be 100%, as it could be 
sparse) */
        if (512 * (off_t)stbuf->st_blocks > stbuf->st_size * 
tsmd->online_ratio) {
                *offline = false;
+               DEBUG(10,("%s not offline: st_blocks=%ld st_size=%ld 
online_ratio=%.2f\n", path, stbuf->st_blocks, stbuf->st_size, 
tsmd->online_ratio));
                return 0;
        }
 
@@ -162,6 +163,7 @@
        /* go the slow DMAPI route */
        if (dm_path_to_handle((char*)path, &dmhandle, &dmhandle_len) != 0) {
                ret = -1;
+               DEBUG(2,("dm_path_to_handle failed (%s) - %s\n", path, 
strerror(errno)));
                goto done;
        }
 
@@ -173,6 +175,9 @@
 
        /* its offline if the IBMObj attribute exists */
        *offline = (ret == 0 || (ret == -1 && errno == E2BIG));
+
+       DEBUG(10,("dm_get_dmattr %s ret=%d (%s)\n", path, ret, 
strerror(errno)));
+
        ret = 0;
 
        dm_handle_free(dmhandle, dmhandle_len); 
@@ -192,7 +197,8 @@
           call as that would be too slow, instead we err on the side of using 
AIO
           if the file might be offline
        */
-       if(SMB_VFS_FSTAT(fsp, fsp->fh->fd, &sbuf)) {
+       if(SMB_VFS_FSTAT(fsp, fsp->fh->fd, &sbuf) == 0) {
+               DEBUG(10,("tsmsm_aio_force st_blocks=%ld st_size=%ld 
online_ratio=%.2f\n", sbuf.st_blocks, sbuf.st_size, tsmd->online_ratio));
                return !(512 * (off_t)sbuf.st_blocks > sbuf.st_size * 
tsmd->online_ratio);
        }
        return False;

Reply via email to