@@ -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;
@@ -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
@@ -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)
{
@@ -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
@@ -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)
{
@@ -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 */
@@ -515,6 +515,7 @@ found:
return -EPERM;
}
+EXPORT_SYMBOL(devcgroup_inode_permission);
int devcgroup_inode_mknod(int mode, dev_t dev)
{
@@ -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)
@@ -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/
@@ -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)
@@ -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:
@@ -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;
@@ -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);
@@ -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)
@@ -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);
@@ -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;