[Unionfs] [PATCH] Compile unionfs against 2.6.16
Dave Quigley
dquigley at ic.sunysb.edu
Fri Mar 24 12:38:25 EST 2006
Jan Altenberg wrote:
>Hi,
>
>I wasn't able to compile unionfs-1.1.3 against kernel 2.6.16.
>Could you have a look at the attached patch?
>
>
>Signed-off-by: Jan Altenberg <tb10alj at tglx.de>
>
>----------------------
>
>diff -x Makefile -uprN unionfs-1.1.3/copyup.c unionfs-1.1.3-hacked/copyup.c
>--- unionfs-1.1.3/copyup.c 2006-02-20 23:47:06.000000000 +0100
>+++ unionfs-1.1.3-hacked/copyup.c 2006-03-23 16:05:06.000000000 +0100
>@@ -64,7 +64,7 @@ static int copyup_xattrs(struct dentry *
> name_list_orig = name_list;
> while (*name_list) {
> ssize_t size;
>- down(&old_hidden_dentry->d_inode->i_sem);
>+ mutex_lock(&old_hidden_dentry->d_inode->i_mutex);
> err = security_inode_getxattr(old_hidden_dentry, name_list);
> if (err)
> size = err;
>@@ -73,7 +73,7 @@ static int copyup_xattrs(struct dentry *
> old_hidden_dentry->d_inode->i_op->
> getxattr(old_hidden_dentry, name_list, attr_value,
> XATTR_SIZE_MAX);
>- up(&old_hidden_dentry->d_inode->i_sem);
>+ mutex_unlock(&old_hidden_dentry->d_inode->i_mutex);
> if (size < 0) {
> err = size;
> goto out;
>@@ -84,7 +84,7 @@ static int copyup_xattrs(struct dentry *
> goto out;
> }
>
>- down(&new_hidden_dentry->d_inode->i_sem);
>+ mutex_lock(&new_hidden_dentry->d_inode->i_mutex);
>
> err =
> security_inode_setxattr(old_hidden_dentry, name_list,
>@@ -101,7 +101,7 @@ static int copyup_xattrs(struct dentry *
> attr_value, size,
> 0);
> }
>- up(&new_hidden_dentry->d_inode->i_sem);
>+ mutex_unlock(&new_hidden_dentry->d_inode->i_mutex);
>
> if (err < 0)
> goto out;
>diff -x Makefile -uprN unionfs-1.1.3/dentry.c unionfs-1.1.3-hacked/dentry.c
>--- unionfs-1.1.3/dentry.c 2006-02-20 23:47:06.000000000 +0100
>+++ unionfs-1.1.3-hacked/dentry.c 2006-03-23 16:05:06.000000000 +0100
>@@ -108,7 +108,7 @@ int unionfs_d_revalidate(struct dentry *
> interpose_flag = INTERPOSE_REVAL_NEG;
> if (positive) {
> interpose_flag = INTERPOSE_REVAL;
>- down(&dentry->d_inode->i_sem);
>+ mutex_lock(&dentry->d_inode->i_mutex);
> bstart = ibstart(dentry->d_inode);
> bend = ibend(dentry->d_inode);
> if (bstart >= 0) {
>@@ -126,7 +126,7 @@ int unionfs_d_revalidate(struct dentry *
> itohi_ptr(dentry->d_inode) = NULL;
> ibstart(dentry->d_inode) = -1;
> ibend(dentry->d_inode) = -1;
>- up(&dentry->d_inode->i_sem);
>+ mutex_unlock(&dentry->d_inode->i_mutex);
> }
>
> result = unionfs_lookup_backend(dentry, interpose_flag);
>diff -x Makefile -uprN unionfs-1.1.3/dirhelper.c unionfs-1.1.3-hacked/dirhelper.c
>--- unionfs-1.1.3/dirhelper.c 2006-02-20 23:47:06.000000000 +0100
>+++ unionfs-1.1.3-hacked/dirhelper.c 2006-03-23 16:05:06.000000000 +0100
>@@ -78,11 +78,11 @@ int delete_whiteouts(struct dentry *dent
> continue;
> }
>
>- down(&hidden_dir_dentry->d_inode->i_sem);
>+ mutex_lock(&hidden_dir_dentry->d_inode->i_mutex);
> err =
> vfs_unlink(hidden_dir_dentry->d_inode,
> hidden_dentry);
>- up(&hidden_dir_dentry->d_inode->i_sem);
>+ mutex_unlock(&hidden_dir_dentry->d_inode->i_mutex);
> DPUT(hidden_dentry);
>
> if (err && !IS_COPYUP_ERR(err))
>diff -x Makefile -uprN unionfs-1.1.3/file.c unionfs-1.1.3-hacked/file.c
>--- unionfs-1.1.3/file.c 2006-02-20 23:47:06.000000000 +0100
>+++ unionfs-1.1.3-hacked/file.c 2006-03-23 16:05:06.000000000 +0100
>@@ -264,10 +264,10 @@ static int unionfs_fsync(struct file *fi
> if (!hidden_file->f_op || !hidden_file->f_op->fsync)
> goto out;
>
>- down(&hidden_file->f_dentry->d_inode->i_sem);
>+ mutex_lock(&hidden_file->f_dentry->d_inode->i_mutex);
> err = hidden_file->f_op->fsync(hidden_file, hidden_file->f_dentry,
> datasync);
>- up(&hidden_file->f_dentry->d_inode->i_sem);
>+ mutex_unlock(&hidden_file->f_dentry->d_inode->i_mutex);
>
> out:
> print_exit_status(err);
>diff -x Makefile -uprN unionfs-1.1.3/inode.c unionfs-1.1.3-hacked/inode.c
>--- unionfs-1.1.3/inode.c 2006-02-20 23:47:06.000000000 +0100
>+++ unionfs-1.1.3-hacked/inode.c 2006-03-23 16:05:06.000000000 +0100
>@@ -81,7 +81,7 @@ static int unionfs_create(struct inode *
> struct dentry *hidden_dir_dentry;
> struct iattr newattrs;
>
>- down(&whiteout_dentry->d_inode->i_sem);
>+ mutex_lock(&whiteout_dentry->d_inode->i_mutex);
> newattrs.ia_valid = ATTR_CTIME | ATTR_MODE | ATTR_ATIME
> | ATTR_MTIME | ATTR_UID | ATTR_GID | ATTR_FORCE
> | ATTR_KILL_SUID | ATTR_KILL_SGID;
>@@ -97,7 +97,7 @@ static int unionfs_create(struct inode *
>
> err = notify_change(whiteout_dentry, &newattrs);
>
>- up(&whiteout_dentry->d_inode->i_sem);
>+ mutex_unlock(&whiteout_dentry->d_inode->i_mutex);
>
> if (err)
> printk(KERN_WARNING
>@@ -594,10 +594,10 @@ static int unionfs_mkdir(struct inode *p
> err = PTR_ERR(whiteout_dentry);
> goto out;
> }
>- down(&hidden_dentry->d_inode->i_sem);
>+ mutex_lock(&hidden_dentry->d_inode->i_mutex);
> err = vfs_create(hidden_dentry->d_inode,
> whiteout_dentry, 0600, NULL);
>- up(&hidden_dentry->d_inode->i_sem);
>+ mutex_unlock(&hidden_dentry->d_inode->i_mutex);
> DPUT(whiteout_dentry);
>
> if (err) {
>diff -x Makefile -uprN unionfs-1.1.3/main.c unionfs-1.1.3-hacked/main.c
>--- unionfs-1.1.3/main.c 2006-02-20 23:47:06.000000000 +0100
>+++ unionfs-1.1.3-hacked/main.c 2006-03-23 16:05:06.000000000 +0100
>@@ -103,7 +103,7 @@ int unionfs_interpose(struct dentry *den
> }
> }
>
>- down(&inode->i_sem);
>+ mutex_lock(&inode->i_mutex);
> if (atomic_read(&inode->i_count) > 1)
> goto skip;
>
>@@ -172,7 +172,7 @@ int unionfs_interpose(struct dentry *den
>
> fist_print_dentry("Leaving unionfs_interpose", dentry);
> fist_print_inode("Leaving unionfs_interpose", inode);
>- up(&inode->i_sem);
>+ mutex_unlock(&inode->i_mutex);
>
> out:
> print_exit_status(err);
>diff -x Makefile -uprN unionfs-1.1.3/unionfs.h unionfs-1.1.3-hacked/unionfs.h
>--- unionfs-1.1.3/unionfs.h 2006-03-23 16:06:17.000000000 +0100
>+++ unionfs-1.1.3-hacked/unionfs.h 2006-03-23 16:05:06.000000000 +0100
>@@ -776,13 +776,13 @@ static inline struct dentry *lock_parent
> {
> struct dentry *dir = DGET(dentry->d_parent);
>
>- down(&dir->d_inode->i_sem);
>+ mutex_lock(&dir->d_inode->i_mutex);
> return dir;
> }
>
> static inline void unlock_dir(struct dentry *dir)
> {
>- up(&dir->d_inode->i_sem);
>+ mutex_unlock(&dir->d_inode->i_mutex);
> DPUT(dir);
> }
>
>diff -x Makefile -uprN unionfs-1.1.3/xattr.c unionfs-1.1.3-hacked/xattr.c
>--- unionfs-1.1.3/xattr.c 2006-02-20 23:47:06.000000000 +0100
>+++ unionfs-1.1.3-hacked/xattr.c 2006-03-23 16:05:06.000000000 +0100
>@@ -77,14 +77,14 @@ ssize_t unionfs_getxattr(struct dentry *
>
> encoded_value = (char *)value;
>
>- down(&hidden_dentry->d_inode->i_sem);
>+ mutex_lock(&hidden_dentry->d_inode->i_mutex);
> /* lock_kernel() already done by caller. */
> err =
> hidden_dentry->d_inode->i_op->getxattr(hidden_dentry,
> encoded_name,
> encoded_value, size);
> /* unlock_kernel() will be done by caller. */
>- up(&hidden_dentry->d_inode->i_sem);
>+ mutex_unlock(&hidden_dentry->d_inode->i_mutex);
>
> }
>
>@@ -112,12 +112,12 @@ unionfs_setxattr(struct dentry *dentry,
> name, (unsigned long)size, flags);
>
> if (hidden_dentry->d_inode->i_op->setxattr) {
>- down(&hidden_dentry->d_inode->i_sem);
>+ mutex_lock(&hidden_dentry->d_inode->i_mutex);
> /* lock_kernel() already done by caller. */
> err = hidden_dentry->d_inode->i_op->
> setxattr(hidden_dentry, name, value, size, flags);
> /* unlock_kernel() will be done by caller. */
>- up(&hidden_dentry->d_inode->i_sem);
>+ mutex_unlock(&hidden_dentry->d_inode->i_mutex);
> }
>
> unlock_dentry(dentry);
>@@ -143,13 +143,13 @@ int unionfs_removexattr(struct dentry *d
> if (hidden_dentry->d_inode->i_op->removexattr) {
> encoded_name = (char *)name;
>
>- down(&hidden_dentry->d_inode->i_sem);
>+ mutex_lock(&hidden_dentry->d_inode->i_mutex);
> /* lock_kernel() already done by caller. */
> err =
> hidden_dentry->d_inode->i_op->removexattr(hidden_dentry,
> encoded_name);
> /* unlock_kernel() will be done by caller. */
>- up(&hidden_dentry->d_inode->i_sem);
>+ mutex_unlock(&hidden_dentry->d_inode->i_mutex);
> }
>
> unlock_dentry(dentry);
>@@ -173,13 +173,13 @@ ssize_t unionfs_listxattr(struct dentry
>
> if (hidden_dentry->d_inode->i_op->listxattr) {
> encoded_list = list;
>- down(&hidden_dentry->d_inode->i_sem);
>+ mutex_lock(&hidden_dentry->d_inode->i_mutex);
> /* lock_kernel() already done by caller. */
> err =
> hidden_dentry->d_inode->i_op->listxattr(hidden_dentry,
> encoded_list, size);
> /* unlock_kernel() will be done by caller. */
>- up(&hidden_dentry->d_inode->i_sem);
>+ mutex_unlock(&hidden_dentry->d_inode->i_mutex);
> }
>
> unlock_dentry(dentry);
>
>_______________________________________________
>unionfs mailing list
>unionfs at mail.fsl.cs.sunysb.edu
>http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs
>
>
>
>
Hello,
If you want to use UnionFS with 2.6.16 your best bet is to pick the
current cvs snapshot and go with that. We shifted our locks to mutexes
and we have done a decent amount of testing to make sure its working
properly.
Dave Quigley
More information about the unionfs
mailing list