Rev 675: - if dmapi is failing to respond, assume offline rather than online if in http://samba.org/~tridge/3_0-ctdb

tridge at samba.org tridge at samba.org
Fri Nov 23 01:59:58 GMT 2007


------------------------------------------------------------
revno: 675
revision-id:tridge at samba.org-20071123015852-jp3bcp1pevf3bznr
parent: tridge at samba.org-20071123015444-a92tjnuiu0du4v8w
committer: Andrew Tridgell <tridge at samba.org>
branch nick: s3-ctdb-tridge
timestamp: Fri 2007-11-23 12:58:52 +1100
message:
  - if dmapi is failing to respond, assume offline rather than online if
    the st_blocks heuristic makes this likely
  
  - if st_size is zero then we know the file is not offline
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-23 01:54:44 +0000
+++ b/source/modules/vfs_tsmsm.c	2007-11-23 01:58:52 +0000
@@ -150,7 +150,7 @@
 
         /* if the file has more than FILE_IS_ONLINE_RATIO of blocks available,
 	   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) {
+	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;
@@ -163,7 +163,9 @@
 	/* 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)));
+		DEBUG(2,("dm_path_to_handle failed - assuming offline (%s) - %s\n", 
+			 path, strerror(errno)));
+		*offline = true;
 		goto done;
 	}
 
@@ -199,7 +201,7 @@
 	*/
 	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 !(512 * (off_t)sbuf.st_blocks >= sbuf.st_size * tsmd->online_ratio);
 	}
 	return False;
 }



More information about the samba-cvs mailing list