GIT: unionfs2-2.6.27.y: bugfix: statfs lower file system properly

Erez Zadok ezk at fsl.cs.sunysb.edu
Thu Aug 12 23:16:24 EDT 2010


commit 3a93b32a6891bf355710fd52215d4f527c2827bd
Author: Erez Zadok <ezk at bigvaio.(none)>
Date:   Tue May 22 18:04:14 2007 -0400

    bugfix: statfs lower file system properly
    
    Get the correct lower dentry to use to statfs the first branch (always), now
    works with disk-based as well as network file systems.  Also document the
    code better.
    
    Signed-off-by: Erez Zadok <ezk at cs.sunysb.edu>

diff --git a/fs/unionfs/super.c b/fs/unionfs/super.c
index d68b4ed..1ca6c54 100644
--- a/fs/unionfs/super.c
+++ b/fs/unionfs/super.c
@@ -114,23 +114,37 @@ static void unionfs_put_super(struct super_block *sb)
 static int unionfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 {
 	int err	= 0;
-	struct super_block *sb, *hidden_sb;
+	struct super_block *sb;
+	struct dentry *lower_dentry;
 
 	BUG_ON(!is_valid_dentry(dentry));
+	unionfs_check_dentry(dentry);
 
 	sb = dentry->d_sb;
 
 	unionfs_read_lock(sb);
-	hidden_sb = unionfs_lower_super_idx(sb, sbstart(sb));
+	lower_dentry = unionfs_lower_dentry(sb->s_root);
 	unionfs_read_unlock(sb);
-	err = vfs_statfs(hidden_sb->s_root, buf);
+	err = vfs_statfs(lower_dentry, buf);
 
+	/* set return buf to our f/s to avoid confusing user-level utils */
 	buf->f_type = UNIONFS_SUPER_MAGIC;
+	/*
+	 * Our maximum file name can is shorter bya few bytes because every
+	 * file name could potentially be whited-out.
+	 *
+	 * XXX: this restriction goes away with ODF.
+	 */
 	buf->f_namelen -= UNIONFS_WHLEN;
 
+	/*
+	 * reset two fields to avoid confusing user-land.
+	 * XXX: is this still necessary?
+	 */
 	memset(&buf->f_fsid, 0, sizeof(__kernel_fsid_t));
 	memset(&buf->f_spare, 0, sizeof(buf->f_spare));
 
+	unionfs_check_dentry(dentry);
 	return err;
 }
 


More information about the unionfs-cvs mailing list