From patchwork Mon Oct 25 17:46:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 69122 X-Patchwork-Delegate: apw@canonical.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 31C60B6F14 for ; Tue, 26 Oct 2010 04:46:45 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1PAR7v-0000aw-Rc; Mon, 25 Oct 2010 18:46:31 +0100 Received: from mail.candelatech.com ([208.74.158.172] helo=ns3.lanforge.com) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1PAR7s-0000aR-Oz for kernel-team@lists.ubuntu.com; Mon, 25 Oct 2010 18:46:29 +0100 Received: from [192.168.100.195] (firewall.candelatech.com [70.89.124.249]) (authenticated bits=0) by ns3.lanforge.com (8.14.2/8.14.2) with ESMTP id o9PHkQFu025990 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 25 Oct 2010 10:46:26 -0700 Message-ID: <4CC5C272.1040008@candelatech.com> Date: Mon, 25 Oct 2010 10:46:26 -0700 From: Ben Greear Organization: Candela Technologies User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc11 Thunderbird/3.0.4 MIME-Version: 1.0 To: kernel-team@lists.ubuntu.com Subject: Re: Patches for aufs for 2.6.36 kernel. References: <4CC5B3EF.4030603@candelatech.com> In-Reply-To: <4CC5B3EF.4030603@candelatech.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com 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 Signed-off-by: Ben Greear 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 #include #include -#include #include #include #include @@ -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 #include #include +#include /* * 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 #include +#include +#include #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\n", bindex, err); continue;