]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - fs/aufs/i_op.c
perf xyarray: Fix wrong processing when closing evsel fd
[mirror_ubuntu-artful-kernel.git] / fs / aufs / i_op.c
1 /*
2 * Copyright (C) 2005-2017 Junjiro R. Okajima
3 *
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.
8 *
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.
13 *
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/>.
16 */
17
18 /*
19 * inode operations (except add/del/rename)
20 */
21
22 #include <linux/device_cgroup.h>
23 #include <linux/fs_stack.h>
24 #include <linux/namei.h>
25 #include <linux/security.h>
26 #include "aufs.h"
27
28 static int h_permission(struct inode *h_inode, int mask,
29 struct path *h_path, int brperm)
30 {
31 int err;
32 const unsigned char write_mask = !!(mask & (MAY_WRITE | MAY_APPEND));
33
34 err = -EPERM;
35 if (write_mask && IS_IMMUTABLE(h_inode))
36 goto out;
37
38 err = -EACCES;
39 if (((mask & MAY_EXEC)
40 && S_ISREG(h_inode->i_mode)
41 && (path_noexec(h_path)
42 || !(h_inode->i_mode & S_IXUGO))))
43 goto out;
44
45 /*
46 * - skip the lower fs test in the case of write to ro branch.
47 * - nfs dir permission write check is optimized, but a policy for
48 * link/rename requires a real check.
49 * - nfs always sets MS_POSIXACL regardless its mount option 'noacl.'
50 * in this case, generic_permission() returns -EOPNOTSUPP.
51 */
52 if ((write_mask && !au_br_writable(brperm))
53 || (au_test_nfs(h_inode->i_sb) && S_ISDIR(h_inode->i_mode)
54 && write_mask && !(mask & MAY_READ))
55 || !h_inode->i_op->permission) {
56 /* AuLabel(generic_permission); */
57 /* AuDbg("get_acl %pf\n", h_inode->i_op->get_acl); */
58 err = generic_permission(h_inode, mask);
59 if (err == -EOPNOTSUPP && au_test_nfs_noacl(h_inode))
60 err = h_inode->i_op->permission(h_inode, mask);
61 AuTraceErr(err);
62 } else {
63 /* AuLabel(h_inode->permission); */
64 err = h_inode->i_op->permission(h_inode, mask);
65 AuTraceErr(err);
66 }
67
68 if (!err)
69 err = devcgroup_inode_permission(h_inode, mask);
70 if (!err)
71 err = security_inode_permission(h_inode, mask);
72
73 #if 0
74 if (!err) {
75 /* todo: do we need to call ima_path_check()? */
76 struct path h_path = {
77 .dentry =
78 .mnt = h_mnt
79 };
80 err = ima_path_check(&h_path,
81 mask & (MAY_READ | MAY_WRITE | MAY_EXEC),
82 IMA_COUNT_LEAVE);
83 }
84 #endif
85
86 out:
87 return err;
88 }
89
90 static int aufs_permission(struct inode *inode, int mask)
91 {
92 int err;
93 aufs_bindex_t bindex, bbot;
94 const unsigned char isdir = !!S_ISDIR(inode->i_mode),
95 write_mask = !!(mask & (MAY_WRITE | MAY_APPEND));
96 struct inode *h_inode;
97 struct super_block *sb;
98 struct au_branch *br;
99
100 /* todo: support rcu-walk? */
101 if (mask & MAY_NOT_BLOCK)
102 return -ECHILD;
103
104 sb = inode->i_sb;
105 si_read_lock(sb, AuLock_FLUSH);
106 ii_read_lock_child(inode);
107 #if 0
108 err = au_iigen_test(inode, au_sigen(sb));
109 if (unlikely(err))
110 goto out;
111 #endif
112
113 if (!isdir
114 || write_mask
115 || au_opt_test(au_mntflags(sb), DIRPERM1)) {
116 err = au_busy_or_stale();
117 h_inode = au_h_iptr(inode, au_ibtop(inode));
118 if (unlikely(!h_inode
119 || (h_inode->i_mode & S_IFMT)
120 != (inode->i_mode & S_IFMT)))
121 goto out;
122
123 err = 0;
124 bindex = au_ibtop(inode);
125 br = au_sbr(sb, bindex);
126 err = h_permission(h_inode, mask, &br->br_path, br->br_perm);
127 if (write_mask
128 && !err
129 && !special_file(h_inode->i_mode)) {
130 /* test whether the upper writable branch exists */
131 err = -EROFS;
132 for (; bindex >= 0; bindex--)
133 if (!au_br_rdonly(au_sbr(sb, bindex))) {
134 err = 0;
135 break;
136 }
137 }
138 goto out;
139 }
140
141 /* non-write to dir */
142 err = 0;
143 bbot = au_ibbot(inode);
144 for (bindex = au_ibtop(inode); !err && bindex <= bbot; bindex++) {
145 h_inode = au_h_iptr(inode, bindex);
146 if (h_inode) {
147 err = au_busy_or_stale();
148 if (unlikely(!S_ISDIR(h_inode->i_mode)))
149 break;
150
151 br = au_sbr(sb, bindex);
152 err = h_permission(h_inode, mask, &br->br_path,
153 br->br_perm);
154 }
155 }
156
157 out:
158 ii_read_unlock(inode);
159 si_read_unlock(sb);
160 return err;
161 }
162
163 /* ---------------------------------------------------------------------- */
164
165 static struct dentry *aufs_lookup(struct inode *dir, struct dentry *dentry,
166 unsigned int flags)
167 {
168 struct dentry *ret, *parent;
169 struct inode *inode;
170 struct super_block *sb;
171 int err, npositive;
172
173 IMustLock(dir);
174
175 /* todo: support rcu-walk? */
176 ret = ERR_PTR(-ECHILD);
177 if (flags & LOOKUP_RCU)
178 goto out;
179
180 ret = ERR_PTR(-ENAMETOOLONG);
181 if (unlikely(dentry->d_name.len > AUFS_MAX_NAMELEN))
182 goto out;
183
184 sb = dir->i_sb;
185 err = si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLM);
186 ret = ERR_PTR(err);
187 if (unlikely(err))
188 goto out;
189
190 err = au_di_init(dentry);
191 ret = ERR_PTR(err);
192 if (unlikely(err))
193 goto out_si;
194
195 inode = NULL;
196 npositive = 0; /* suppress a warning */
197 parent = dentry->d_parent; /* dir inode is locked */
198 di_read_lock_parent(parent, AuLock_IR);
199 err = au_alive_dir(parent);
200 if (!err)
201 err = au_digen_test(parent, au_sigen(sb));
202 if (!err) {
203 /* regardless LOOKUP_CREATE, always ALLOW_NEG */
204 npositive = au_lkup_dentry(dentry, au_dbtop(parent),
205 AuLkup_ALLOW_NEG);
206 err = npositive;
207 }
208 di_read_unlock(parent, AuLock_IR);
209 ret = ERR_PTR(err);
210 if (unlikely(err < 0))
211 goto out_unlock;
212
213 if (npositive) {
214 inode = au_new_inode(dentry, /*must_new*/0);
215 if (IS_ERR(inode)) {
216 ret = (void *)inode;
217 inode = NULL;
218 goto out_unlock;
219 }
220 }
221
222 if (inode)
223 atomic_inc(&inode->i_count);
224 ret = d_splice_alias(inode, dentry);
225 #if 0
226 if (unlikely(d_need_lookup(dentry))) {
227 spin_lock(&dentry->d_lock);
228 dentry->d_flags &= ~DCACHE_NEED_LOOKUP;
229 spin_unlock(&dentry->d_lock);
230 } else
231 #endif
232 if (inode) {
233 if (!IS_ERR(ret)) {
234 iput(inode);
235 if (ret && ret != dentry)
236 ii_write_unlock(inode);
237 } else {
238 ii_write_unlock(inode);
239 iput(inode);
240 inode = NULL;
241 }
242 }
243
244 out_unlock:
245 di_write_unlock(dentry);
246 out_si:
247 si_read_unlock(sb);
248 out:
249 return ret;
250 }
251
252 /* ---------------------------------------------------------------------- */
253
254 struct aopen_node {
255 struct hlist_node hlist;
256 struct file *file, *h_file;
257 };
258
259 static int au_do_aopen(struct inode *inode, struct file *file)
260 {
261 struct au_sphlhead *aopen;
262 struct aopen_node *node;
263 struct au_do_open_args args = {
264 .aopen = 1,
265 .open = au_do_open_nondir
266 };
267
268 aopen = &au_sbi(inode->i_sb)->si_aopen;
269 spin_lock(&aopen->spin);
270 hlist_for_each_entry(node, &aopen->head, hlist)
271 if (node->file == file) {
272 args.h_file = node->h_file;
273 break;
274 }
275 spin_unlock(&aopen->spin);
276 /* AuDebugOn(!args.h_file); */
277
278 return au_do_open(file, &args);
279 }
280
281 static int aufs_atomic_open(struct inode *dir, struct dentry *dentry,
282 struct file *file, unsigned int open_flag,
283 umode_t create_mode, int *opened)
284 {
285 int err, unlocked, h_opened = *opened;
286 unsigned int lkup_flags;
287 struct dentry *parent, *d;
288 struct au_sphlhead *aopen;
289 struct vfsub_aopen_args args = {
290 .open_flag = open_flag,
291 .create_mode = create_mode,
292 .opened = &h_opened
293 };
294 struct aopen_node aopen_node = {
295 .file = file
296 };
297
298 IMustLock(dir);
299 AuDbg("open_flag 0%o\n", open_flag);
300 AuDbgDentry(dentry);
301
302 err = 0;
303 if (!au_di(dentry)) {
304 lkup_flags = LOOKUP_OPEN;
305 if (open_flag & O_CREAT)
306 lkup_flags |= LOOKUP_CREATE;
307 d = aufs_lookup(dir, dentry, lkup_flags);
308 if (IS_ERR(d)) {
309 err = PTR_ERR(d);
310 AuTraceErr(err);
311 goto out;
312 } else if (d) {
313 /*
314 * obsoleted dentry found.
315 * another error will be returned later.
316 */
317 d_drop(d);
318 AuDbgDentry(d);
319 dput(d);
320 }
321 AuDbgDentry(dentry);
322 }
323
324 if (d_is_positive(dentry)
325 || d_unhashed(dentry)
326 || d_unlinked(dentry)
327 || !(open_flag & O_CREAT))
328 goto out_no_open;
329
330 unlocked = 0;
331 err = aufs_read_lock(dentry, AuLock_DW | AuLock_FLUSH | AuLock_GEN);
332 if (unlikely(err))
333 goto out;
334
335 parent = dentry->d_parent; /* dir is locked */
336 di_write_lock_parent(parent);
337 err = au_lkup_dentry(dentry, /*btop*/0, AuLkup_ALLOW_NEG);
338 if (unlikely(err))
339 goto out_unlock;
340
341 AuDbgDentry(dentry);
342 if (d_is_positive(dentry))
343 goto out_unlock;
344
345 args.file = get_empty_filp();
346 err = PTR_ERR(args.file);
347 if (IS_ERR(args.file))
348 goto out_unlock;
349
350 args.file->f_flags = file->f_flags;
351 err = au_aopen_or_create(dir, dentry, &args);
352 AuTraceErr(err);
353 AuDbgFile(args.file);
354 if (unlikely(err < 0)) {
355 if (h_opened & FILE_OPENED)
356 fput(args.file);
357 else
358 put_filp(args.file);
359 goto out_unlock;
360 }
361 di_write_unlock(parent);
362 di_write_unlock(dentry);
363 unlocked = 1;
364
365 /* some filesystems don't set FILE_CREATED while succeeded? */
366 *opened |= FILE_CREATED;
367 if (h_opened & FILE_OPENED)
368 aopen_node.h_file = args.file;
369 else {
370 put_filp(args.file);
371 args.file = NULL;
372 }
373 aopen = &au_sbi(dir->i_sb)->si_aopen;
374 au_sphl_add(&aopen_node.hlist, aopen);
375 err = finish_open(file, dentry, au_do_aopen, opened);
376 au_sphl_del(&aopen_node.hlist, aopen);
377 AuTraceErr(err);
378 AuDbgFile(file);
379 if (aopen_node.h_file)
380 fput(aopen_node.h_file);
381
382 out_unlock:
383 if (unlocked)
384 si_read_unlock(dentry->d_sb);
385 else {
386 di_write_unlock(parent);
387 aufs_read_unlock(dentry, AuLock_DW);
388 }
389 AuDbgDentry(dentry);
390 if (unlikely(err < 0))
391 goto out;
392 out_no_open:
393 if (err >= 0 && !(*opened & FILE_CREATED)) {
394 AuLabel(out_no_open);
395 dget(dentry);
396 err = finish_no_open(file, dentry);
397 }
398 out:
399 AuDbg("%pd%s%s\n", dentry,
400 (*opened & FILE_CREATED) ? " created" : "",
401 (*opened & FILE_OPENED) ? " opened" : "");
402 AuTraceErr(err);
403 return err;
404 }
405
406
407 /* ---------------------------------------------------------------------- */
408
409 static int au_wr_dir_cpup(struct dentry *dentry, struct dentry *parent,
410 const unsigned char add_entry, aufs_bindex_t bcpup,
411 aufs_bindex_t btop)
412 {
413 int err;
414 struct dentry *h_parent;
415 struct inode *h_dir;
416
417 if (add_entry)
418 IMustLock(d_inode(parent));
419 else
420 di_write_lock_parent(parent);
421
422 err = 0;
423 if (!au_h_dptr(parent, bcpup)) {
424 if (btop > bcpup)
425 err = au_cpup_dirs(dentry, bcpup);
426 else if (btop < bcpup)
427 err = au_cpdown_dirs(dentry, bcpup);
428 else
429 BUG();
430 }
431 if (!err && add_entry && !au_ftest_wrdir(add_entry, TMPFILE)) {
432 h_parent = au_h_dptr(parent, bcpup);
433 h_dir = d_inode(h_parent);
434 vfsub_inode_lock_shared_nested(h_dir, AuLsc_I_PARENT);
435 err = au_lkup_neg(dentry, bcpup, /*wh*/0);
436 /* todo: no unlock here */
437 inode_unlock_shared(h_dir);
438
439 AuDbg("bcpup %d\n", bcpup);
440 if (!err) {
441 if (d_really_is_negative(dentry))
442 au_set_h_dptr(dentry, btop, NULL);
443 au_update_dbrange(dentry, /*do_put_zero*/0);
444 }
445 }
446
447 if (!add_entry)
448 di_write_unlock(parent);
449 if (!err)
450 err = bcpup; /* success */
451
452 AuTraceErr(err);
453 return err;
454 }
455
456 /*
457 * decide the branch and the parent dir where we will create a new entry.
458 * returns new bindex or an error.
459 * copyup the parent dir if needed.
460 */
461 int au_wr_dir(struct dentry *dentry, struct dentry *src_dentry,
462 struct au_wr_dir_args *args)
463 {
464 int err;
465 unsigned int flags;
466 aufs_bindex_t bcpup, btop, src_btop;
467 const unsigned char add_entry
468 = au_ftest_wrdir(args->flags, ADD_ENTRY)
469 | au_ftest_wrdir(args->flags, TMPFILE);
470 struct super_block *sb;
471 struct dentry *parent;
472 struct au_sbinfo *sbinfo;
473
474 sb = dentry->d_sb;
475 sbinfo = au_sbi(sb);
476 parent = dget_parent(dentry);
477 btop = au_dbtop(dentry);
478 bcpup = btop;
479 if (args->force_btgt < 0) {
480 if (src_dentry) {
481 src_btop = au_dbtop(src_dentry);
482 if (src_btop < btop)
483 bcpup = src_btop;
484 } else if (add_entry) {
485 flags = 0;
486 if (au_ftest_wrdir(args->flags, ISDIR))
487 au_fset_wbr(flags, DIR);
488 err = AuWbrCreate(sbinfo, dentry, flags);
489 bcpup = err;
490 }
491
492 if (bcpup < 0 || au_test_ro(sb, bcpup, d_inode(dentry))) {
493 if (add_entry)
494 err = AuWbrCopyup(sbinfo, dentry);
495 else {
496 if (!IS_ROOT(dentry)) {
497 di_read_lock_parent(parent, !AuLock_IR);
498 err = AuWbrCopyup(sbinfo, dentry);
499 di_read_unlock(parent, !AuLock_IR);
500 } else
501 err = AuWbrCopyup(sbinfo, dentry);
502 }
503 bcpup = err;
504 if (unlikely(err < 0))
505 goto out;
506 }
507 } else {
508 bcpup = args->force_btgt;
509 AuDebugOn(au_test_ro(sb, bcpup, d_inode(dentry)));
510 }
511
512 AuDbg("btop %d, bcpup %d\n", btop, bcpup);
513 err = bcpup;
514 if (bcpup == btop)
515 goto out; /* success */
516
517 /* copyup the new parent into the branch we process */
518 err = au_wr_dir_cpup(dentry, parent, add_entry, bcpup, btop);
519 if (err >= 0) {
520 if (d_really_is_negative(dentry)) {
521 au_set_h_dptr(dentry, btop, NULL);
522 au_set_dbtop(dentry, bcpup);
523 au_set_dbbot(dentry, bcpup);
524 }
525 AuDebugOn(add_entry
526 && !au_ftest_wrdir(args->flags, TMPFILE)
527 && !au_h_dptr(dentry, bcpup));
528 }
529
530 out:
531 dput(parent);
532 return err;
533 }
534
535 /* ---------------------------------------------------------------------- */
536
537 void au_pin_hdir_unlock(struct au_pin *p)
538 {
539 if (p->hdir)
540 au_hn_inode_unlock(p->hdir);
541 }
542
543 int au_pin_hdir_lock(struct au_pin *p)
544 {
545 int err;
546
547 err = 0;
548 if (!p->hdir)
549 goto out;
550
551 /* even if an error happens later, keep this lock */
552 au_hn_inode_lock_nested(p->hdir, p->lsc_hi);
553
554 err = -EBUSY;
555 if (unlikely(p->hdir->hi_inode != d_inode(p->h_parent)))
556 goto out;
557
558 err = 0;
559 if (p->h_dentry)
560 err = au_h_verify(p->h_dentry, p->udba, p->hdir->hi_inode,
561 p->h_parent, p->br);
562
563 out:
564 return err;
565 }
566
567 int au_pin_hdir_relock(struct au_pin *p)
568 {
569 int err, i;
570 struct inode *h_i;
571 struct dentry *h_d[] = {
572 p->h_dentry,
573 p->h_parent
574 };
575
576 err = au_pin_hdir_lock(p);
577 if (unlikely(err))
578 goto out;
579
580 for (i = 0; !err && i < sizeof(h_d)/sizeof(*h_d); i++) {
581 if (!h_d[i])
582 continue;
583 if (d_is_positive(h_d[i])) {
584 h_i = d_inode(h_d[i]);
585 err = !h_i->i_nlink;
586 }
587 }
588
589 out:
590 return err;
591 }
592
593 static void au_pin_hdir_set_owner(struct au_pin *p, struct task_struct *task)
594 {
595 #if !defined(CONFIG_RWSEM_GENERIC_SPINLOCK) && defined(CONFIG_RWSEM_SPIN_ON_OWNER)
596 p->hdir->hi_inode->i_rwsem.owner = task;
597 #endif
598 }
599
600 void au_pin_hdir_acquire_nest(struct au_pin *p)
601 {
602 if (p->hdir) {
603 rwsem_acquire_nest(&p->hdir->hi_inode->i_rwsem.dep_map,
604 p->lsc_hi, 0, NULL, _RET_IP_);
605 au_pin_hdir_set_owner(p, current);
606 }
607 }
608
609 void au_pin_hdir_release(struct au_pin *p)
610 {
611 if (p->hdir) {
612 au_pin_hdir_set_owner(p, p->task);
613 rwsem_release(&p->hdir->hi_inode->i_rwsem.dep_map, 1, _RET_IP_);
614 }
615 }
616
617 struct dentry *au_pinned_h_parent(struct au_pin *pin)
618 {
619 if (pin && pin->parent)
620 return au_h_dptr(pin->parent, pin->bindex);
621 return NULL;
622 }
623
624 void au_unpin(struct au_pin *p)
625 {
626 if (p->hdir)
627 au_pin_hdir_unlock(p);
628 if (p->h_mnt && au_ftest_pin(p->flags, MNT_WRITE))
629 vfsub_mnt_drop_write(p->h_mnt);
630 if (!p->hdir)
631 return;
632
633 if (!au_ftest_pin(p->flags, DI_LOCKED))
634 di_read_unlock(p->parent, AuLock_IR);
635 iput(p->hdir->hi_inode);
636 dput(p->parent);
637 p->parent = NULL;
638 p->hdir = NULL;
639 p->h_mnt = NULL;
640 /* do not clear p->task */
641 }
642
643 int au_do_pin(struct au_pin *p)
644 {
645 int err;
646 struct super_block *sb;
647 struct inode *h_dir;
648
649 err = 0;
650 sb = p->dentry->d_sb;
651 p->br = au_sbr(sb, p->bindex);
652 if (IS_ROOT(p->dentry)) {
653 if (au_ftest_pin(p->flags, MNT_WRITE)) {
654 p->h_mnt = au_br_mnt(p->br);
655 err = vfsub_mnt_want_write(p->h_mnt);
656 if (unlikely(err)) {
657 au_fclr_pin(p->flags, MNT_WRITE);
658 goto out_err;
659 }
660 }
661 goto out;
662 }
663
664 p->h_dentry = NULL;
665 if (p->bindex <= au_dbbot(p->dentry))
666 p->h_dentry = au_h_dptr(p->dentry, p->bindex);
667
668 p->parent = dget_parent(p->dentry);
669 if (!au_ftest_pin(p->flags, DI_LOCKED))
670 di_read_lock(p->parent, AuLock_IR, p->lsc_di);
671
672 h_dir = NULL;
673 p->h_parent = au_h_dptr(p->parent, p->bindex);
674 p->hdir = au_hi(d_inode(p->parent), p->bindex);
675 if (p->hdir)
676 h_dir = p->hdir->hi_inode;
677
678 /*
679 * udba case, or
680 * if DI_LOCKED is not set, then p->parent may be different
681 * and h_parent can be NULL.
682 */
683 if (unlikely(!p->hdir || !h_dir || !p->h_parent)) {
684 err = -EBUSY;
685 if (!au_ftest_pin(p->flags, DI_LOCKED))
686 di_read_unlock(p->parent, AuLock_IR);
687 dput(p->parent);
688 p->parent = NULL;
689 goto out_err;
690 }
691
692 if (au_ftest_pin(p->flags, MNT_WRITE)) {
693 p->h_mnt = au_br_mnt(p->br);
694 err = vfsub_mnt_want_write(p->h_mnt);
695 if (unlikely(err)) {
696 au_fclr_pin(p->flags, MNT_WRITE);
697 if (!au_ftest_pin(p->flags, DI_LOCKED))
698 di_read_unlock(p->parent, AuLock_IR);
699 dput(p->parent);
700 p->parent = NULL;
701 goto out_err;
702 }
703 }
704
705 au_igrab(h_dir);
706 err = au_pin_hdir_lock(p);
707 if (!err)
708 goto out; /* success */
709
710 au_unpin(p);
711
712 out_err:
713 pr_err("err %d\n", err);
714 err = au_busy_or_stale();
715 out:
716 return err;
717 }
718
719 void au_pin_init(struct au_pin *p, struct dentry *dentry,
720 aufs_bindex_t bindex, int lsc_di, int lsc_hi,
721 unsigned int udba, unsigned char flags)
722 {
723 p->dentry = dentry;
724 p->udba = udba;
725 p->lsc_di = lsc_di;
726 p->lsc_hi = lsc_hi;
727 p->flags = flags;
728 p->bindex = bindex;
729
730 p->parent = NULL;
731 p->hdir = NULL;
732 p->h_mnt = NULL;
733
734 p->h_dentry = NULL;
735 p->h_parent = NULL;
736 p->br = NULL;
737 p->task = current;
738 }
739
740 int au_pin(struct au_pin *pin, struct dentry *dentry, aufs_bindex_t bindex,
741 unsigned int udba, unsigned char flags)
742 {
743 au_pin_init(pin, dentry, bindex, AuLsc_DI_PARENT, AuLsc_I_PARENT2,
744 udba, flags);
745 return au_do_pin(pin);
746 }
747
748 /* ---------------------------------------------------------------------- */
749
750 /*
751 * ->setattr() and ->getattr() are called in various cases.
752 * chmod, stat: dentry is revalidated.
753 * fchmod, fstat: file and dentry are not revalidated, additionally they may be
754 * unhashed.
755 * for ->setattr(), ia->ia_file is passed from ftruncate only.
756 */
757 /* todo: consolidate with do_refresh() and simple_reval_dpath() */
758 int au_reval_for_attr(struct dentry *dentry, unsigned int sigen)
759 {
760 int err;
761 struct dentry *parent;
762
763 err = 0;
764 if (au_digen_test(dentry, sigen)) {
765 parent = dget_parent(dentry);
766 di_read_lock_parent(parent, AuLock_IR);
767 err = au_refresh_dentry(dentry, parent);
768 di_read_unlock(parent, AuLock_IR);
769 dput(parent);
770 }
771
772 AuTraceErr(err);
773 return err;
774 }
775
776 int au_pin_and_icpup(struct dentry *dentry, struct iattr *ia,
777 struct au_icpup_args *a)
778 {
779 int err;
780 loff_t sz;
781 aufs_bindex_t btop, ibtop;
782 struct dentry *hi_wh, *parent;
783 struct inode *inode;
784 struct au_wr_dir_args wr_dir_args = {
785 .force_btgt = -1,
786 .flags = 0
787 };
788
789 if (d_is_dir(dentry))
790 au_fset_wrdir(wr_dir_args.flags, ISDIR);
791 /* plink or hi_wh() case */
792 btop = au_dbtop(dentry);
793 inode = d_inode(dentry);
794 ibtop = au_ibtop(inode);
795 if (btop != ibtop && !au_test_ro(inode->i_sb, ibtop, inode))
796 wr_dir_args.force_btgt = ibtop;
797 err = au_wr_dir(dentry, /*src_dentry*/NULL, &wr_dir_args);
798 if (unlikely(err < 0))
799 goto out;
800 a->btgt = err;
801 if (err != btop)
802 au_fset_icpup(a->flags, DID_CPUP);
803
804 err = 0;
805 a->pin_flags = AuPin_MNT_WRITE;
806 parent = NULL;
807 if (!IS_ROOT(dentry)) {
808 au_fset_pin(a->pin_flags, DI_LOCKED);
809 parent = dget_parent(dentry);
810 di_write_lock_parent(parent);
811 }
812
813 err = au_pin(&a->pin, dentry, a->btgt, a->udba, a->pin_flags);
814 if (unlikely(err))
815 goto out_parent;
816
817 sz = -1;
818 a->h_path.dentry = au_h_dptr(dentry, btop);
819 a->h_inode = d_inode(a->h_path.dentry);
820 if (ia && (ia->ia_valid & ATTR_SIZE)) {
821 vfsub_inode_lock_shared_nested(a->h_inode, AuLsc_I_CHILD);
822 if (ia->ia_size < i_size_read(a->h_inode))
823 sz = ia->ia_size;
824 inode_unlock_shared(a->h_inode);
825 }
826
827 hi_wh = NULL;
828 if (au_ftest_icpup(a->flags, DID_CPUP) && d_unlinked(dentry)) {
829 hi_wh = au_hi_wh(inode, a->btgt);
830 if (!hi_wh) {
831 struct au_cp_generic cpg = {
832 .dentry = dentry,
833 .bdst = a->btgt,
834 .bsrc = -1,
835 .len = sz,
836 .pin = &a->pin
837 };
838 err = au_sio_cpup_wh(&cpg, /*file*/NULL);
839 if (unlikely(err))
840 goto out_unlock;
841 hi_wh = au_hi_wh(inode, a->btgt);
842 /* todo: revalidate hi_wh? */
843 }
844 }
845
846 if (parent) {
847 au_pin_set_parent_lflag(&a->pin, /*lflag*/0);
848 di_downgrade_lock(parent, AuLock_IR);
849 dput(parent);
850 parent = NULL;
851 }
852 if (!au_ftest_icpup(a->flags, DID_CPUP))
853 goto out; /* success */
854
855 if (!d_unhashed(dentry)) {
856 struct au_cp_generic cpg = {
857 .dentry = dentry,
858 .bdst = a->btgt,
859 .bsrc = btop,
860 .len = sz,
861 .pin = &a->pin,
862 .flags = AuCpup_DTIME | AuCpup_HOPEN
863 };
864 err = au_sio_cpup_simple(&cpg);
865 if (!err)
866 a->h_path.dentry = au_h_dptr(dentry, a->btgt);
867 } else if (!hi_wh)
868 a->h_path.dentry = au_h_dptr(dentry, a->btgt);
869 else
870 a->h_path.dentry = hi_wh; /* do not dget here */
871
872 out_unlock:
873 a->h_inode = d_inode(a->h_path.dentry);
874 if (!err)
875 goto out; /* success */
876 au_unpin(&a->pin);
877 out_parent:
878 if (parent) {
879 di_write_unlock(parent);
880 dput(parent);
881 }
882 out:
883 if (!err)
884 inode_lock_nested(a->h_inode, AuLsc_I_CHILD);
885 return err;
886 }
887
888 static int aufs_setattr(struct dentry *dentry, struct iattr *ia)
889 {
890 int err;
891 struct inode *inode, *delegated;
892 struct super_block *sb;
893 struct file *file;
894 struct au_icpup_args *a;
895
896 inode = d_inode(dentry);
897 IMustLock(inode);
898
899 err = setattr_prepare(dentry, ia);
900 if (unlikely(err))
901 goto out;
902
903 err = -ENOMEM;
904 a = kzalloc(sizeof(*a), GFP_NOFS);
905 if (unlikely(!a))
906 goto out;
907
908 if (ia->ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID))
909 ia->ia_valid &= ~ATTR_MODE;
910
911 file = NULL;
912 sb = dentry->d_sb;
913 err = si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLM);
914 if (unlikely(err))
915 goto out_kfree;
916
917 if (ia->ia_valid & ATTR_FILE) {
918 /* currently ftruncate(2) only */
919 AuDebugOn(!d_is_reg(dentry));
920 file = ia->ia_file;
921 err = au_reval_and_lock_fdi(file, au_reopen_nondir, /*wlock*/1,
922 /*fi_lsc*/0);
923 if (unlikely(err))
924 goto out_si;
925 ia->ia_file = au_hf_top(file);
926 a->udba = AuOpt_UDBA_NONE;
927 } else {
928 /* fchmod() doesn't pass ia_file */
929 a->udba = au_opt_udba(sb);
930 di_write_lock_child(dentry);
931 /* no d_unlinked(), to set UDBA_NONE for root */
932 if (d_unhashed(dentry))
933 a->udba = AuOpt_UDBA_NONE;
934 if (a->udba != AuOpt_UDBA_NONE) {
935 AuDebugOn(IS_ROOT(dentry));
936 err = au_reval_for_attr(dentry, au_sigen(sb));
937 if (unlikely(err))
938 goto out_dentry;
939 }
940 }
941
942 err = au_pin_and_icpup(dentry, ia, a);
943 if (unlikely(err < 0))
944 goto out_dentry;
945 if (au_ftest_icpup(a->flags, DID_CPUP)) {
946 ia->ia_file = NULL;
947 ia->ia_valid &= ~ATTR_FILE;
948 }
949
950 a->h_path.mnt = au_sbr_mnt(sb, a->btgt);
951 if ((ia->ia_valid & (ATTR_MODE | ATTR_CTIME))
952 == (ATTR_MODE | ATTR_CTIME)) {
953 err = security_path_chmod(&a->h_path, ia->ia_mode);
954 if (unlikely(err))
955 goto out_unlock;
956 } else if ((ia->ia_valid & (ATTR_UID | ATTR_GID))
957 && (ia->ia_valid & ATTR_CTIME)) {
958 err = security_path_chown(&a->h_path, ia->ia_uid, ia->ia_gid);
959 if (unlikely(err))
960 goto out_unlock;
961 }
962
963 if (ia->ia_valid & ATTR_SIZE) {
964 struct file *f;
965
966 if (ia->ia_size < i_size_read(inode))
967 /* unmap only */
968 truncate_setsize(inode, ia->ia_size);
969
970 f = NULL;
971 if (ia->ia_valid & ATTR_FILE)
972 f = ia->ia_file;
973 inode_unlock(a->h_inode);
974 err = vfsub_trunc(&a->h_path, ia->ia_size, ia->ia_valid, f);
975 inode_lock_nested(a->h_inode, AuLsc_I_CHILD);
976 } else {
977 delegated = NULL;
978 while (1) {
979 err = vfsub_notify_change(&a->h_path, ia, &delegated);
980 if (delegated) {
981 err = break_deleg_wait(&delegated);
982 if (!err)
983 continue;
984 }
985 break;
986 }
987 }
988 /*
989 * regardless aufs 'acl' option setting.
990 * why don't all acl-aware fs call this func from their ->setattr()?
991 */
992 if (!err && (ia->ia_valid & ATTR_MODE))
993 err = vfsub_acl_chmod(a->h_inode, ia->ia_mode);
994 if (!err)
995 au_cpup_attr_changeable(inode);
996
997 out_unlock:
998 inode_unlock(a->h_inode);
999 au_unpin(&a->pin);
1000 if (unlikely(err))
1001 au_update_dbtop(dentry);
1002 out_dentry:
1003 di_write_unlock(dentry);
1004 if (file) {
1005 fi_write_unlock(file);
1006 ia->ia_file = file;
1007 ia->ia_valid |= ATTR_FILE;
1008 }
1009 out_si:
1010 si_read_unlock(sb);
1011 out_kfree:
1012 kfree(a);
1013 out:
1014 AuTraceErr(err);
1015 return err;
1016 }
1017
1018 #if IS_ENABLED(CONFIG_AUFS_XATTR) || IS_ENABLED(CONFIG_FS_POSIX_ACL)
1019 static int au_h_path_to_set_attr(struct dentry *dentry,
1020 struct au_icpup_args *a, struct path *h_path)
1021 {
1022 int err;
1023 struct super_block *sb;
1024
1025 sb = dentry->d_sb;
1026 a->udba = au_opt_udba(sb);
1027 /* no d_unlinked(), to set UDBA_NONE for root */
1028 if (d_unhashed(dentry))
1029 a->udba = AuOpt_UDBA_NONE;
1030 if (a->udba != AuOpt_UDBA_NONE) {
1031 AuDebugOn(IS_ROOT(dentry));
1032 err = au_reval_for_attr(dentry, au_sigen(sb));
1033 if (unlikely(err))
1034 goto out;
1035 }
1036 err = au_pin_and_icpup(dentry, /*ia*/NULL, a);
1037 if (unlikely(err < 0))
1038 goto out;
1039
1040 h_path->dentry = a->h_path.dentry;
1041 h_path->mnt = au_sbr_mnt(sb, a->btgt);
1042
1043 out:
1044 return err;
1045 }
1046
1047 ssize_t au_sxattr(struct dentry *dentry, struct inode *inode,
1048 struct au_sxattr *arg)
1049 {
1050 int err;
1051 struct path h_path;
1052 struct super_block *sb;
1053 struct au_icpup_args *a;
1054 struct inode *h_inode;
1055
1056 IMustLock(inode);
1057
1058 err = -ENOMEM;
1059 a = kzalloc(sizeof(*a), GFP_NOFS);
1060 if (unlikely(!a))
1061 goto out;
1062
1063 sb = dentry->d_sb;
1064 err = si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLM);
1065 if (unlikely(err))
1066 goto out_kfree;
1067
1068 h_path.dentry = NULL; /* silence gcc */
1069 di_write_lock_child(dentry);
1070 err = au_h_path_to_set_attr(dentry, a, &h_path);
1071 if (unlikely(err))
1072 goto out_di;
1073
1074 inode_unlock(a->h_inode);
1075 switch (arg->type) {
1076 case AU_XATTR_SET:
1077 AuDebugOn(d_is_negative(h_path.dentry));
1078 err = vfsub_setxattr(h_path.dentry,
1079 arg->u.set.name, arg->u.set.value,
1080 arg->u.set.size, arg->u.set.flags);
1081 break;
1082 case AU_ACL_SET:
1083 err = -EOPNOTSUPP;
1084 h_inode = d_inode(h_path.dentry);
1085 if (h_inode->i_op->set_acl)
1086 /* this will call posix_acl_update_mode */
1087 err = h_inode->i_op->set_acl(h_inode,
1088 arg->u.acl_set.acl,
1089 arg->u.acl_set.type);
1090 break;
1091 }
1092 if (!err)
1093 au_cpup_attr_timesizes(inode);
1094
1095 au_unpin(&a->pin);
1096 if (unlikely(err))
1097 au_update_dbtop(dentry);
1098
1099 out_di:
1100 di_write_unlock(dentry);
1101 si_read_unlock(sb);
1102 out_kfree:
1103 kfree(a);
1104 out:
1105 AuTraceErr(err);
1106 return err;
1107 }
1108 #endif
1109
1110 static void au_refresh_iattr(struct inode *inode, struct kstat *st,
1111 unsigned int nlink)
1112 {
1113 unsigned int n;
1114
1115 inode->i_mode = st->mode;
1116 /* don't i_[ug]id_write() here */
1117 inode->i_uid = st->uid;
1118 inode->i_gid = st->gid;
1119 inode->i_atime = st->atime;
1120 inode->i_mtime = st->mtime;
1121 inode->i_ctime = st->ctime;
1122
1123 au_cpup_attr_nlink(inode, /*force*/0);
1124 if (S_ISDIR(inode->i_mode)) {
1125 n = inode->i_nlink;
1126 n -= nlink;
1127 n += st->nlink;
1128 smp_mb(); /* for i_nlink */
1129 /* 0 can happen */
1130 set_nlink(inode, n);
1131 }
1132
1133 spin_lock(&inode->i_lock);
1134 inode->i_blocks = st->blocks;
1135 i_size_write(inode, st->size);
1136 spin_unlock(&inode->i_lock);
1137 }
1138
1139 /*
1140 * common routine for aufs_getattr() and au_getxattr().
1141 * returns zero or negative (an error).
1142 * @dentry will be read-locked in success.
1143 */
1144 int au_h_path_getattr(struct dentry *dentry, int force, struct path *h_path,
1145 int locked)
1146 {
1147 int err;
1148 unsigned int mnt_flags, sigen;
1149 unsigned char udba_none;
1150 aufs_bindex_t bindex;
1151 struct super_block *sb, *h_sb;
1152 struct inode *inode;
1153
1154 h_path->mnt = NULL;
1155 h_path->dentry = NULL;
1156
1157 err = 0;
1158 sb = dentry->d_sb;
1159 mnt_flags = au_mntflags(sb);
1160 udba_none = !!au_opt_test(mnt_flags, UDBA_NONE);
1161
1162 if (unlikely(locked))
1163 goto body; /* skip locking dinfo */
1164
1165 /* support fstat(2) */
1166 if (!d_unlinked(dentry) && !udba_none) {
1167 sigen = au_sigen(sb);
1168 err = au_digen_test(dentry, sigen);
1169 if (!err) {
1170 di_read_lock_child(dentry, AuLock_IR);
1171 err = au_dbrange_test(dentry);
1172 if (unlikely(err)) {
1173 di_read_unlock(dentry, AuLock_IR);
1174 goto out;
1175 }
1176 } else {
1177 AuDebugOn(IS_ROOT(dentry));
1178 di_write_lock_child(dentry);
1179 err = au_dbrange_test(dentry);
1180 if (!err)
1181 err = au_reval_for_attr(dentry, sigen);
1182 if (!err)
1183 di_downgrade_lock(dentry, AuLock_IR);
1184 else {
1185 di_write_unlock(dentry);
1186 goto out;
1187 }
1188 }
1189 } else
1190 di_read_lock_child(dentry, AuLock_IR);
1191
1192 body:
1193 inode = d_inode(dentry);
1194 bindex = au_ibtop(inode);
1195 h_path->mnt = au_sbr_mnt(sb, bindex);
1196 h_sb = h_path->mnt->mnt_sb;
1197 if (!force
1198 && !au_test_fs_bad_iattr(h_sb)
1199 && udba_none)
1200 goto out; /* success */
1201
1202 if (au_dbtop(dentry) == bindex)
1203 h_path->dentry = au_h_dptr(dentry, bindex);
1204 else if (au_opt_test(mnt_flags, PLINK) && au_plink_test(inode)) {
1205 h_path->dentry = au_plink_lkup(inode, bindex);
1206 if (IS_ERR(h_path->dentry))
1207 /* pretending success */
1208 h_path->dentry = NULL;
1209 else
1210 dput(h_path->dentry);
1211 }
1212
1213 out:
1214 return err;
1215 }
1216
1217 static int aufs_getattr(const struct path *path, struct kstat *st,
1218 u32 request, unsigned int query)
1219 {
1220 int err;
1221 unsigned char positive;
1222 struct path h_path;
1223 struct dentry *dentry;
1224 struct inode *inode;
1225 struct super_block *sb;
1226
1227 dentry = path->dentry;
1228 inode = d_inode(dentry);
1229 sb = dentry->d_sb;
1230 err = si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLM);
1231 if (unlikely(err))
1232 goto out;
1233 err = au_h_path_getattr(dentry, /*force*/0, &h_path, /*locked*/0);
1234 if (unlikely(err))
1235 goto out_si;
1236 if (unlikely(!h_path.dentry))
1237 /* illegally overlapped or something */
1238 goto out_fill; /* pretending success */
1239
1240 positive = d_is_positive(h_path.dentry);
1241 if (positive)
1242 /* no vfsub version */
1243 err = vfs_getattr(&h_path, st, request, query);
1244 if (!err) {
1245 if (positive)
1246 au_refresh_iattr(inode, st,
1247 d_inode(h_path.dentry)->i_nlink);
1248 goto out_fill; /* success */
1249 }
1250 AuTraceErr(err);
1251 goto out_di;
1252
1253 out_fill:
1254 generic_fillattr(inode, st);
1255 out_di:
1256 di_read_unlock(dentry, AuLock_IR);
1257 out_si:
1258 si_read_unlock(sb);
1259 out:
1260 AuTraceErr(err);
1261 return err;
1262 }
1263
1264 /* ---------------------------------------------------------------------- */
1265
1266 static const char *aufs_get_link(struct dentry *dentry, struct inode *inode,
1267 struct delayed_call *done)
1268 {
1269 const char *ret;
1270 struct dentry *h_dentry;
1271 struct inode *h_inode;
1272 int err;
1273 aufs_bindex_t bindex;
1274
1275 ret = NULL; /* suppress a warning */
1276 err = -ECHILD;
1277 if (!dentry)
1278 goto out;
1279
1280 err = aufs_read_lock(dentry, AuLock_IR | AuLock_GEN);
1281 if (unlikely(err))
1282 goto out;
1283
1284 err = au_d_hashed_positive(dentry);
1285 if (unlikely(err))
1286 goto out_unlock;
1287
1288 err = -EINVAL;
1289 inode = d_inode(dentry);
1290 bindex = au_ibtop(inode);
1291 h_inode = au_h_iptr(inode, bindex);
1292 if (unlikely(!h_inode->i_op->get_link))
1293 goto out_unlock;
1294
1295 err = -EBUSY;
1296 h_dentry = NULL;
1297 if (au_dbtop(dentry) <= bindex) {
1298 h_dentry = au_h_dptr(dentry, bindex);
1299 if (h_dentry)
1300 dget(h_dentry);
1301 }
1302 if (!h_dentry) {
1303 h_dentry = d_find_any_alias(h_inode);
1304 if (IS_ERR(h_dentry)) {
1305 err = PTR_ERR(h_dentry);
1306 goto out_unlock;
1307 }
1308 }
1309 if (unlikely(!h_dentry))
1310 goto out_unlock;
1311
1312 err = 0;
1313 AuDbg("%pf\n", h_inode->i_op->get_link);
1314 AuDbgDentry(h_dentry);
1315 ret = vfs_get_link(h_dentry, done);
1316 dput(h_dentry);
1317 if (IS_ERR(ret))
1318 err = PTR_ERR(ret);
1319
1320 out_unlock:
1321 aufs_read_unlock(dentry, AuLock_IR);
1322 out:
1323 if (unlikely(err))
1324 ret = ERR_PTR(err);
1325 AuTraceErrPtr(ret);
1326 return ret;
1327 }
1328
1329 /* ---------------------------------------------------------------------- */
1330
1331 static int au_is_special(struct inode *inode)
1332 {
1333 return (inode->i_mode & (S_IFBLK | S_IFCHR | S_IFIFO | S_IFSOCK));
1334 }
1335
1336 static int aufs_update_time(struct inode *inode, struct timespec *ts, int flags)
1337 {
1338 int err;
1339 aufs_bindex_t bindex;
1340 struct super_block *sb;
1341 struct inode *h_inode;
1342 struct vfsmount *h_mnt;
1343
1344 sb = inode->i_sb;
1345 WARN_ONCE((flags & S_ATIME) && !IS_NOATIME(inode),
1346 "unexpected s_flags 0x%lx", sb->s_flags);
1347
1348 /* mmap_sem might be acquired already, cf. aufs_mmap() */
1349 lockdep_off();
1350 si_read_lock(sb, AuLock_FLUSH);
1351 ii_write_lock_child(inode);
1352 lockdep_on();
1353
1354 err = 0;
1355 bindex = au_ibtop(inode);
1356 h_inode = au_h_iptr(inode, bindex);
1357 if (!au_test_ro(sb, bindex, inode)) {
1358 h_mnt = au_sbr_mnt(sb, bindex);
1359 err = vfsub_mnt_want_write(h_mnt);
1360 if (!err) {
1361 err = vfsub_update_time(h_inode, ts, flags);
1362 vfsub_mnt_drop_write(h_mnt);
1363 }
1364 } else if (au_is_special(h_inode)) {
1365 /*
1366 * Never copy-up here.
1367 * These special files may already be opened and used for
1368 * communicating. If we copied it up, then the communication
1369 * would be corrupted.
1370 */
1371 AuWarn1("timestamps for i%lu are ignored "
1372 "since it is on readonly branch (hi%lu).\n",
1373 inode->i_ino, h_inode->i_ino);
1374 } else if (flags & ~S_ATIME) {
1375 err = -EIO;
1376 AuIOErr1("unexpected flags 0x%x\n", flags);
1377 AuDebugOn(1);
1378 }
1379
1380 lockdep_off();
1381 if (!err)
1382 au_cpup_attr_timesizes(inode);
1383 ii_write_unlock(inode);
1384 si_read_unlock(sb);
1385 lockdep_on();
1386
1387 if (!err && (flags & S_VERSION))
1388 inode_inc_iversion(inode);
1389
1390 return err;
1391 }
1392
1393 /* ---------------------------------------------------------------------- */
1394
1395 /* no getattr version will be set by module.c:aufs_init() */
1396 struct inode_operations aufs_iop_nogetattr[AuIop_Last],
1397 aufs_iop[] = {
1398 [AuIop_SYMLINK] = {
1399 .permission = aufs_permission,
1400 #ifdef CONFIG_FS_POSIX_ACL
1401 .get_acl = aufs_get_acl,
1402 .set_acl = aufs_set_acl, /* unsupport for symlink? */
1403 #endif
1404
1405 .setattr = aufs_setattr,
1406 .getattr = aufs_getattr,
1407
1408 #ifdef CONFIG_AUFS_XATTR
1409 .listxattr = aufs_listxattr,
1410 #endif
1411
1412 .get_link = aufs_get_link,
1413
1414 /* .update_time = aufs_update_time */
1415 },
1416 [AuIop_DIR] = {
1417 .create = aufs_create,
1418 .lookup = aufs_lookup,
1419 .link = aufs_link,
1420 .unlink = aufs_unlink,
1421 .symlink = aufs_symlink,
1422 .mkdir = aufs_mkdir,
1423 .rmdir = aufs_rmdir,
1424 .mknod = aufs_mknod,
1425 .rename = aufs_rename,
1426
1427 .permission = aufs_permission,
1428 #ifdef CONFIG_FS_POSIX_ACL
1429 .get_acl = aufs_get_acl,
1430 .set_acl = aufs_set_acl,
1431 #endif
1432
1433 .setattr = aufs_setattr,
1434 .getattr = aufs_getattr,
1435
1436 #ifdef CONFIG_AUFS_XATTR
1437 .listxattr = aufs_listxattr,
1438 #endif
1439
1440 .update_time = aufs_update_time,
1441 .atomic_open = aufs_atomic_open,
1442 .tmpfile = aufs_tmpfile
1443 },
1444 [AuIop_OTHER] = {
1445 .permission = aufs_permission,
1446 #ifdef CONFIG_FS_POSIX_ACL
1447 .get_acl = aufs_get_acl,
1448 .set_acl = aufs_set_acl,
1449 #endif
1450
1451 .setattr = aufs_setattr,
1452 .getattr = aufs_getattr,
1453
1454 #ifdef CONFIG_AUFS_XATTR
1455 .listxattr = aufs_listxattr,
1456 #endif
1457
1458 .update_time = aufs_update_time
1459 }
1460 };