Msg13024.html
From Linix VServer
Jump to navigationJump to search
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Vserver] UnionFS and VServer[edit]
- From: Andreas Baetz
- Date: Tue, 18 Apr 2006 09:34:29 +0200 (CEST)
On Monday 17 April 2006 16:18, Sebastian Harl wrote: > Hi there, > > I was trying to compile UnionFS with a 2.6.16-vs2.0.2-rc16 Kernel. It failed > because some (all?) vfs_* functions' signatures changed when applying the > VServer patch. The patch added an additional argument of type 'struct > nameidata *'. > > What is a clean way to resolve this problem? Ideally, unionfs should compile > with a vanilla or a "vserver-kernel". Is there any define I can check to see, > if the VServer patch has been applied? What would be the correct thing to pass > to the vfs_* functions? > > Cheers, > Sebastian I have put together a patch that works with unionfs 1.1.3, plain kernel 2.6.16.1and vserver 2.02-rc14. It works for me for a while now, but that is no guarantee that it will work for you .. It should be no big problem to adopt it to the newest releases, but I didn't do it yet. Andreas
diff -ur unionfs-1.1.3/Makefile unionfs-1.1.3.new/Makefile
--- unionfs-1.1.3/Makefile 2006-02-20 23:47:06.000000000 +0100
+++ unionfs-1.1.3.new/Makefile 2006-03-14 08:31:44.000000000 +0100
@@ -38,7 +38,8 @@
dirhelper.o rename.o unlink.o lookup.o persistent_inode.o \
commonfops.o dirfops.o print.o malloc_debug.o
-BINS := unionctl uniondbg unionimap
+#BINS := unionctl uniondbg unionimap
+BINS := unionctl uniondbg
all: readthereadme unionfs.ko ${BINS}
@@ -91,7 +92,7 @@
mkdir -p ${PREFIX}/sbin
cp unionctl ${PREFIX}/sbin
cp uniondbg ${PREFIX}/sbin
- cp unionimap ${PREFIX}/sbin
+# cp unionimap ${PREFIX}/sbin
mkdir -p ${MANDIR}/man4
mkdir -p ${MANDIR}/man8
cp man/unionfs.4 ${MANDIR}/man4
diff -ur unionfs-1.1.3/commonfops.c unionfs-1.1.3.new/commonfops.c
--- unionfs-1.1.3/commonfops.c 2006-02-20 23:47:06.000000000 +0100
+++ unionfs-1.1.3.new/commonfops.c 2006-03-14 08:12:13.000000000 +0100
@@ -148,7 +148,7 @@
/* bring it to the same state as an unlinked file */
hidden_dentry = dtohd_index(dentry, dbstart(dentry));
hidden_dir_dentry = lock_parent(hidden_dentry);
- err = vfs_unlink(hidden_dir_dentry->d_inode, hidden_dentry);
+ err = vfs_unlink(hidden_dir_dentry->d_inode, hidden_dentry,NULL);
unlock_dir(hidden_dir_dentry);
out:
diff -ur unionfs-1.1.3/copyup.c unionfs-1.1.3.new/copyup.c
--- unionfs-1.1.3/copyup.c 2006-02-20 23:47:06.000000000 +0100
+++ unionfs-1.1.3.new/copyup.c 2006-03-29 08:55:10.000000000 +0200
@@ -64,7 +64,7 @@
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 @@
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 @@
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 @@
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;
@@ -252,10 +252,10 @@
current->fsgid = new_hidden_parent_dentry->d_inode->i_gid;
if (S_ISDIR(old_hidden_dentry->d_inode->i_mode)) {
err = vfs_mkdir(new_hidden_parent_dentry->d_inode,
- new_hidden_dentry, S_IRWXU);
+ new_hidden_dentry, S_IRWXU,NULL);
} else if (S_ISLNK(old_hidden_dentry->d_inode->i_mode)) {
err = vfs_symlink(new_hidden_parent_dentry->d_inode,
- new_hidden_dentry, symbuf, S_IRWXU);
+ new_hidden_dentry, symbuf, S_IRWXU,NULL);
} else if (S_ISBLK(old_hidden_dentry->d_inode->i_mode)
|| S_ISCHR(old_hidden_dentry->d_inode->i_mode)
|| S_ISFIFO(old_hidden_dentry->d_inode->i_mode)
@@ -263,7 +263,7 @@
err = vfs_mknod(new_hidden_parent_dentry->d_inode,
new_hidden_dentry,
old_hidden_dentry->d_inode->i_mode,
- old_hidden_dentry->d_inode->i_rdev);
+ old_hidden_dentry->d_inode->i_rdev,NULL);
} else if (S_ISREG(old_hidden_dentry->d_inode->i_mode)) {
err = vfs_create(new_hidden_parent_dentry->d_inode,
new_hidden_dentry, S_IRWXU, NULL);
@@ -378,7 +378,7 @@
* or something else happened so let's unlink; we don't
* really care about the return value of vfs_unlink */
vfs_unlink(new_hidden_parent_dentry->d_inode,
- new_hidden_dentry);
+ new_hidden_dentry,NULL);
goto out_dir;
}
@@ -684,7 +684,7 @@
current->fsuid = hidden_parent_dentry->d_inode->i_uid;
current->fsgid = hidden_parent_dentry->d_inode->i_gid;
err = vfs_mkdir(hidden_parent_dentry->d_inode,
- hidden_dentry, S_IRWXUGO);
+ hidden_dentry, S_IRWXUGO,NULL);
current->fsuid = saved_uid;
current->fsgid = saved_gid;
if (!err)
diff -ur unionfs-1.1.3/dentry.c unionfs-1.1.3.new/dentry.c
--- unionfs-1.1.3/dentry.c 2006-02-20 23:47:06.000000000 +0100
+++ unionfs-1.1.3.new/dentry.c 2006-03-29 08:55:10.000000000 +0200
@@ -108,7 +108,7 @@
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 @@
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 -ur unionfs-1.1.3/dirhelper.c unionfs-1.1.3.new/dirhelper.c
--- unionfs-1.1.3/dirhelper.c 2006-02-20 23:47:06.000000000 +0100
+++ unionfs-1.1.3.new/dirhelper.c 2006-03-29 08:55:10.000000000 +0200
@@ -78,11 +78,11 @@
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);
+ hidden_dentry,NULL);
+ mutex_unlock(&hidden_dir_dentry->d_inode->i_mutex);
DPUT(hidden_dentry);
if (err && !IS_COPYUP_ERR(err))
diff -ur unionfs-1.1.3/file.c unionfs-1.1.3.new/file.c
--- unionfs-1.1.3/file.c 2006-02-20 23:47:06.000000000 +0100
+++ unionfs-1.1.3.new/file.c 2006-03-29 08:55:10.000000000 +0200
@@ -264,10 +264,10 @@
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 -ur unionfs-1.1.3/inode.c unionfs-1.1.3.new/inode.c
--- unionfs-1.1.3/inode.c 2006-02-20 23:47:06.000000000 +0100
+++ unionfs-1.1.3.new/inode.c 2006-03-29 08:57:22.000000000 +0200
@@ -81,7 +81,7 @@
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 @@
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
@@ -261,7 +261,7 @@
dbstart(new_dentry)))) {
err =
vfs_unlink(hidden_dir_dentry->d_inode,
- whiteout_dentry);
+ whiteout_dentry,NULL);
}
fist_copy_attr_times(dir, hidden_dir_dentry->d_inode);
dir->i_nlink = get_nlinks(dir);
@@ -289,7 +289,7 @@
if (!(err = is_robranch(old_dentry)))
err =
vfs_link(hidden_old_dentry, hidden_dir_dentry->d_inode,
- hidden_new_dentry);
+ hidden_new_dentry,NULL);
unlock_dir(hidden_dir_dentry);
docopyup:
@@ -313,7 +313,7 @@
err =
vfs_link(hidden_old_dentry,
hidden_dir_dentry->d_inode,
- hidden_new_dentry);
+ hidden_new_dentry,NULL);
unlock_dir(hidden_dir_dentry);
goto check_link;
}
@@ -392,7 +392,7 @@
if (!(err = is_robranch_super(dentry->d_sb, bstart))) {
err =
vfs_unlink(hidden_dir_dentry->d_inode,
- whiteout_dentry);
+ whiteout_dentry,NULL);
}
DPUT(whiteout_dentry);
@@ -438,7 +438,7 @@
mode = S_IALLUGO;
err =
vfs_symlink(hidden_dir_dentry->d_inode,
- hidden_dentry, symname, mode);
+ hidden_dentry, symname, mode,NULL);
}
unlock_dir(hidden_dir_dentry);
@@ -517,7 +517,7 @@
if (!(err = is_robranch_super(dentry->d_sb, bstart))) {
err =
vfs_unlink(hidden_parent_dentry->d_inode,
- whiteout_dentry);
+ whiteout_dentry,NULL);
}
DPUT(whiteout_dentry);
@@ -556,7 +556,7 @@
if (!(err = is_robranch_super(dentry->d_sb, bindex))) {
err =
vfs_mkdir(hidden_parent_dentry->d_inode,
- hidden_dentry, mode);
+ hidden_dentry, mode,NULL);
}
unlock_dir(hidden_parent_dentry);
@@ -594,10 +594,10 @@
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) {
@@ -664,7 +664,7 @@
//found a.wh.foo entry, remove it then do vfs_mkdir
if (!(err = is_robranch_super(dentry->d_sb, bstart)))
err = vfs_unlink(hidden_parent_dentry->d_inode,
- whiteout_dentry);
+ whiteout_dentry,NULL);
DPUT(whiteout_dentry);
unlock_dir(hidden_parent_dentry);
@@ -698,7 +698,7 @@
}
if (!(err = is_robranch_super(dentry->d_sb, bindex))) {
err = vfs_mknod(hidden_parent_dentry->d_inode,
- hidden_dentry, mode, dev);
+ hidden_dentry, mode, dev,NULL);
}
/* XXX this could potentially return a negative hidden_dentry! */
if (err || !hidden_dentry->d_inode) {
diff -ur unionfs-1.1.3/main.c unionfs-1.1.3.new/main.c
--- unionfs-1.1.3/main.c 2006-02-20 23:47:06.000000000 +0100
+++ unionfs-1.1.3.new/main.c 2006-03-29 08:55:10.000000000 +0200
@@ -103,7 +103,7 @@
}
}
- down(&inode->i_sem);
+ mutex_lock(&inode->i_mutex);
if (atomic_read(&inode->i_count) > 1)
goto skip;
@@ -172,7 +172,7 @@
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);
Only in unionfs-1.1.3.new/: mutex-unionfs.diff-0001.diff
diff -ur unionfs-1.1.3/persistent_inode.c unionfs-1.1.3.new/persistent_inode.c
--- unionfs-1.1.3/persistent_inode.c 2006-02-20 23:47:06.000000000 +0100
+++ unionfs-1.1.3.new/persistent_inode.c 2006-03-29 08:55:10.000000000 +0200
@@ -554,11 +554,11 @@
* create a new entry write it out to the file and return its index
*/
*uino = spd->usi_next_avail++;
- down(&sb->s_lock);
+ mutex_lock(&sb->s_lock);
err = __write_uin(spd, *uino, branchnum, inode_number);
if (err)
spd->usi_next_avail--;
- up(&sb->s_lock);
+ mutex_unlock(&sb->s_lock);
out:
print_exit_status(err);
return err;
diff -ur unionfs-1.1.3/rename.c unionfs-1.1.3.new/rename.c
--- unionfs-1.1.3/rename.c 2006-02-20 23:47:06.000000000 +0100
+++ unionfs-1.1.3.new/rename.c 2006-03-14 07:43:33.000000000 +0100
@@ -85,7 +85,7 @@
if (!(err = is_robranch_super(old_dentry->d_sb, bindex))) {
err =
vfs_unlink(hidden_wh_dir_dentry->d_inode,
- hidden_wh_dentry);
+ hidden_wh_dentry,NULL);
}
DPUT(hidden_wh_dentry);
unlock_dir(hidden_wh_dir_dentry);
@@ -187,7 +187,7 @@
if (!(err = is_robranch_super(old_dir->i_sb, bindex))) {
err =
vfs_unlink(unlink_dir_dentry->d_inode,
- unlink_dentry);
+ unlink_dentry,NULL);
}
fist_copy_attr_times(new_dentry->d_parent->d_inode,
@@ -408,7 +408,7 @@
if (!(err = is_robranch_super(old_dir->i_sb, bindex)))
err =
vfs_unlink(unlink_dir_dentry->d_inode,
- unlink_dentry);
+ unlink_dentry,NULL);
fist_copy_attr_times(new_dentry->d_parent->d_inode,
unlink_dir_dentry->d_inode);
@@ -553,7 +553,7 @@
unlink_dir_dentry = lock_parent(unlink_dentry);
if (!(err = is_robranch_super(old_dir->i_sb, info->new_bstart)))
err = vfs_unlink(unlink_dir_dentry->d_inode,
- unlink_dentry);
+ unlink_dentry,NULL);
fist_copy_attr_times(new_dentry->d_parent->d_inode,
unlink_dir_dentry->d_inode);
diff -ur unionfs-1.1.3/subr.c unionfs-1.1.3.new/subr.c
--- unionfs-1.1.3/subr.c 2006-02-20 23:47:06.000000000 +0100
+++ unionfs-1.1.3.new/subr.c 2006-03-14 07:31:29.000000000 +0100
@@ -175,7 +175,7 @@
err =
vfs_mkdir(hidden_grand_parent_dentry->
d_inode, hidden_parent_dentry,
- S_IRWXU);
+ S_IRWXU,NULL);
unlock_dir(hidden_grand_parent_dentry);
if (err || !hidden_parent_dentry->d_inode) {
diff -ur unionfs-1.1.3/unionfs.h unionfs-1.1.3.new/unionfs.h
--- unionfs-1.1.3/unionfs.h 2006-02-20 23:47:06.000000000 +0100
+++ unionfs-1.1.3.new/unionfs.h 2006-03-29 08:55:10.000000000 +0200
@@ -776,13 +776,13 @@
{
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 -ur unionfs-1.1.3/unlink.c unionfs-1.1.3.new/unlink.c
--- unionfs-1.1.3/unlink.c 2006-02-20 23:47:06.000000000 +0100
+++ unionfs-1.1.3.new/unlink.c 2006-03-14 08:11:21.000000000 +0100
@@ -49,7 +49,7 @@
DGET(hidden_dentry);
if (!(err = is_robranch_super(dentry->d_sb, bindex)))
err = vfs_unlink(hidden_dir_dentry->d_inode,
- hidden_dentry);
+ hidden_dentry,NULL);
DPUT(hidden_dentry);
fist_copy_attr_times(dir, hidden_dir_dentry->d_inode);
unlock_dir(hidden_dir_dentry);
@@ -117,7 +117,7 @@
/* avoid destroying the hidden inode if the file is in use */
DGET(hidden_dentry);
if (!(err = is_robranch_super(dentry->d_sb, bindex)))
- err = vfs_unlink(hidden_dir_dentry->d_inode, hidden_dentry);
+ err = vfs_unlink(hidden_dir_dentry->d_inode, hidden_dentry,NULL);
DPUT(hidden_dentry);
fist_copy_attr_times(dir, hidden_dir_dentry->d_inode);
unlock_dir(hidden_dir_dentry);
@@ -200,7 +200,7 @@
/* avoid destroying the hidden inode if the file is in use */
DGET(hidden_dentry);
if (!(err = is_robranch(dentry))) {
- err = vfs_rmdir(hidden_dir_dentry->d_inode, hidden_dentry);
+ err = vfs_rmdir(hidden_dir_dentry->d_inode, hidden_dentry,NULL);
}
DPUT(hidden_dentry);
@@ -244,7 +244,7 @@
if (!(err = is_robranch_super(dentry->d_sb, bindex))) {
err =
vfs_rmdir(hidden_dir_dentry->d_inode,
- hidden_dentry);
+ hidden_dentry,NULL);
}
} else {
err = -EISDIR;
diff -ur unionfs-1.1.3/xattr.c unionfs-1.1.3.new/xattr.c
--- unionfs-1.1.3/xattr.c 2006-02-20 23:47:06.000000000 +0100
+++ unionfs-1.1.3.new/xattr.c 2006-03-29 08:55:10.000000000 +0200
@@ -51,7 +51,7 @@
}
/* BKL held by caller.
- * dentry->d_inode->i_sem down
+ * dentry->d_inode->i_mutex locked
* ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
*/
ssize_t unionfs_getxattr(struct dentry *dentry, const char *name, void *value,
@@ -77,14 +77,14 @@
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);
}
@@ -94,7 +94,7 @@
}
/* BKL held by caller.
- * dentry->d_inode->i_sem down
+ * dentry->d_inode->i_mutex locked
*/
int
unionfs_setxattr(struct dentry *dentry, const char *name, const void *value,
@@ -112,12 +112,12 @@
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);
@@ -126,7 +126,7 @@
}
/* BKL held by caller.
- * dentry->d_inode->i_sem down
+ * dentry->d_inode->i_mutex locked
*/
int unionfs_removexattr(struct dentry *dentry, const char *name)
{
@@ -143,13 +143,13 @@
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);
@@ -158,7 +158,7 @@
}
/* BKL held by caller.
- * dentry->d_inode->i_sem down
+ * dentry->d_inode->i_mutex locked
*/
ssize_t unionfs_listxattr(struct dentry * dentry, char *list, size_t size)
{
@@ -173,13 +173,13 @@
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);
- References:
- [Vserver] UnionFS and VServer
- From: Sebastian Harl
- [Vserver] UnionFS and VServer
- Prev by Date: Re: [Vserver] UnionFS and VServer
- Next by Date: [Vserver] VMWare-Server and vserver
- Previous by thread: Re: [Vserver] UnionFS and VServer
- Next by thread: [Vserver] switching from gentoo style to plain
- Index(es):