Rev 674: - fixed a bug in tsmsm_aio_force(). It assumed that VFS_STAT() in http://samba.org/~tridge/3_0-ctdb

tridge at samba.org tridge at samba.org
Fri Nov 23 01:55:50 GMT 2007


------------------------------------------------------------
revno: 674
revision-id:tridge at samba.org-20071123015444-a92tjnuiu0du4v8w
parent: tridge at samba.org-20071123012809-nyha931txcgsj268
committer: Andrew Tridgell <tridge at samba.org>
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;



More information about the samba-cvs mailing list