Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -1880,6 +1880,19 @@ F: include/linux/audit.h
F: include/uapi/linux/audit.h
F: kernel/audit*

AUFS (advanced multi layered unification filesystem) FILESYSTEM
M: "J. R. Okajima" <hooanon05g@gmail.com>
L: linux-unionfs@vger.kernel.org
L: aufs-users@lists.sourceforge.net (members only)
W: http://aufs.sourceforge.net
T: git://github.com/sfjro/aufs4-linux.git
S: Supported
F: Documentation/filesystems/aufs/
F: Documentation/ABI/testing/debugfs-aufs
F: Documentation/ABI/testing/sysfs-aufs
F: fs/aufs/
F: include/uapi/linux/aufs_type.h

AUXILIARY DISPLAY DRIVERS
M: Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com>
W: http://miguelojeda.es/auxdisplay.htm
Expand Down
18 changes: 18 additions & 0 deletions drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,24 @@ static inline int is_loop_device(struct file *file)
return i && S_ISBLK(i->i_mode) && MAJOR(i->i_rdev) == LOOP_MAJOR;
}

/*
* for AUFS
* no get/put for file.
*/
struct file *loop_backing_file(struct super_block *sb)
{
struct file *ret;
struct loop_device *l;

ret = NULL;
if (MAJOR(sb->s_dev) == LOOP_MAJOR) {
l = sb->s_bdev->bd_disk->private_data;
ret = l->lo_backing_file;
}
return ret;
}
EXPORT_SYMBOL(loop_backing_file);

/* loop sysfs attributes */

static ssize_t loop_attr_show(struct device *dev, char *page,
Expand Down
1 change: 1 addition & 0 deletions fs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ source "fs/pstore/Kconfig"
source "fs/sysv/Kconfig"
source "fs/ufs/Kconfig"
source "fs/exofs/Kconfig"
source "fs/aufs/Kconfig"

endif # MISC_FILESYSTEMS

Expand Down
1 change: 1 addition & 0 deletions fs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,4 @@ obj-y += exofs/ # Multiple modules
obj-$(CONFIG_CEPH_FS) += ceph/
obj-$(CONFIG_PSTORE) += pstore/
obj-$(CONFIG_EFIVAR_FS) += efivarfs/
obj-$(CONFIG_AUFS_FS) += aufs/
2 changes: 1 addition & 1 deletion fs/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2450,7 +2450,7 @@ int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
* Update file times before taking page lock. We may end up failing the
* fault so this update may be superfluous but who really cares...
*/
file_update_time(vma->vm_file);
vma_file_update_time(vma);

ret = __block_page_mkwrite(vma, vmf, get_block);
sb_end_pagefault(sb);
Expand Down
3 changes: 2 additions & 1 deletion fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ enum d_walk_ret {
*
* The @enter() and @finish() callbacks are called with d_lock held.
*/
static void d_walk(struct dentry *parent, void *data,
void d_walk(struct dentry *parent, void *data,
enum d_walk_ret (*enter)(void *, struct dentry *),
void (*finish)(void *))
{
Expand Down Expand Up @@ -1272,6 +1272,7 @@ static void d_walk(struct dentry *parent, void *data,
seq = 1;
goto again;
}
EXPORT_SYMBOL(d_walk);

/*
* Search for at least 1 mount point in the dentry's subdirs.
Expand Down
2 changes: 2 additions & 0 deletions fs/file_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ struct file *get_empty_filp(void)
}
return ERR_PTR(-ENFILE);
}
EXPORT_SYMBOL(get_empty_filp);

/**
* alloc_file - allocate and initialize a 'struct file'
Expand Down Expand Up @@ -308,6 +309,7 @@ void put_filp(struct file *file)
file_free(file);
}
}
EXPORT_SYMBOL(put_filp);

void __init files_init(unsigned long mempages)
{
Expand Down
1 change: 1 addition & 0 deletions fs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ static struct hlist_head *inode_hashtable __read_mostly;
static __cacheline_aligned_in_smp DEFINE_SPINLOCK(inode_hash_lock);

__cacheline_aligned_in_smp DEFINE_SPINLOCK(inode_sb_list_lock);
EXPORT_SYMBOL(inode_sb_list_lock);

/*
* Empty aops. Can be used for the cases where the user does not
Expand Down
2 changes: 2 additions & 0 deletions fs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ void __mnt_drop_write(struct vfsmount *mnt)
mnt_dec_writers(real_mount(mnt));
preempt_enable();
}
EXPORT_SYMBOL_GPL(__mnt_drop_write);

/**
* mnt_drop_write - give up write access to a mount
Expand Down Expand Up @@ -1792,6 +1793,7 @@ int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
}
return 0;
}
EXPORT_SYMBOL(iterate_mounts);

static void cleanup_group_ids(struct mount *mnt, struct mount *end)
{
Expand Down
4 changes: 4 additions & 0 deletions fs/notify/group.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/srcu.h>
#include <linux/rculist.h>
#include <linux/wait.h>
#include <linux/module.h>

#include <linux/fsnotify_backend.h>
#include "fsnotify.h"
Expand Down Expand Up @@ -72,6 +73,7 @@ void fsnotify_get_group(struct fsnotify_group *group)
{
atomic_inc(&group->refcnt);
}
EXPORT_SYMBOL(fsnotify_get_group);

/*
* Drop a reference to a group. Free it if it's through.
Expand All @@ -81,6 +83,7 @@ void fsnotify_put_group(struct fsnotify_group *group)
if (atomic_dec_and_test(&group->refcnt))
fsnotify_final_destroy_group(group);
}
EXPORT_SYMBOL(fsnotify_put_group);

/*
* Create a new fsnotify_group and hold a reference for the group returned.
Expand Down Expand Up @@ -109,6 +112,7 @@ struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops)

return group;
}
EXPORT_SYMBOL(fsnotify_alloc_group);

int fsnotify_fasync(int fd, struct file *file, int on)
{
Expand Down
4 changes: 4 additions & 0 deletions fs/notify/mark.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ void fsnotify_put_mark(struct fsnotify_mark *mark)
mark->free_mark(mark);
}
}
EXPORT_SYMBOL(fsnotify_put_mark);

/* Calculate mask of events for a list of marks */
u32 fsnotify_recalc_mask(struct hlist_head *head)
Expand Down Expand Up @@ -202,6 +203,7 @@ void fsnotify_destroy_mark(struct fsnotify_mark *mark,
fsnotify_destroy_mark_locked(mark, group);
mutex_unlock(&group->mark_mutex);
}
EXPORT_SYMBOL(fsnotify_destroy_mark);

/*
* Destroy all marks in the given list. The marks must be already detached from
Expand Down Expand Up @@ -376,6 +378,7 @@ int fsnotify_add_mark_locked(struct fsnotify_mark *mark,

return ret;
}
EXPORT_SYMBOL(fsnotify_add_mark);

int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group,
struct inode *inode, struct vfsmount *mnt, int allow_dups)
Expand Down Expand Up @@ -475,6 +478,7 @@ void fsnotify_init_mark(struct fsnotify_mark *mark,
atomic_set(&mark->refcnt, 1);
mark->free_mark = free_mark;
}
EXPORT_SYMBOL(fsnotify_init_mark);

static int fsnotify_mark_destroy(void *ignored)
{
Expand Down
2 changes: 2 additions & 0 deletions fs/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,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);

long vfs_truncate(struct path *path, loff_t length)
{
Expand Down Expand Up @@ -676,6 +677,7 @@ int open_check_o_direct(struct file *f)
}
return 0;
}
EXPORT_SYMBOL(open_check_o_direct);

static int do_dentry_open(struct file *f,
struct inode *inode,
Expand Down
2 changes: 1 addition & 1 deletion fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -1744,7 +1744,7 @@ static int proc_map_files_get_link(struct dentry *dentry, struct path *path)
down_read(&mm->mmap_sem);
vma = find_exact_vma(mm, vm_start, vm_end);
if (vma && vma->vm_file) {
*path = vma->vm_file->f_path;
*path = vma_pr_or_file(vma)->f_path;
path_get(path);
rc = 0;
}
Expand Down
5 changes: 4 additions & 1 deletion fs/proc/nommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
file = region->vm_file;

if (file) {
struct inode *inode = file_inode(region->vm_file);
struct inode *inode;

file = vmr_pr_or_file(region);
inode = file_inode(file);
dev = inode->i_sb->s_dev;
ino = inode->i_ino;
}
Expand Down
7 changes: 5 additions & 2 deletions fs/proc/task_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,10 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
const char *name = NULL;

if (file) {
struct inode *inode = file_inode(vma->vm_file);
struct inode *inode;

file = vma_pr_or_file(vma);
inode = file_inode(file);
dev = inode->i_sb->s_dev;
ino = inode->i_ino;
pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;
Expand Down Expand Up @@ -1479,7 +1482,7 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
struct proc_maps_private *proc_priv = &numa_priv->proc_maps;
struct vm_area_struct *vma = v;
struct numa_maps *md = &numa_priv->md;
struct file *file = vma->vm_file;
struct file *file = vma_pr_or_file(vma);
struct mm_struct *mm = vma->vm_mm;
struct mm_walk walk = {
.hugetlb_entry = gather_hugetlb_stats,
Expand Down
5 changes: 4 additions & 1 deletion fs/proc/task_nommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
file = vma->vm_file;

if (file) {
struct inode *inode = file_inode(vma->vm_file);
struct inode *inode;

file = vma_pr_or_file(vma);
inode = file_inode(file);
dev = inode->i_sb->s_dev;
ino = inode->i_ino;
pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT;
Expand Down
24 changes: 24 additions & 0 deletions fs/read_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,30 @@ ssize_t __vfs_write(struct file *file, const char __user *p, size_t count,
}
EXPORT_SYMBOL(__vfs_write);

vfs_readf_t vfs_readf(struct file *file)
{
const struct file_operations *fop = file->f_op;

if (fop->read)
return fop->read;
if (fop->read_iter)
return new_sync_read;
return ERR_PTR(-ENOSYS);
}
EXPORT_SYMBOL(vfs_readf);

vfs_writef_t vfs_writef(struct file *file)
{
const struct file_operations *fop = file->f_op;

if (fop->write)
return fop->write;
if (fop->write_iter)
return new_sync_write;
return ERR_PTR(-ENOSYS);
}
EXPORT_SYMBOL(vfs_writef);

ssize_t __kernel_write(struct file *file, const char *buf, size_t count, loff_t *pos)
{
mm_segment_t old_fs;
Expand Down
12 changes: 7 additions & 5 deletions fs/splice.c
Original file line number Diff line number Diff line change
Expand Up @@ -1101,8 +1101,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
/*
* Attempt to initiate a splice from pipe to file.
*/
static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
loff_t *ppos, size_t len, unsigned int flags)
long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
loff_t *ppos, size_t len, unsigned int flags)
{
ssize_t (*splice_write)(struct pipe_inode_info *, struct file *,
loff_t *, size_t, unsigned int);
Expand All @@ -1114,13 +1114,14 @@ static 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.
*/
static long do_splice_to(struct file *in, loff_t *ppos,
struct pipe_inode_info *pipe, size_t len,
unsigned int flags)
long do_splice_to(struct file *in, loff_t *ppos,
struct pipe_inode_info *pipe, size_t len,
unsigned int flags)
{
ssize_t (*splice_read)(struct file *, loff_t *,
struct pipe_inode_info *, size_t, unsigned int);
Expand All @@ -1140,6 +1141,7 @@ static 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
Expand Down
1 change: 1 addition & 0 deletions fs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ vfs_getxattr_alloc(struct dentry *dentry, const char *name, char **xattr_value,
*xattr_value = value;
return error;
}
EXPORT_SYMBOL(vfs_getxattr_alloc);

/* Compare an extended attribute value with the given value */
int vfs_xattr_cmp(struct dentry *dentry, const char *xattr_name,
Expand Down
1 change: 1 addition & 0 deletions include/linux/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ struct dentry;
struct path;
extern struct file *alloc_file(struct path *, fmode_t mode,
const struct file_operations *fop);
extern struct file *get_empty_filp(void);

static inline void fput_light(struct file *file, int fput_needed)
{
Expand Down
6 changes: 6 additions & 0 deletions include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1663,6 +1663,12 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
struct iovec *fast_pointer,
struct iovec **ret_pointer);

typedef ssize_t (*vfs_readf_t)(struct file *, char __user *, size_t, loff_t *);
typedef ssize_t (*vfs_writef_t)(struct file *, const char __user *, size_t,
loff_t *);
vfs_readf_t vfs_readf(struct file *file);
vfs_writef_t vfs_writef(struct file *file);

extern ssize_t __vfs_read(struct file *, char __user *, size_t, loff_t *);
extern ssize_t __vfs_write(struct file *, const char __user *, size_t, loff_t *);
extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);
Expand Down
22 changes: 22 additions & 0 deletions include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,28 @@ static inline int fixup_user_fault(struct task_struct *tsk,
}
#endif

extern void vma_do_file_update_time(struct vm_area_struct *, const char[], int);
extern struct file *vma_do_pr_or_file(struct vm_area_struct *, const char[],
int);
extern void vma_do_get_file(struct vm_area_struct *, const char[], int);
extern void vma_do_fput(struct vm_area_struct *, const char[], int);

#define vma_file_update_time(vma) vma_do_file_update_time(vma, __func__, \
__LINE__)
#define vma_pr_or_file(vma) vma_do_pr_or_file(vma, __func__, \
__LINE__)
#define vma_get_file(vma) vma_do_get_file(vma, __func__, __LINE__)
#define vma_fput(vma) vma_do_fput(vma, __func__, __LINE__)

#ifndef CONFIG_MMU
extern struct file *vmr_do_pr_or_file(struct vm_region *, const char[], int);
extern void vmr_do_fput(struct vm_region *, const char[], int);

#define vmr_pr_or_file(region) vmr_do_pr_or_file(region, __func__, \
__LINE__)
#define vmr_fput(region) vmr_do_fput(region, __func__, __LINE__)
#endif /* !CONFIG_MMU */

extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
extern int access_remote_vm(struct mm_struct *mm, unsigned long addr,
void *buf, int len, int write);
Expand Down
2 changes: 2 additions & 0 deletions include/linux/mm_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ struct vm_region {
unsigned long vm_top; /* region allocated to here */
unsigned long vm_pgoff; /* the offset in vm_file corresponding to vm_start */
struct file *vm_file; /* the backing file or NULL */
struct file *vm_prfile; /* the virtual backing file or NULL */

int vm_usage; /* region usage count (access under nommu_region_sem) */
bool vm_icache_flushed : 1; /* true if the icache has been flushed for
Expand Down Expand Up @@ -296,6 +297,7 @@ struct vm_area_struct {
unsigned long vm_pgoff; /* Offset (within vm_file) in PAGE_SIZE
units, *not* PAGE_CACHE_SIZE */
struct file * vm_file; /* File we map to (can be NULL). */
struct file *vm_prfile; /* shadow of vm_file */
void * vm_private_data; /* was vm_pte (shared mem) */

#ifndef CONFIG_MMU
Expand Down
Loading