Skip to content

Commit

Permalink
Merge remote-tracking branch 'aufs4/aufs4.1.13+' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
musical-chairs committed Apr 5, 2016
2 parents b3fab84 + 1e56d8b commit 42be1e9
Show file tree
Hide file tree
Showing 87 changed files with 710 additions and 396 deletions.
12 changes: 10 additions & 2 deletions Documentation/filesystems/aufs/README
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ git://git.kernel.org/.../torvalds/linux.git.
And you cannot select CONFIG_AUFS_FS=m for this version, eg. you cannot
build aufs4 as an external kernel module.
Several extra patches are not included in this tree. Only
aufs4-standalone tree contains them. They are describe in the later
aufs4-standalone tree contains them. They are described in the later
section "Configuration and Compilation."

On the other hand, the aufs4-standalone tree has only aufs source files
Expand Down Expand Up @@ -262,6 +262,13 @@ optional. When you meet some problems, they will help you.
duplication of inode number, which is important for backup tools and
other utilities. When you find aufs XINO files for tmpfs branch
growing too much, try this patch.
- lockdep-debug.patch
Because aufs is not only an ordinary filesystem (callee of VFS), but
also a caller of VFS functions for branch filesystems, subclassing of
the internal locks for LOCKDEP is necessary. LOCKDEP is a debugging
feature of linux kernel. If you enable CONFIG_LOCKDEP, then you will
need to apply this debug patch to expand several constant values.
If don't know what LOCKDEP, then you don't have apply this patch.


4. Usage
Expand Down Expand Up @@ -361,9 +368,10 @@ lauri kasvandik made a donation (2013/5).
The Parted Magic Project made a donation (2013/9 and 11).
Pavel Barta made a donation (2013/10).
Nikolay Pertsev made a donation (2014/5).
James B made a donation (2014/7).
James B made a donation (2014/7 and 2015/7).
Stefano Di Biase made a donation (2014/8).
Daniel Epellei made a donation (2015/1).
OmegaPhil made a donation (2016/1).

Thank you very much.
Donations are always, including future donations, very important and
Expand Down
2 changes: 1 addition & 1 deletion Documentation/filesystems/aufs/design/01intro.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Copyright (C) 2005-2015 Junjiro R. Okajima
# Copyright (C) 2005-2016 Junjiro R. Okajima

Introduction
----------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Documentation/filesystems/aufs/design/02struct.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Copyright (C) 2005-2015 Junjiro R. Okajima
# Copyright (C) 2005-2016 Junjiro R. Okajima

Basic Aufs Internal Structure

Expand Down
2 changes: 1 addition & 1 deletion Documentation/filesystems/aufs/design/03atomic_open.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Copyright (C) 2015 Junjiro R. Okajima
# Copyright (C) 2015-2016 Junjiro R. Okajima

Support for a branch who has its ->atomic_open()
----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Documentation/filesystems/aufs/design/03lookup.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Copyright (C) 2005-2015 Junjiro R. Okajima
# Copyright (C) 2005-2016 Junjiro R. Okajima

Lookup in a Branch
----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Documentation/filesystems/aufs/design/04branch.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Copyright (C) 2005-2015 Junjiro R. Okajima
# Copyright (C) 2005-2016 Junjiro R. Okajima

Branch Manipulation

Expand Down
2 changes: 1 addition & 1 deletion Documentation/filesystems/aufs/design/05wbr_policy.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Copyright (C) 2005-2015 Junjiro R. Okajima
# Copyright (C) 2005-2016 Junjiro R. Okajima

Policies to Select One among Multiple Writable Branches
----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Documentation/filesystems/aufs/design/06fhsm.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Copyright (C) 2011-2015 Junjiro R. Okajima
# Copyright (C) 2011-2016 Junjiro R. Okajima

File-based Hierarchical Storage Management (FHSM)
----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Documentation/filesystems/aufs/design/06mmap.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Copyright (C) 2005-2015 Junjiro R. Okajima
# Copyright (C) 2005-2016 Junjiro R. Okajima

mmap(2) -- File Memory Mapping
----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Documentation/filesystems/aufs/design/06xattr.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Copyright (C) 2014-2015 Junjiro R. Okajima
# Copyright (C) 2014-2016 Junjiro R. Okajima

Listing XATTR/EA and getting the value
----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Documentation/filesystems/aufs/design/07export.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Copyright (C) 2005-2015 Junjiro R. Okajima
# Copyright (C) 2005-2016 Junjiro R. Okajima

Export Aufs via NFS
----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Documentation/filesystems/aufs/design/08shwh.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Copyright (C) 2005-2015 Junjiro R. Okajima
# Copyright (C) 2005-2016 Junjiro R. Okajima

Show Whiteout Mode (shwh)
----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Documentation/filesystems/aufs/design/10dynop.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Copyright (C) 2010-2015 Junjiro R. Okajima
# Copyright (C) 2010-2016 Junjiro R. Okajima

Dynamically customizable FS operations
----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ struct file *loop_backing_file(struct super_block *sb)
}
return ret;
}
EXPORT_SYMBOL(loop_backing_file);
EXPORT_SYMBOL_GPL(loop_backing_file);

/* loop sysfs attributes */

Expand Down
2 changes: 1 addition & 1 deletion fs/aufs/aufs.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2015 Junjiro R. Okajima
* Copyright (C) 2005-2016 Junjiro R. Okajima
*/

/*
Expand Down
18 changes: 6 additions & 12 deletions fs/aufs/branch.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2015 Junjiro R. Okajima
* Copyright (C) 2005-2016 Junjiro R. Okajima
*/

/*
Expand Down Expand Up @@ -117,24 +117,22 @@ static struct au_branch *au_br_alloc(struct super_block *sb, int new_nbranch,

err = -ENOMEM;
root = sb->s_root;
add_branch = kmalloc(sizeof(*add_branch), GFP_NOFS);
add_branch = kzalloc(sizeof(*add_branch), GFP_NOFS);
if (unlikely(!add_branch))
goto out;

err = au_hnotify_init_br(add_branch, perm);
if (unlikely(err))
goto out_br;

add_branch->br_wbr = NULL;
if (au_br_writable(perm)) {
/* may be freed separately at changing the branch permission */
add_branch->br_wbr = kmalloc(sizeof(*add_branch->br_wbr),
add_branch->br_wbr = kzalloc(sizeof(*add_branch->br_wbr),
GFP_NOFS);
if (unlikely(!add_branch->br_wbr))
goto out_hnotify;
}

add_branch->br_fhsm = NULL;
if (au_br_fhsm(perm)) {
err = au_fhsm_br_alloc(add_branch);
if (unlikely(err))
Expand Down Expand Up @@ -339,9 +337,7 @@ static int au_wbr_init(struct au_branch *br, struct super_block *sb,

wbr = br->br_wbr;
au_rw_init(&wbr->wbr_wh_rwsem);
memset(wbr->wbr_wh, 0, sizeof(wbr->wbr_wh));
atomic_set(&wbr->wbr_wh_running, 0);
wbr->wbr_bytes = 0;

/*
* a limit for rmdir/rename a dir
Expand Down Expand Up @@ -370,12 +366,10 @@ static int au_br_init(struct au_branch *br, struct super_block *sb,
struct inode *h_inode;

err = 0;
memset(&br->br_xino, 0, sizeof(br->br_xino));
mutex_init(&br->br_xino.xi_nondir_mtx);
br->br_perm = add->perm;
br->br_path = add->path; /* set first, path_get() later */
spin_lock_init(&br->br_dykey_lock);
memset(br->br_dykey, 0, sizeof(br->br_dykey));
atomic_set(&br->br_count, 0);
atomic_set(&br->br_xino_running, 0);
br->br_id = au_new_br_id(sb);
Expand Down Expand Up @@ -584,7 +578,7 @@ static void au_farray_free(struct file **a, unsigned long long max)
for (ull = 0; ull < max; ull++)
if (a[ull])
fput(a[ull]);
au_array_free(a);
kvfree(a);
}

/* ---------------------------------------------------------------------- */
Expand Down Expand Up @@ -1334,7 +1328,7 @@ int au_br_mod(struct super_block *sb, struct au_opt_mod *mod, int remount,

if (unlikely(err)) {
rerr = -ENOMEM;
br->br_wbr = kmalloc(sizeof(*br->br_wbr),
br->br_wbr = kzalloc(sizeof(*br->br_wbr),
GFP_NOFS);
if (br->br_wbr)
rerr = au_wbr_init(br, sb, br->br_perm);
Expand All @@ -1348,7 +1342,7 @@ int au_br_mod(struct super_block *sb, struct au_opt_mod *mod, int remount,
} else if (au_br_writable(mod->perm)) {
/* ro --> rw */
err = -ENOMEM;
br->br_wbr = kmalloc(sizeof(*br->br_wbr), GFP_NOFS);
br->br_wbr = kzalloc(sizeof(*br->br_wbr), GFP_NOFS);
if (br->br_wbr) {
err = au_wbr_init(br, sb, mod->perm);
if (unlikely(err)) {
Expand Down
2 changes: 1 addition & 1 deletion fs/aufs/branch.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2015 Junjiro R. Okajima
* Copyright (C) 2005-2016 Junjiro R. Okajima
*/

/*
Expand Down
94 changes: 77 additions & 17 deletions fs/aufs/cpup.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2015 Junjiro R. Okajima
* Copyright (C) 2005-2016 Junjiro R. Okajima
*/

/*
Expand All @@ -8,6 +8,7 @@

#include <linux/fs_stack.h>
#include <linux/mm.h>
#include <linux/task_work.h>
#include "aufs.h"

void au_cpup_attr_flags(struct inode *dst, unsigned int iflags)
Expand Down Expand Up @@ -380,6 +381,7 @@ static int au_cp_regular(struct au_cp_generic *cpg)
}
};
struct super_block *sb;
struct task_struct *tsk = current;

/* bsrc branch can be ro/rw. */
sb = cpg->dentry->d_sb;
Expand All @@ -397,7 +399,21 @@ static int au_cp_regular(struct au_cp_generic *cpg)
IMustLock(d_inode(file[SRC].dentry));
err = au_copy_file(file[DST].file, file[SRC].file, cpg->len);

fput(file[DST].file);
/* i wonder if we had O_NO_DELAY_FPUT flag */
if (tsk->flags & PF_KTHREAD)
__fput_sync(file[DST].file);
else {
WARN(1, "%pD\nPlease report this warning to aufs-users ML",
file[DST].file);
fput(file[DST].file);
/*
* too bad.
* we have to call both since we don't know which place the file
* was added to.
*/
task_work_run();
flush_delayed_fput();
}
au_sbr_put(sb, file[DST].bindex);

out_src:
Expand Down Expand Up @@ -496,6 +512,57 @@ static int au_do_cpup_symlink(struct path *h_path, struct dentry *h_src,
return err;
}

/*
* regardless 'acl' option, reset all ACL.
* All ACL will be copied up later from the original entry on the lower branch.
*/
static int au_reset_acl(struct inode *h_dir, struct path *h_path, umode_t mode)
{
int err;
struct dentry *h_dentry;
struct inode *h_inode;

h_dentry = h_path->dentry;
h_inode = d_inode(h_dentry);
/* forget_all_cached_acls(h_inode)); */
err = vfsub_removexattr(h_dentry, XATTR_NAME_POSIX_ACL_ACCESS);
AuTraceErr(err);
if (err == -EOPNOTSUPP)
err = 0;
if (!err)
err = vfsub_acl_chmod(h_inode, mode);

AuTraceErr(err);
return err;
}

static int au_do_cpup_dir(struct au_cp_generic *cpg, struct dentry *dst_parent,
struct inode *h_dir, struct path *h_path)
{
int err;
struct inode *dir, *inode;

err = vfsub_removexattr(h_path->dentry, XATTR_NAME_POSIX_ACL_DEFAULT);
AuTraceErr(err);
if (err == -EOPNOTSUPP)
err = 0;
if (unlikely(err))
goto out;

/*
* strange behaviour from the users view,
* particularry setattr case
*/
dir = d_inode(dst_parent);
if (au_ibstart(dir) == cpg->bdst)
au_cpup_attr_nlink(dir, /*force*/1);
inode = d_inode(cpg->dentry);
au_cpup_attr_nlink(inode, /*force*/1);

out:
return err;
}

static noinline_for_stack
int cpup_entry(struct au_cp_generic *cpg, struct dentry *dst_parent,
struct au_cpup_reg_attr *h_src_attr)
Expand All @@ -508,7 +575,7 @@ int cpup_entry(struct au_cp_generic *cpg, struct dentry *dst_parent,
struct au_dtime dt;
struct path h_path;
struct dentry *h_src, *h_dst, *h_parent;
struct inode *h_inode, *h_dir, *dir, *inode;
struct inode *h_inode, *h_dir;
struct super_block *sb;

/* bsrc branch can be ro/rw. */
Expand Down Expand Up @@ -540,25 +607,16 @@ int cpup_entry(struct au_cp_generic *cpg, struct dentry *dst_parent,
switch (mode & S_IFMT) {
case S_IFREG:
isreg = 1;
err = vfsub_create(h_dir, &h_path, mode | S_IWUSR,
err = vfsub_create(h_dir, &h_path, S_IRUSR | S_IWUSR,
/*want_excl*/true);
if (!err)
err = au_do_cpup_regular(cpg, h_src_attr);
break;
case S_IFDIR:
isdir = 1;
err = vfsub_mkdir(h_dir, &h_path, mode);
if (!err) {
/*
* strange behaviour from the users view,
* particularry setattr case
*/
dir = d_inode(dst_parent);
if (au_ibstart(dir) == cpg->bdst)
au_cpup_attr_nlink(dir, /*force*/1);
inode = d_inode(cpg->dentry);
au_cpup_attr_nlink(inode, /*force*/1);
}
if (!err)
err = au_do_cpup_dir(cpg, dst_parent, h_dir, &h_path);
break;
case S_IFLNK:
err = au_do_cpup_symlink(&h_path, h_src, h_dir);
Expand All @@ -575,6 +633,8 @@ int cpup_entry(struct au_cp_generic *cpg, struct dentry *dst_parent,
AuIOErr("Unknown inode type 0%o\n", mode);
err = -EIO;
}
if (!err)
err = au_reset_acl(h_dir, &h_path, mode);

mnt_flags = au_mntflags(sb);
if (!au_opt_test(mnt_flags, UDBA_NONE)
Expand Down Expand Up @@ -710,9 +770,9 @@ static int au_cpup_single(struct au_cp_generic *cpg, struct dentry *dst_parent)
goto out_parent;
if (unlikely(d_is_negative(h_src))) {
err = -EIO;
AuIOErr("i%lu exists on a upper branch "
AuIOErr("i%lu exists on b%d "
"but not pseudo-linked\n",
inode->i_ino);
inode->i_ino, cpg->bdst);
dput(h_src);
goto out_parent;
}
Expand Down
2 changes: 1 addition & 1 deletion fs/aufs/cpup.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2015 Junjiro R. Okajima
* Copyright (C) 2005-2016 Junjiro R. Okajima
*/

/*
Expand Down

0 comments on commit 42be1e9

Please sign in to comment.