瀏覽代碼

HADOOP-4635. Fix a memory leak in fuse dfs. (pete wyckoff via mahadev)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.18@722572 13f79535-47bb-0310-9956-ffa450edef68
Mahadev Konar 16 年之前
父節點
當前提交
f5b811a0ef
共有 3 個文件被更改,包括 7 次插入17 次删除
  1. 2 0
      CHANGES.txt
  2. 3 1
      src/contrib/fuse-dfs/src/fuse_dfs.c
  3. 2 16
      src/contrib/fuse-dfs/src/test/TestFuseDFS.java

+ 2 - 0
CHANGES.txt

@@ -54,6 +54,8 @@ Release 0.18.3 - Unreleased
 
     HADOOP-4713. Fix librecordio to handle records larger than 64k. (Christian
     Kunz via cdouglas)
+   
+   HADOOP-4635. Fix a memory leak in fuse dfs. (pete wyckoff via mahadev)
 
 Release 0.18.2 - 2008-11-03
 

+ 3 - 1
src/contrib/fuse-dfs/src/fuse_dfs.c

@@ -618,6 +618,8 @@ static char ** getGroups(uid_t uid, int *num_groups)
   assert(user != NULL);
   groupnames[i] = user;
 
+  // increment num_groups to include the user being added to the group list
+  *num_groups = *num_groups + 1;
 #else
 
   int i = 0;
@@ -1000,7 +1002,7 @@ static int dfs_statfs(const char *path, struct statvfs *st)
   st->f_blocks  =  cap/bsize;
 
   st->f_bfree   =  (cap-used)/bsize;
-  st->f_bavail  =  cap/bsize;
+  st->f_bavail  =  (cap-used)/bsize;
 
   st->f_files   =  1000;
   st->f_ffree   =  500;

+ 2 - 16
src/contrib/fuse-dfs/src/test/TestFuseDFS.java

@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-import org.apache.hadoop.dfs.*;
+import org.apache.hadoop.hdfs.*;
 import junit.framework.TestCase;
 import java.io.*;
 import org.apache.hadoop.conf.Configuration;
@@ -58,7 +58,7 @@ public class TestFuseDFS extends TestCase {
     System.err.println("LD_LIBRARY_PATH=" + lp);
     String cmd[] =  {  fuse_cmd, "dfs://" + dfs.getHost() + ":" + String.valueOf(dfs.getPort()), 
                        mountpoint, "-obig_writes", "-odebug", "-oentry_timeout=1",  "-oattribute_timeout=1", "-ousetrash", "rw", "-oinitchecks",
-                       "-ordbuffer=5000"};
+                       "-ordbuffer=32768"};
     final String [] envp = {
       "CLASSPATH="+  cp,
       "LD_LIBRARY_PATH=" + lp,
@@ -271,23 +271,9 @@ public class TestFuseDFS extends TestCase {
 
       DistributedFileSystem.DiskStatus d = fileSys.getDiskStatus();
 
-      System.err.println("DEBUG:f.total=" + f.getTotalSpace());
-      System.err.println("DEBUG:d.capacity=" + d.getCapacity());
-
-      System.err.println("DEBUG:f.usable=" + f.getUsableSpace());
-
-      System.err.println("DEBUG:f.free=" + f.getFreeSpace());
-      System.err.println("DEBUG:d.remaining = " + d.getRemaining());
-
-      System.err.println("DEBUG:d.used = " + d.getDfsUsed());
-      System.err.println("DEBUG:f.total - f.free = " + (f.getTotalSpace() - f.getFreeSpace()));
-
       long fileUsedBlocks =  (f.getTotalSpace() - f.getFreeSpace())/(64 * 1024 * 1024);
       long dfsUsedBlocks = (long)Math.ceil((double)d.getDfsUsed()/(64 * 1024 * 1024));
-      System.err.println("DEBUG: fileUsedBlocks = " + fileUsedBlocks);
-      System.err.println("DEBUG: dfsUsedBlocks =  " + dfsUsedBlocks);
 
-      assertTrue(f.getTotalSpace() == f.getUsableSpace());
       assertTrue(fileUsedBlocks == dfsUsedBlocks);
       assertTrue(d.getCapacity() == f.getTotalSpace());