]>
git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - fs/aufs/posix_acl.c
2 * Copyright (C) 2014-2016 Junjiro R. Okajima
4 * This program, aufs is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * posix acl operations
25 struct posix_acl
*aufs_get_acl(struct inode
*inode
, int type
)
27 struct posix_acl
*acl
;
30 struct inode
*h_inode
;
31 struct super_block
*sb
;
35 si_read_lock(sb
, AuLock_FLUSH
);
36 ii_read_lock_child(inode
);
37 if (!(sb
->s_flags
& MS_POSIXACL
))
40 bindex
= au_ibtop(inode
);
41 h_inode
= au_h_iptr(inode
, bindex
);
43 || ((h_inode
->i_mode
& S_IFMT
)
44 != (inode
->i_mode
& S_IFMT
)))) {
45 err
= au_busy_or_stale();
50 /* always topmost only */
51 acl
= get_acl(h_inode
, type
);
52 if (!IS_ERR_OR_NULL(acl
))
53 set_cached_acl(inode
, type
, acl
);
56 ii_read_unlock(inode
);
63 int aufs_set_acl(struct inode
*inode
, struct posix_acl
*acl
, int type
)
67 struct dentry
*dentry
;
68 struct au_sxattr arg
= {
78 if (inode
->i_ino
== AUFS_ROOT_INO
)
79 dentry
= dget(inode
->i_sb
->s_root
);
81 dentry
= d_find_alias(inode
);
83 dentry
= d_find_any_alias(inode
);
85 pr_warn("cannot handle this inode, "
86 "please report to aufs-users ML\n");
92 ssz
= au_sxattr(dentry
, inode
, &arg
);
97 set_cached_acl(inode
, type
, acl
);