Hi *,
for those, who cannot live at the kernel edge right now, find Jan's
revised mutex compatibility patch attached. Junjiro's first
dir-permission-bits fix needs adjustment, too, but I will leave that
one to the inclined reader..
Jeff, how about installing unionimap.8, now that it exists?
Will test the current stuff tomorrow. Let's see, how far it goes in my
SUSE 9.3 based diskless environment..
Junjiro, I love your contributions. It would be fantastic to add a tad
more verbose descriptions to your patches, though. There are also some
(mostly) vfs agnostic people (like me) in the audience..
Keep up the great work, folks && have a nice weekend..
Pete
--- copyup.c~ 2006-01-27 22:09:21.198256000 +0100
+++ copyup.c 2006-01-27 22:20:11.848256000 +0100
@@ -64,7 +64,7 @@ static int copyup_xattrs(struct dentry *
name_list_orig = name_list;
while (*name_list) {
ssize_t size;
- mutex_lock(&old_hidden_dentry->d_inode->i_mutex);
+ LOCK_INODE(old_hidden_dentry->d_inode);
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);
- mutex_unlock(&old_hidden_dentry->d_inode->i_mutex);
+ UNLOCK_INODE(old_hidden_dentry->d_inode);
if (size < 0) {
err = size;
goto out;
@@ -84,7 +84,7 @@ static int copyup_xattrs(struct dentry *
goto out;
}
- mutex_lock(&new_hidden_dentry->d_inode->i_mutex);
+ LOCK_INODE(new_hidden_dentry->d_inode);
err =
security_inode_setxattr(old_hidden_dentry, name_list,
@@ -101,7 +101,7 @@ static int copyup_xattrs(struct dentry *
attr_value, size,
0);
}
- mutex_unlock(&new_hidden_dentry->d_inode->i_mutex);
+ UNLOCK_INODE(new_hidden_dentry->d_inode);
if (err < 0)
goto out;
--- dentry.c~ 2006-01-27 22:09:21.198256000 +0100
+++ dentry.c 2006-01-27 22:20:11.848256000 +0100
@@ -108,7 +108,7 @@ int unionfs_d_revalidate(struct dentry *
interpose_flag = INTERPOSE_REVAL_NEG;
if (positive) {
interpose_flag = INTERPOSE_REVAL;
- mutex_lock(&dentry->d_inode->i_mutex);
+ LOCK_INODE(dentry->d_inode);
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;
- mutex_unlock(&dentry->d_inode->i_mutex);
+ UNLOCK_INODE(dentry->d_inode);
}
result =
--- dirhelper.c~ 2006-03-03 20:03:20.976184171 +0100
+++ dirhelper.c 2006-03-03 20:07:38.448426282 +0100
@@ -64,7 +64,7 @@
p = name + WHLEN;
err = 0;
- mutex_lock(&hidden_dir->i_mutex);
+ LOCK_INODE(hidden_dir);
do_superio = permission(hidden_dir, MAY_WRITE | MAY_EXEC, NULL);
if (do_superio)
superio_store(&sio);
@@ -93,7 +93,7 @@
break;
}
}
- mutex_unlock(&hidden_dir->i_mutex);
+ UNLOCK_INODE(hidden_dir);
if (do_superio)
superio_revert(&sio);
--- file.c~ 2006-01-27 22:09:21.208256000 +0100
+++ file.c 2006-01-27 22:20:11.858256000 +0100
@@ -264,10 +264,10 @@ static int unionfs_fsync(struct file *fi
if (!hidden_file->f_op || !hidden_file->f_op->fsync)
goto out;
- mutex_lock(&hidden_file->f_dentry->d_inode->i_mutex);
+ LOCK_INODE(hidden_file->f_dentry->d_inode);
err = hidden_file->f_op->fsync(hidden_file, hidden_file->f_dentry,
datasync);
- mutex_unlock(&hidden_file->f_dentry->d_inode->i_mutex);
+ UNLOCK_INODE(hidden_file->f_dentry->d_inode);
out:
print_exit_status(err);
--- inode.c.orig 2006-03-03 21:49:57.947252503 +0100
+++ inode.c 2006-03-03 21:51:36.924704989 +0100
@@ -81,7 +81,7 @@
struct dentry *hidden_dir_dentry;
struct iattr newattrs;
- mutex_lock(&whiteout_dentry->d_inode->i_mutex);
+ LOCK_INODE(whiteout_dentry->d_inode);
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 @@
err = notify_change(whiteout_dentry, &newattrs);
- mutex_unlock(&whiteout_dentry->d_inode->i_mutex);
+ UNLOCK_INODE(whiteout_dentry->d_inode);
if (err)
printk(KERN_WARNING
@@ -594,10 +594,10 @@
err = PTR_ERR(whiteout_dentry);
goto out;
}
- mutex_lock(&hidden_dentry->d_inode->i_mutex);
+ LOCK_INODE(hidden_dentry->d_inode);
err = vfs_create(hidden_dentry->d_inode,
whiteout_dentry, 0600, NULL);
- mutex_unlock(&hidden_dentry->d_inode->i_mutex);
+ UNLOCK_INODE(hidden_dentry->d_inode);
DPUT(whiteout_dentry);
if (err) {
--- main.c~ 2006-01-27 22:09:21.208256000 +0100
+++ main.c 2006-01-27 22:20:11.858256000 +0100
@@ -99,7 +99,7 @@ int unionfs_interpose(struct dentry *den
}
}
- mutex_lock(&inode->i_mutex);
+ LOCK_INODE(inode);
if (atomic_read(&inode->i_count) > 1)
goto skip;
@@ -168,7 +168,7 @@ int unionfs_interpose(struct dentry *den
fist_print_dentry("Leaving unionfs_interpose", dentry);
fist_print_inode("Leaving unionfs_interpose", inode);
- mutex_unlock(&inode->i_mutex);
+ UNLOCK_INODE(inode);
out:
print_exit_status(err);
--- persistent_inode.c~ 2006-01-27 22:09:21.208256000 +0100
+++ persistent_inode.c 2006-01-27 22:20:11.858256000 +0100
@@ -554,11 +554,19 @@ ino_t get_uin(struct super_block * sb, u
* create a new entry write it out to the file and return its index
*/
*uino = spd->usi_next_avail++;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16)
mutex_lock(&sb->s_lock);
+#else
+ down(&sb->s_lock);
+#endif
err = __write_uin(spd, *uino, branchnum, inode_number);
if (err)
spd->usi_next_avail--;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16)
mutex_unlock(&sb->s_lock);
+#else
+ up(&sb->s_lock);
+#endif
out:
print_exit_status(err);
return err;
--- unionfs.h~ 2006-01-27 22:09:21.208256000 +0100
+++ unionfs.h 2006-01-27 22:19:33.478256000 +0100
@@ -297,6 +297,14 @@ void record_set(struct dentry *upper, in
# define GET_PARENT(d) dget_parent(d)
#endif /* not FIST_MALLOC_DEBUG */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16)
+# define LOCK_INODE(inode) mutex_lock(&(inode)->i_mutex)
+# define UNLOCK_INODE(inode) mutex_unlock(&(inode)->i_mutex)
+#else
+# define LOCK_INODE(inode) down(&(inode)->i_sem)
+# define UNLOCK_INODE(inode) up(&(inode)->i_sem)
+#endif
+
/* We can only use 32-bits of offset for rdstate --- blech! */
#define DIREOF (0xfffff)
#define RDOFFBITS 20 /* This is the number of bits in DIREOF. */
@@ -812,13 +820,13 @@ static inline struct dentry *lock_parent
{
struct dentry *dir = DGET(dentry->d_parent);
- mutex_lock(&dir->d_inode->i_mutex);
+ LOCK_INODE(dir->d_inode);
return dir;
}
static inline void unlock_dir(struct dentry *dir)
{
- mutex_unlock(&dir->d_inode->i_mutex);
+ UNLOCK_INODE(dir->d_inode);
DPUT(dir);
}
--- xattr.c~ 2006-01-27 22:09:21.208256000 +0100
+++ xattr.c 2006-01-27 22:20:11.868256000 +0100
@@ -77,14 +77,14 @@ ssize_t unionfs_getxattr(struct dentry *
encoded_value = (char *)value;
- mutex_lock(&hidden_dentry->d_inode->i_mutex);
+ LOCK_INODE(hidden_dentry->d_inode);
/* 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. */
- mutex_unlock(&hidden_dentry->d_inode->i_mutex);
+ UNLOCK_INODE(hidden_dentry->d_inode);
}
@@ -112,12 +112,12 @@ unionfs_setxattr(struct dentry *dentry,
name, (unsigned long)size, flags);
if (hidden_dentry->d_inode->i_op->setxattr) {
- mutex_lock(&hidden_dentry->d_inode->i_mutex);
+ LOCK_INODE(hidden_dentry->d_inode);
/* 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. */
- mutex_unlock(&hidden_dentry->d_inode->i_mutex);
+ UNLOCK_INODE(hidden_dentry->d_inode);
}
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;
- mutex_lock(&hidden_dentry->d_inode->i_mutex);
+ LOCK_INODE(hidden_dentry->d_inode);
/* 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. */
- mutex_unlock(&hidden_dentry->d_inode->i_mutex);
+ UNLOCK_INODE(hidden_dentry->d_inode);
}
unlock_dentry(dentry);
@@ -173,13 +173,13 @@ ssize_t unionfs_listxattr(struct dentry
if (hidden_dentry->d_inode->i_op->listxattr) {
encoded_list = list;
- mutex_lock(&hidden_dentry->d_inode->i_mutex);
+ LOCK_INODE(hidden_dentry->d_inode);
/* 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. */
- mutex_unlock(&hidden_dentry->d_inode->i_mutex);
+ UNLOCK_INODE(hidden_dentry->d_inode);
}
unlock_dentry(dentry);
--- lookup.c~ 2006-02-21 09:41:26.000000000 +0100
+++ lookup.c 2006-03-03 21:11:44.920047837 +0100
@@ -346,7 +346,7 @@
BUG_ON(!S_ISDIR(hidden_inode->i_mode));
- mutex_lock(&hidden_inode->i_mutex);
+ LOCK_INODE(hidden_inode);
do_superio = permission(hidden_inode, MAY_EXEC, NULL);
if (do_superio)
superio_store(&sio);
@@ -354,7 +354,7 @@
sizeof(UNIONFS_DIR_OPAQUE) - 1);
if (do_superio)
superio_revert(&sio);
- mutex_unlock(&hidden_inode->i_mutex);
+ UNLOCK_INODE(hidden_inode);
if (IS_ERR(wh_hidden_dentry)) {
err = PTR_ERR(wh_hidden_dentry);
fist_dprint(1, "LOOKUP_ONE_LEN returned: %d\n", err);
_______________________________________________
unionfs mailing list
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs