[Unionfs] Can't mount NFS-exported union anymore in unionfs-1.4

hooanon05 at yahoo.co.jp hooanon05 at yahoo.co.jp
Wed Nov 29 08:01:56 EST 2006


> - If you meet a compile error, fix it by referencing my previous
>   patches. you don't need entire patch, just to fix the compile error.
> - specify imap option AFTER dirs option.

here is a patch for it.

Junjiro Okajima

Index: branchman.c
===================================================================
RCS file: /home/cvs/unionfs/unionfs/branchman.c,v
retrieving revision 1.66
diff -u -p -r1.66 branchman.c
--- branchman.c	31 Oct 2006 00:05:22 -0000	1.66
+++ branchman.c	29 Nov 2006 12:58:20 -0000
@@ -214,7 +214,7 @@ int unionfs_ioctl_addbranch(struct inode
 	print_entry_location();
 
 #ifdef UNIONFS_IMAP
-	if (stopd(sb)->usi_persistent) {
+	if (stopd(inode->i_sb)->usi_persistent) {
 		printk(KERN_ERR "Cannot manipulate branches if imap is used\n");
 		err = -EPERM;
 		goto out;
Index: main.c
===================================================================
RCS file: /home/cvs/unionfs/unionfs/main.c,v
retrieving revision 1.176
diff -u -p -r1.176 main.c
--- main.c	10 Oct 2006 07:28:13 -0000	1.176
+++ main.c	29 Nov 2006 12:58:20 -0000
@@ -511,10 +511,15 @@ static struct unionfs_dentry_info *union
 		}
 #ifdef UNIONFS_IMAP
 		if (!strcmp("imap", optname)) {
+			err = -EINVAL;
+			if (!dirsfound) {
+				printk(KERN_WARNING
+				       "unionfs: imap option should be after dirs option\n");
+				goto out_error;
+			}
 			if (++imapfound > 1) {
 				printk(KERN_WARNING
 				       "unionfs: multiple imap specified\n");
-				err = -EINVAL;
 				goto out_error;
 			}
 			err = parse_imap_option(sb, hidden_root_info, optarg);
Index: persistent_inode.c
===================================================================
RCS file: /home/cvs/unionfs/unionfs/persistent_inode.c,v
retrieving revision 1.36
diff -u -p -r1.36 persistent_inode.c
--- persistent_inode.c	8 Jul 2006 17:58:31 -0000	1.36
+++ persistent_inode.c	29 Nov 2006 12:58:20 -0000
@@ -211,7 +211,7 @@ static int verify_reversemap(struct supe
 
 			d = hidden_root_info->udi_dentry[bindex];
 
-			err = d->d_sb->s_op->statfs(d->d_sb, &st);
+			err = d->d_sb->s_op->statfs(d, &st);
 			if (err)
 				goto out;
 
@@ -453,6 +453,7 @@ static int __read_uin(struct unionfs_sb_
 	const int elmnt = sizeof(ino64);
 
 	rev = sbi->usi_map_table[bindex];
+	BUG_ON(!rev);
 	pos = sizeof(struct rmaphdr) + elmnt * hidden_ino;
 	*ino = 0;
 	err = 0;
@@ -540,6 +541,9 @@ int read_uin(struct super_block *sb, uin
 	spd = stopd(sb);
 	BUG_ON(!spd);
 
+	/* it must be slow. read/write lock per file is necessary */
+	mutex_lock(&sb->s_lock);
+
 	/* Find appropriate reverse map and then read from the required position */
 	/* get it from the array. */
 	err = __read_uin(spd, inode_number, branchnum, uino);
@@ -553,13 +557,12 @@ int read_uin(struct super_block *sb, uin
 	/* If we haven't found an entry and we have the O_CREAT flag set we want to
 	 * create a new entry write it out to the file and return its index
 	 */
-	mutex_lock(&sb->s_lock);
 	*uino = spd->usi_next_avail++;
 	err = __write_uin(spd, *uino, branchnum, inode_number);
 	if (err)
 		spd->usi_next_avail--;
-	mutex_unlock(&sb->s_lock);
       out:
+	mutex_unlock(&sb->s_lock);
 	print_exit_status(err);
 	return err;
 }


More information about the unionfs mailing list