Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Ubuntu Kernel Team (http://www.linux-archive.org/ubuntu-kernel-team/)
-   -   Patches for aufs for 2.6.36 kernel. (http://www.linux-archive.org/ubuntu-kernel-team/444053-patches-aufs-2-6-36-kernel.html)

Ben Greear 10-25-2010 04:44 PM

Patches for aufs for 2.6.36 kernel.
 
I have some patches that allows aufs to compile (still working on remastering
the live-cd to see if it actually boots & works OK).

Are these worth posting, or is someone already working on this?

Thanks,
Ben

--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team

Ben Greear 10-25-2010 05:46 PM

Patches for aufs for 2.6.36 kernel.
 
On 10/25/2010 09:44 AM, Ben Greear wrote:

I have some patches that allows aufs to compile (still working on remastering
the live-cd to see if it actually boots& works OK).

Are these worth posting, or is someone already working on this?

Thanks,
Ben



Well, I got something to boot, but kernel crashes soon after, and I'm
not sure why (any easy way to get a serial-console working on a live
cd running in a virtual machine??).

I'll look into the other aufs patches posted recently in case those
work better.

Since someone asked, I'm attaching the patch I'm using.

Thanks,
Ben

--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com

diff --git a/fs/file_table.c b/fs/file_table.c
index a04bdd8..fbf8908 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -20,7 +20,6 @@
#include <linux/cdev.h>
#include <linux/fsnotify.h>
#include <linux/sysctl.h>
-#include <linux/lglock.h>
#include <linux/percpu_counter.h>
#include <linux/percpu.h>
#include <linux/ima.h>
@@ -34,7 +33,6 @@ struct files_stat_struct files_stat = {
.max_files = NR_FILE
};

-DECLARE_LGLOCK(files_lglock);
DEFINE_LGLOCK(files_lglock);

/* SLAB cache for file structures */
@@ -394,37 +392,6 @@ void file_sb_list_del(struct file *file)
}
}

-#ifdef CONFIG_SMP
-
-/*
- * These macros iterate all files on all CPUs for a given superblock.
- * files_lglock must be held globally.
- */
-#define do_file_list_for_each_entry(__sb, __file)
-{
- int i;
- for_each_possible_cpu(i) {
- struct list_head *list;
- list = per_cpu_ptr((__sb)->s_files, i);
- list_for_each_entry((__file), list, f_u.fu_list)
-
-#define while_file_list_for_each_entry
- }
-}
-
-#else
-
-#define do_file_list_for_each_entry(__sb, __file)
-{
- struct list_head *list;
- list = &(sb)->s_files;
- list_for_each_entry((__file), list, f_u.fu_list)
-
-#define while_file_list_for_each_entry
-}
-
-#endif
-
int fs_may_remount_ro(struct super_block *sb)
{
struct file *file;
diff --git a/fs/namei.c b/fs/namei.c
index 19d69c5..944842e 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -347,6 +347,7 @@ int deny_write_access(struct file * file)

return 0;
}
+EXPORT_SYMBOL(deny_write_access);

/**
* path_get - get a reference to a path
@@ -1168,6 +1169,7 @@ struct dentry *lookup_hash(struct nameidata *nd)
return ERR_PTR(err);
return __lookup_hash(&nd->last, nd->path.dentry, nd);
}
+EXPORT_SYMBOL(lookup_hash);

int __lookup_one_len(const char *name, struct qstr *this,
struct dentry *base, int len)
@@ -1190,6 +1192,7 @@ int __lookup_one_len(const char *name, struct qstr *this,
this->hash = end_name_hash(hash);
return 0;
}
+EXPORT_SYMBOL(__lookup_one_len);

/**
* lookup_one_len - filesystem helper to lookup single pathname component
diff --git a/fs/open.c b/fs/open.c
index ddd5fbc..b4cdc5f 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -63,6 +63,7 @@ int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
mutex_unlock(&dentry->d_inode->i_mutex);
return ret;
}
+EXPORT_SYMBOL(do_truncate);

static long do_sys_truncate(const char __user *pathname, loff_t length)
{
diff --git a/fs/splice.c b/fs/splice.c
index 278c94f..033f7ac 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -1116,6 +1116,7 @@ long do_splice_from(struct pipe_inode_info *pipe, struct file *out,

return splice_write(pipe, out, ppos, len, flags);
}
+EXPORT_SYMBOL(do_splice_from);

/*
* Attempt to initiate a splice from a file to a pipe.
@@ -1142,6 +1143,7 @@ long do_splice_to(struct file *in, loff_t *ppos,

return splice_read(in, ppos, pipe, len, flags);
}
+EXPORT_SYMBOL(do_splice_to);

/**
* splice_direct_to_actor - splices data directly between two non-pipes
diff --git a/fs/statfs.c b/fs/statfs.c
index 30ea8c8..9025c98 100644
--- a/fs/statfs.c
+++ b/fs/statfs.c
@@ -61,6 +61,7 @@ int statfs_by_dentry(struct dentry *dentry, struct kstatfs *buf)
buf->f_frsize = buf->f_bsize;
return retval;
}
+EXPORT_SYMBOL(statfs_by_dentry);

int vfs_statfs(struct path *path, struct kstatfs *buf)
{
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 63d069b..741d296 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -9,6 +9,7 @@
#include <linux/limits.h>
#include <linux/ioctl.h>
#include <linux/blk_types.h>
+#include <linux/lglock.h>

/*
* It's silly to have NR_OPEN bigger than NR_FILE, but you can change
@@ -1814,6 +1815,7 @@ extern struct vfsmount *collect_mounts(struct path *);
extern void drop_collected_mounts(struct vfsmount *);
extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
struct vfsmount *);
+extern int statfs_by_dentry(struct dentry *dentry, struct kstatfs *buf);
extern int vfs_statfs(struct path *, struct kstatfs *);
extern int statfs_by_dentry(struct dentry *, struct kstatfs *);
extern int freeze_super(struct super_block *super);
@@ -2481,5 +2483,39 @@ int __init get_filesystem_list(char *buf);
#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) |
(flag & FMODE_NONOTIFY)))

+
+DECLARE_LGLOCK(files_lglock);
+
+#ifdef CONFIG_SMP
+
+/*
+ * These macros iterate all files on all CPUs for a given superblock.
+ * files_lglock must be held globally.
+ */
+#define do_file_list_for_each_entry(__sb, __file)
+{
+ int i;
+ for_each_possible_cpu(i) {
+ struct list_head *list;
+ list = per_cpu_ptr((__sb)->s_files, i);
+ list_for_each_entry((__file), list, f_u.fu_list)
+
+#define while_file_list_for_each_entry
+ }
+}
+
+#else
+
+#define do_file_list_for_each_entry(__sb, __file)
+{
+ struct list_head *list;
+ list = &(sb)->s_files;
+ list_for_each_entry((__file), list, f_u.fu_list)
+
+#define while_file_list_for_each_entry
+}
+
+#endif
+
#endif /* __KERNEL__ */
#endif /* _LINUX_FS_H */
diff --git a/security/device_cgroup.c b/security/device_cgroup.c
index 8d9c48f..29108aa 100644
--- a/security/device_cgroup.c
+++ b/security/device_cgroup.c
@@ -515,6 +515,7 @@ found:

return -EPERM;
}
+EXPORT_SYMBOL(devcgroup_inode_permission);

int devcgroup_inode_mknod(int mode, dev_t dev)
{
diff --git a/security/security.c b/security/security.c
index ca39940..4fea5eb 100644
--- a/security/security.c
+++ b/security/security.c
@@ -394,6 +394,7 @@ int security_path_mkdir(struct path *dir, struct dentry *dentry, int mode)
return 0;
return security_ops->path_mkdir(dir, dentry, mode);
}
+EXPORT_SYMBOL(security_path_mkdir);

int security_path_rmdir(struct path *dir, struct dentry *dentry)
{
@@ -401,6 +402,7 @@ int security_path_rmdir(struct path *dir, struct dentry *dentry)
return 0;
return security_ops->path_rmdir(dir, dentry);
}
+EXPORT_SYMBOL(security_path_rmdir);

int security_path_unlink(struct path *dir, struct dentry *dentry)
{
@@ -408,6 +410,7 @@ int security_path_unlink(struct path *dir, struct dentry *dentry)
return 0;
return security_ops->path_unlink(dir, dentry);
}
+EXPORT_SYMBOL(security_path_unlink);

int security_path_symlink(struct path *dir, struct dentry *dentry,
const char *old_name)
@@ -416,6 +419,7 @@ int security_path_symlink(struct path *dir, struct dentry *dentry,
return 0;
return security_ops->path_symlink(dir, dentry, old_name);
}
+EXPORT_SYMBOL(security_path_symlink);

int security_path_link(struct dentry *old_dentry, struct path *new_dir,
struct dentry *new_dentry)
@@ -429,6 +433,7 @@ int security_path_link(struct dentry *old_dentry, struct path *new_dir,
#endif
return security_ops->path_link(old_dentry, new_dir, new_dentry);
}
+EXPORT_SYMBOL(security_path_link);

int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
struct path *new_dir, struct dentry *new_dentry)
@@ -439,6 +444,7 @@ int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
return security_ops->path_rename(old_dir, old_dentry, new_dir,
new_dentry);
}
+EXPORT_SYMBOL(security_path_rename);

int security_path_truncate(struct path *path)
{
@@ -446,6 +452,7 @@ int security_path_truncate(struct path *path)
return 0;
return security_ops->path_truncate(path);
}
+EXPORT_SYMBOL(security_path_truncate);

int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt,
mode_t mode)
@@ -454,6 +461,7 @@ int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt,
return 0;
return security_ops->path_chmod(dentry, mnt, mode);
}
+EXPORT_SYMBOL(security_path_chmod);

int security_path_chown(struct path *path, uid_t uid, gid_t gid)
{
@@ -461,6 +469,7 @@ int security_path_chown(struct path *path, uid_t uid, gid_t gid)
return 0;
return security_ops->path_chown(path, uid, gid);
}
+EXPORT_SYMBOL(security_path_chown);

int security_path_chroot(struct path *path)
{
@@ -537,6 +546,7 @@ int security_inode_readlink(struct dentry *dentry)
return 0;
return security_ops->inode_readlink(dentry);
}
+EXPORT_SYMBOL(security_inode_readlink);

int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd)
{
@@ -556,6 +566,7 @@ int security_inode_permission(struct inode *inode, int mask)
return 0;
return security_ops->inode_permission(inode, mask);
}
+EXPORT_SYMBOL(security_inode_permission);

int security_inode_setattr(struct dentry *dentry, struct iattr *attr)
{
@@ -655,6 +666,7 @@ int security_file_permission(struct file *file, int mask)

return fsnotify_perm(file, mask);
}
+EXPORT_SYMBOL(security_file_permission);

int security_file_alloc(struct file *file)
{
@@ -682,6 +694,7 @@ int security_file_mmap(struct file *file, unsigned long reqprot,
return ret;
return ima_file_mmap(file, prot);
}
+EXPORT_SYMBOL(security_file_mmap);

int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot,
unsigned long prot)
diff --git a/ubuntu/Makefile b/ubuntu/Makefile
index 4613269..30decc5 100644
--- a/ubuntu/Makefile
+++ b/ubuntu/Makefile
@@ -2,7 +2,7 @@
# Makefile for the Linux kernel ubuntu supplied third-party device drivers.
#

-#obj-$(CONFIG_AUFS_FS) += aufs/
+obj-$(CONFIG_AUFS_FS) += aufs/
obj-$(CONFIG_BLK_DEV_COMPCACHE) += compcache/
#obj-$(CONFIG_DM_RAID45) += dm-raid4-5/
obj-$(CONFIG_FSAM7400) += fsam7400/
diff --git a/ubuntu/aufs/branch.c b/ubuntu/aufs/branch.c
index cd4463c..ff6b158 100644
--- a/ubuntu/aufs/branch.c
+++ b/ubuntu/aufs/branch.c
@@ -22,6 +22,8 @@

#include <linux/file.h>
#include <linux/statfs.h>
+#include <linux/lglock.h>
+#include <linux/percpu.h>
#include "aufs.h"

/*
@@ -321,7 +323,7 @@ static int au_wbr_init(struct au_branch *br, struct super_block *sb,
* cf. AUFS_MAX_NAMELEN in include/linux/aufs_type.h
*/
h_dentry = path->dentry;
- err = vfs_statfs(h_dentry, &kst);
+ err = vfs_statfs(path, &kst);
if (unlikely(err))
goto out;
err = -EINVAL;
@@ -851,7 +853,8 @@ static int au_br_mod_files_ro(struct super_block *sb, aufs_bindex_t bindex)
goto out;

/* no need file_list_lock() since sbinfo is locked? defered? */
- list_for_each_entry(file, &sb->s_files, f_u.fu_list) {
+ lg_global_lock(files_lglock);
+ do_file_list_for_each_entry(sb, file) {
if (special_file(file->f_dentry->d_inode->i_mode))
continue;

@@ -861,6 +864,7 @@ static int au_br_mod_files_ro(struct super_block *sb, aufs_bindex_t bindex)
err = -EBUSY;
FiMustNoWaiters(file);
fi_read_unlock(file);
+ lg_global_unlock(files_lglock);
goto out_free;
}

@@ -889,10 +893,13 @@ static int au_br_mod_files_ro(struct super_block *sb, aufs_bindex_t bindex)
if (p) {
a = p;
a[n++] = hf;
- } else
+ } else {
+ lg_global_unlock(files_lglock);
goto out_free;
+ }
}
- }
+ } while_file_list_for_each_entry;
+ lg_global_unlock(files_lglock);

err = 0;
if (n)
diff --git a/ubuntu/aufs/file.c b/ubuntu/aufs/file.c
index 45bdca7..8b912d8 100644
--- a/ubuntu/aufs/file.c
+++ b/ubuntu/aufs/file.c
@@ -95,7 +95,7 @@ struct file *au_h_open(struct dentry *dentry, aufs_bindex_t bindex, int flags,
goto out_br;
}
}
- fsnotify_open(h_dentry);
+ fsnotify_open(h_file);
goto out; /* success */

out_br:
diff --git a/ubuntu/aufs/i_op.c b/ubuntu/aufs/i_op.c
index e9f0306..6c7f8a5 100644
--- a/ubuntu/aufs/i_op.c
+++ b/ubuntu/aufs/i_op.c
@@ -659,9 +659,7 @@ static int aufs_setattr(struct dentry *dentry, struct iattr *ia)

if (ia->ia_size < i_size_read(inode)) {
/* unmap only */
- err = simple_setsize(inode, ia->ia_size);
- if (unlikely(err))
- goto out_unlock;
+ truncate_setsize(inode, ia->ia_size);
}

f = NULL;
diff --git a/ubuntu/aufs/super.c b/ubuntu/aufs/super.c
index 5c1c823..5d6bb04 100644
--- a/ubuntu/aufs/super.c
+++ b/ubuntu/aufs/super.c
@@ -315,7 +315,7 @@ static int au_statfs_sum(struct super_block *sb, struct kstatfs *buf)
continue;

/* sb->s_root for NFS is unreliable */
- err = vfs_statfs(h_mnt->mnt_root, buf);
+ err = statfs_by_dentry(h_mnt->mnt_root, buf);
if (unlikely(err))
goto out;

@@ -346,7 +346,7 @@ static int aufs_statfs(struct dentry *dentry, struct kstatfs *buf)
si_noflush_read_lock(sb);
if (!au_opt_test(au_mntflags(sb), SUM))
/* sb->s_root for NFS is unreliable */
- err = vfs_statfs(au_sbr_mnt(sb, 0)->mnt_root, buf);
+ err = statfs_by_dentry(au_sbr_mnt(sb, 0)->mnt_root, buf);
else
err = au_statfs_sum(sb, buf);
si_read_unlock(sb);
diff --git a/ubuntu/aufs/sysfs.c b/ubuntu/aufs/sysfs.c
index f1bc6fc..32e6bef 100644
--- a/ubuntu/aufs/sysfs.c
+++ b/ubuntu/aufs/sysfs.c
@@ -203,7 +203,6 @@ void sysaufs_br_init(struct au_branch *br)
sysfs_attr_init(attr);
attr->name = br->br_name;
attr->mode = S_IRUGO;
- attr->owner = THIS_MODULE;
}

void sysaufs_brs_del(struct super_block *sb, aufs_bindex_t bindex)
diff --git a/ubuntu/aufs/vfsub.c b/ubuntu/aufs/vfsub.c
index 29e3390..190dbbd 100644
--- a/ubuntu/aufs/vfsub.c
+++ b/ubuntu/aufs/vfsub.c
@@ -573,7 +573,7 @@ int vfsub_trunc(struct path *h_path, loff_t length, unsigned int attr,

err = locks_verify_truncate(h_inode, h_file, length);
if (!err)
- err = security_path_truncate(h_path, length, attr);
+ err = security_path_truncate(h_path);
if (!err)
err = do_truncate(h_path->dentry, length, attr, h_file);

diff --git a/ubuntu/aufs/wbr_policy.c b/ubuntu/aufs/wbr_policy.c
index 19a1ba0..0353d7d 100644
--- a/ubuntu/aufs/wbr_policy.c
+++ b/ubuntu/aufs/wbr_policy.c
@@ -429,7 +429,7 @@ static void au_mfs(struct dentry *dentry)
continue;

/* sb->s_root for NFS is unreliable */
- err = vfs_statfs(br->br_mnt->mnt_root, st);
+ err = statfs_by_dentry(br->br_mnt->mnt_root, st);
if (unlikely(err)) {
AuWarn1("failed statfs, b%d, %d
", bindex, err);
continue;
--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team

Ben Greear 10-26-2010 03:55 AM

Patches for aufs for 2.6.36 kernel.
 
On 10/25/2010 10:46 AM, Ben Greear wrote:

On 10/25/2010 09:44 AM, Ben Greear wrote:

I have some patches that allows aufs to compile (still working on remastering
the live-cd to see if it actually boots& works OK).

Are these worth posting, or is someone already working on this?

Thanks,
Ben



Well, I got something to boot, but kernel crashes soon after, and I'm
not sure why (any easy way to get a serial-console working on a live
cd running in a virtual machine??).

I'll look into the other aufs patches posted recently in case those
work better.

Since someone asked, I'm attaching the patch I'm using.


My attempt didn't work too well, but I was able to get Jordi Pujol's
patches applied and they seem to work fine (remastered live-cd is
stable).

I'm attaching a single patch that should apply to the ubuntu-natty
2.6.36 tree and make aufs work. If anyone wants to apply this and/or
hack on it more, you have my:

Signed-off-by: Ben Greear <greearb@candelatech.com>

But, I don't have time to break up the patches and figure out how
to get it upstream....

Thanks,
Ben



Thanks,
Ben




--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team

Andy Whitcroft 10-29-2010 03:52 PM

Patches for aufs for 2.6.36 kernel.
 
On Mon, Oct 25, 2010 at 08:55:20PM -0700, Ben Greear wrote:
> On 10/25/2010 10:46 AM, Ben Greear wrote:
> >On 10/25/2010 09:44 AM, Ben Greear wrote:
> >>I have some patches that allows aufs to compile (still working on remastering
> >>the live-cd to see if it actually boots& works OK).
> >>
> >>Are these worth posting, or is someone already working on this?
> >>
> >>Thanks,
> >>Ben
> >>
> >
> >Well, I got something to boot, but kernel crashes soon after, and I'm
> >not sure why (any easy way to get a serial-console working on a live
> >cd running in a virtual machine??).
> >
> >I'll look into the other aufs patches posted recently in case those
> >work better.
> >
> >Since someone asked, I'm attaching the patch I'm using.
>
> My attempt didn't work too well, but I was able to get Jordi Pujol's
> patches applied and they seem to work fine (remastered live-cd is
> stable).
>
> I'm attaching a single patch that should apply to the ubuntu-natty
> 2.6.36 tree and make aufs work. If anyone wants to apply this and/or
> hack on it more, you have my:
>
> Signed-off-by: Ben Greear <greearb@candelatech.com>
>
> But, I don't have time to break up the patches and figure out how
> to get it upstream....
>
> Thanks,
> Ben

Thanks Ben. I'll have a look at this one and Jordi's patches and see
what we can do to get this cleaned up and re-enabled.

-apw

--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team


All times are GMT. The time now is 10:57 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.