2 * Copyright (C) 2005-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 * mount and super_block operations
23 #include <linux/seq_file.h>
24 #include <linux/statfs.h>
25 #include <linux/vmalloc.h>
31 static struct inode
*aufs_alloc_inode(struct super_block
*sb __maybe_unused
)
35 c
= au_cache_alloc_icntnr();
38 c
->vfs_inode
.i_version
= 1; /* sigen(sb); */
39 c
->iinfo
.ii_hinode
= NULL
;
45 static void aufs_destroy_inode_cb(struct rcu_head
*head
)
47 struct inode
*inode
= container_of(head
, struct inode
, i_rcu
);
49 au_cache_dfree_icntnr(container_of(inode
, struct au_icntnr
, vfs_inode
));
52 static void aufs_destroy_inode(struct inode
*inode
)
54 if (!au_is_bad_inode(inode
))
56 call_rcu(&inode
->i_rcu
, aufs_destroy_inode_cb
);
59 struct inode
*au_iget_locked(struct super_block
*sb
, ino_t ino
)
64 inode
= iget_locked(sb
, ino
);
65 if (unlikely(!inode
)) {
66 inode
= ERR_PTR(-ENOMEM
);
69 if (!(inode
->i_state
& I_NEW
))
72 err
= au_xigen_new(inode
);
74 err
= au_iinfo_init(inode
);
83 /* never return NULL */
89 /* lock free root dinfo */
90 static int au_show_brs(struct seq_file
*seq
, struct super_block
*sb
)
93 aufs_bindex_t bindex
, bbot
;
95 struct au_hdentry
*hdp
;
97 au_br_perm_str_t perm
;
102 hdp
= au_hdentry(au_di(sb
->s_root
), bindex
);
103 for (; !err
&& bindex
<= bbot
; bindex
++, hdp
++) {
104 br
= au_sbr(sb
, bindex
);
105 path
.mnt
= au_br_mnt(br
);
106 path
.dentry
= hdp
->hd_dentry
;
107 err
= au_seq_path(seq
, &path
);
109 au_optstr_br_perm(&perm
, br
->br_perm
);
110 seq_printf(seq
, "=%s", perm
.a
);
115 if (unlikely(err
|| seq_has_overflowed(seq
)))
121 static void au_show_wbr_create(struct seq_file
*m
, int v
,
122 struct au_sbinfo
*sbinfo
)
126 AuRwMustAnyLock(&sbinfo
->si_rwsem
);
128 seq_puts(m
, ",create=");
129 pat
= au_optstr_wbr_create(v
);
131 case AuWbrCreate_TDP
:
133 case AuWbrCreate_MFS
:
134 case AuWbrCreate_PMFS
:
137 case AuWbrCreate_MFSV
:
138 seq_printf(m
, /*pat*/"mfs:%lu",
139 jiffies_to_msecs(sbinfo
->si_wbr_mfs
.mfs_expire
)
142 case AuWbrCreate_PMFSV
:
143 seq_printf(m
, /*pat*/"pmfs:%lu",
144 jiffies_to_msecs(sbinfo
->si_wbr_mfs
.mfs_expire
)
147 case AuWbrCreate_MFSRR
:
148 seq_printf(m
, /*pat*/"mfsrr:%llu",
149 sbinfo
->si_wbr_mfs
.mfsrr_watermark
);
151 case AuWbrCreate_MFSRRV
:
152 seq_printf(m
, /*pat*/"mfsrr:%llu:%lu",
153 sbinfo
->si_wbr_mfs
.mfsrr_watermark
,
154 jiffies_to_msecs(sbinfo
->si_wbr_mfs
.mfs_expire
)
157 case AuWbrCreate_PMFSRR
:
158 seq_printf(m
, /*pat*/"pmfsrr:%llu",
159 sbinfo
->si_wbr_mfs
.mfsrr_watermark
);
161 case AuWbrCreate_PMFSRRV
:
162 seq_printf(m
, /*pat*/"pmfsrr:%llu:%lu",
163 sbinfo
->si_wbr_mfs
.mfsrr_watermark
,
164 jiffies_to_msecs(sbinfo
->si_wbr_mfs
.mfs_expire
)
170 static int au_show_xino(struct seq_file
*seq
, struct super_block
*sb
)
176 const int len
= sizeof(AUFS_XINO_FNAME
) - 1;
177 aufs_bindex_t bindex
, brid
;
180 struct dentry
*d
, *h_root
;
182 AuRwMustAnyLock(&sbinfo
->si_rwsem
);
185 f
= au_sbi(sb
)->si_xib
;
189 /* stop printing the default xino path on the first writable branch */
191 brid
= au_xino_brid(sb
);
193 bindex
= au_br_index(sb
, brid
);
194 h_root
= au_hdentry(au_di(sb
->s_root
), bindex
)->hd_dentry
;
196 d
= f
->f_path
.dentry
;
198 /* safe ->d_parent because the file is unlinked */
199 if (d
->d_parent
== h_root
201 && !memcmp(name
->name
, AUFS_XINO_FNAME
, len
))
204 seq_puts(seq
, ",xino=");
205 err
= au_xino_path(seq
, f
);
212 /* seq_file will re-call me in case of too long string */
213 static int aufs_show_options(struct seq_file
*m
, struct dentry
*dentry
)
216 unsigned int mnt_flags
, v
;
217 struct super_block
*sb
;
218 struct au_sbinfo
*sbinfo
;
220 #define AuBool(name, str) do { \
221 v = au_opt_test(mnt_flags, name); \
222 if (v != au_opt_test(AuOpt_Def, name)) \
223 seq_printf(m, ",%s" #str, v ? "" : "no"); \
226 #define AuStr(name, str) do { \
227 v = mnt_flags & AuOptMask_##name; \
228 if (v != (AuOpt_Def & AuOptMask_##name)) \
229 seq_printf(m, "," #str "=%s", au_optstr_##str(v)); \
232 #define AuUInt(name, str, val) do { \
233 if (val != AUFS_##name##_DEF) \
234 seq_printf(m, "," #str "=%u", val); \
238 if (sb
->s_flags
& MS_POSIXACL
)
241 /* lock free root dinfo */
242 si_noflush_read_lock(sb
);
244 seq_printf(m
, ",si=%lx", sysaufs_si_id(sbinfo
));
246 mnt_flags
= au_mntflags(sb
);
247 if (au_opt_test(mnt_flags
, XINO
)) {
248 err
= au_show_xino(m
, sb
);
252 seq_puts(m
, ",noxino");
254 AuBool(TRUNC_XINO
, trunc_xino
);
257 AuBool(PLINK
, plink
);
259 AuBool(DIRPERM1
, dirperm1
);
261 v
= sbinfo
->si_wbr_create
;
262 if (v
!= AuWbrCreate_Def
)
263 au_show_wbr_create(m
, v
, sbinfo
);
265 v
= sbinfo
->si_wbr_copyup
;
266 if (v
!= AuWbrCopyup_Def
)
267 seq_printf(m
, ",cpup=%s", au_optstr_wbr_copyup(v
));
269 v
= au_opt_test(mnt_flags
, ALWAYS_DIROPQ
);
270 if (v
!= au_opt_test(AuOpt_Def
, ALWAYS_DIROPQ
))
271 seq_printf(m
, ",diropq=%c", v
? 'a' : 'w');
273 AuUInt(DIRWH
, dirwh
, sbinfo
->si_dirwh
);
275 v
= jiffies_to_msecs(sbinfo
->si_rdcache
) / MSEC_PER_SEC
;
276 AuUInt(RDCACHE
, rdcache
, v
);
278 AuUInt(RDBLK
, rdblk
, sbinfo
->si_rdblk
);
279 AuUInt(RDHASH
, rdhash
, sbinfo
->si_rdhash
);
281 au_fhsm_show(m
, sbinfo
);
284 /* AuBool(SUM_W, wsum); */
285 AuBool(WARN_PERM
, warn_perm
);
286 AuBool(VERBOSE
, verbose
);
289 /* be sure to print "br:" last */
302 /* ---------------------------------------------------------------------- */
304 /* sum mode which returns the summation for statfs(2) */
306 static u64
au_add_till_max(u64 a
, u64 b
)
317 static u64
au_mul_till_max(u64 a
, long mul
)
328 static int au_statfs_sum(struct super_block
*sb
, struct kstatfs
*buf
)
332 u64 blocks
, bfree
, bavail
, files
, ffree
;
333 aufs_bindex_t bbot
, bindex
, i
;
334 unsigned char shared
;
336 struct super_block
*h_sb
;
346 for (bindex
= 0; bindex
<= bbot
; bindex
++) {
347 h_path
.mnt
= au_sbr_mnt(sb
, bindex
);
348 h_sb
= h_path
.mnt
->mnt_sb
;
350 for (i
= 0; !shared
&& i
< bindex
; i
++)
351 shared
= (au_sbr_sb(sb
, i
) == h_sb
);
355 /* sb->s_root for NFS is unreliable */
356 h_path
.dentry
= h_path
.mnt
->mnt_root
;
357 err
= vfs_statfs(&h_path
, buf
);
361 if (bsize
> buf
->f_bsize
) {
363 * we will reduce bsize, so we have to expand blocks
364 * etc. to match them again
366 factor
= (bsize
/ buf
->f_bsize
);
367 blocks
= au_mul_till_max(blocks
, factor
);
368 bfree
= au_mul_till_max(bfree
, factor
);
369 bavail
= au_mul_till_max(bavail
, factor
);
370 bsize
= buf
->f_bsize
;
373 factor
= (buf
->f_bsize
/ bsize
);
374 blocks
= au_add_till_max(blocks
,
375 au_mul_till_max(buf
->f_blocks
, factor
));
376 bfree
= au_add_till_max(bfree
,
377 au_mul_till_max(buf
->f_bfree
, factor
));
378 bavail
= au_add_till_max(bavail
,
379 au_mul_till_max(buf
->f_bavail
, factor
));
380 files
= au_add_till_max(files
, buf
->f_files
);
381 ffree
= au_add_till_max(ffree
, buf
->f_ffree
);
384 buf
->f_bsize
= bsize
;
385 buf
->f_blocks
= blocks
;
386 buf
->f_bfree
= bfree
;
387 buf
->f_bavail
= bavail
;
388 buf
->f_files
= files
;
389 buf
->f_ffree
= ffree
;
396 static int aufs_statfs(struct dentry
*dentry
, struct kstatfs
*buf
)
400 struct super_block
*sb
;
402 /* lock free root dinfo */
404 si_noflush_read_lock(sb
);
405 if (!au_opt_test(au_mntflags(sb
), SUM
)) {
406 /* sb->s_root for NFS is unreliable */
407 h_path
.mnt
= au_sbr_mnt(sb
, 0);
408 h_path
.dentry
= h_path
.mnt
->mnt_root
;
409 err
= vfs_statfs(&h_path
, buf
);
411 err
= au_statfs_sum(sb
, buf
);
415 buf
->f_type
= AUFS_SUPER_MAGIC
;
416 buf
->f_namelen
= AUFS_MAX_NAMELEN
;
417 memset(&buf
->f_fsid
, 0, sizeof(buf
->f_fsid
));
419 /* buf->f_bsize = buf->f_blocks = buf->f_bfree = buf->f_bavail = -1; */
424 /* ---------------------------------------------------------------------- */
426 static int aufs_sync_fs(struct super_block
*sb
, int wait
)
429 aufs_bindex_t bbot
, bindex
;
430 struct au_branch
*br
;
431 struct super_block
*h_sb
;
434 si_noflush_read_lock(sb
);
436 for (bindex
= 0; bindex
<= bbot
; bindex
++) {
437 br
= au_sbr(sb
, bindex
);
438 if (!au_br_writable(br
->br_perm
))
441 h_sb
= au_sbr_sb(sb
, bindex
);
442 if (h_sb
->s_op
->sync_fs
) {
443 e
= h_sb
->s_op
->sync_fs(h_sb
, wait
);
444 if (unlikely(e
&& !err
))
446 /* go on even if an error happens */
454 /* ---------------------------------------------------------------------- */
456 /* final actions when unmounting a file system */
457 static void aufs_put_super(struct super_block
*sb
)
459 struct au_sbinfo
*sbinfo
;
465 dbgaufs_si_fin(sbinfo
);
466 kobject_put(&sbinfo
->si_kobj
);
469 /* ---------------------------------------------------------------------- */
471 void *au_array_alloc(unsigned long long *hint
, au_arraycb_t cb
,
472 struct super_block
*sb
, void *arg
)
475 unsigned long long n
, sz
;
482 if (*hint
> ULLONG_MAX
/ sizeof(array
)) {
483 array
= ERR_PTR(-EMFILE
);
484 pr_err("hint %llu\n", *hint
);
488 sz
= sizeof(array
) * *hint
;
489 array
= kzalloc(sz
, GFP_NOFS
);
490 if (unlikely(!array
))
492 if (unlikely(!array
)) {
493 array
= ERR_PTR(-ENOMEM
);
497 n
= cb(sb
, array
, *hint
, arg
);
498 AuDebugOn(n
> *hint
);
505 static unsigned long long au_iarray_cb(struct super_block
*sb
, void *a
,
506 unsigned long long max __maybe_unused
,
509 unsigned long long n
;
510 struct inode
**p
, *inode
;
511 struct list_head
*head
;
516 spin_lock(&sb
->s_inode_list_lock
);
517 list_for_each_entry(inode
, head
, i_sb_list
) {
518 if (!au_is_bad_inode(inode
)
519 && au_ii(inode
)->ii_btop
>= 0) {
520 spin_lock(&inode
->i_lock
);
521 if (atomic_read(&inode
->i_count
)) {
527 spin_unlock(&inode
->i_lock
);
530 spin_unlock(&sb
->s_inode_list_lock
);
535 struct inode
**au_iarray_alloc(struct super_block
*sb
, unsigned long long *max
)
537 *max
= au_ninodes(sb
);
538 return au_array_alloc(max
, au_iarray_cb
, sb
, &sb
->s_inodes
);
541 void au_iarray_free(struct inode
**a
, unsigned long long max
)
543 unsigned long long ull
;
545 for (ull
= 0; ull
< max
; ull
++)
550 /* ---------------------------------------------------------------------- */
553 * refresh dentry and inode at remount time.
555 /* todo: consolidate with simple_reval_dpath() and au_reval_for_attr() */
556 static int au_do_refresh(struct dentry
*dentry
, unsigned int dir_flags
,
557 struct dentry
*parent
)
561 di_write_lock_child(dentry
);
562 di_read_lock_parent(parent
, AuLock_IR
);
563 err
= au_refresh_dentry(dentry
, parent
);
564 if (!err
&& dir_flags
)
565 au_hn_reset(d_inode(dentry
), dir_flags
);
566 di_read_unlock(parent
, AuLock_IR
);
567 di_write_unlock(dentry
);
572 static int au_do_refresh_d(struct dentry
*dentry
, unsigned int sigen
,
573 struct au_sbinfo
*sbinfo
,
574 const unsigned int dir_flags
, unsigned int do_idop
)
577 struct dentry
*parent
;
580 parent
= dget_parent(dentry
);
581 if (!au_digen_test(parent
, sigen
) && au_digen_test(dentry
, sigen
)) {
582 if (d_really_is_positive(dentry
)) {
583 if (!d_is_dir(dentry
))
584 err
= au_do_refresh(dentry
, /*dir_flags*/0,
587 err
= au_do_refresh(dentry
, dir_flags
, parent
);
589 au_fset_si(sbinfo
, FAILED_REFRESH_DIR
);
592 err
= au_do_refresh(dentry
, /*dir_flags*/0, parent
);
599 au_refresh_dop(dentry
, /*force_reval*/0);
601 au_refresh_dop(dentry
, /*force_reval*/1);
607 static int au_refresh_d(struct super_block
*sb
, unsigned int do_idop
)
609 int err
, i
, j
, ndentry
, e
;
611 struct au_dcsub_pages dpages
;
612 struct au_dpage
*dpage
;
613 struct dentry
**dentries
, *d
;
614 struct au_sbinfo
*sbinfo
;
615 struct dentry
*root
= sb
->s_root
;
616 const unsigned int dir_flags
= au_hi_flags(d_inode(root
), /*isdir*/1);
619 au_refresh_dop(root
, /*force_reval*/0);
621 err
= au_dpages_init(&dpages
, GFP_NOFS
);
624 err
= au_dcsub_pages(&dpages
, root
, NULL
, NULL
);
628 sigen
= au_sigen(sb
);
630 for (i
= 0; i
< dpages
.ndpage
; i
++) {
631 dpage
= dpages
.dpages
+ i
;
632 dentries
= dpage
->dentries
;
633 ndentry
= dpage
->ndentry
;
634 for (j
= 0; j
< ndentry
; j
++) {
636 e
= au_do_refresh_d(d
, sigen
, sbinfo
, dir_flags
,
638 if (unlikely(e
&& !err
))
645 au_dpages_free(&dpages
);
650 static int au_refresh_i(struct super_block
*sb
, unsigned int do_idop
)
654 unsigned long long max
, ull
;
655 struct inode
*inode
, **array
;
657 array
= au_iarray_alloc(sb
, &max
);
658 err
= PTR_ERR(array
);
663 sigen
= au_sigen(sb
);
664 for (ull
= 0; ull
< max
; ull
++) {
666 if (unlikely(!inode
))
670 ii_write_lock_child(inode
);
671 if (au_iigen(inode
, NULL
) != sigen
) {
672 e
= au_refresh_hinode_self(inode
);
674 au_refresh_iop(inode
, /*force_getattr*/1);
675 pr_err("error %d, i%lu\n", e
, inode
->i_ino
);
678 /* go on even if err */
682 au_refresh_iop(inode
, /*force_getattr*/0);
683 ii_write_unlock(inode
);
686 au_iarray_free(array
, max
);
692 static void au_remount_refresh(struct super_block
*sb
, unsigned int do_idop
)
696 aufs_bindex_t bindex
, bbot
;
699 struct au_branch
*br
;
700 struct au_sbinfo
*sbi
;
704 au_fclr_si(sbi
, FAILED_REFRESH_DIR
);
707 DiMustNoWaiters(root
);
708 inode
= d_inode(root
);
709 IiMustNoWaiters(inode
);
711 udba
= au_opt_udba(sb
);
713 for (bindex
= 0; bindex
<= bbot
; bindex
++) {
714 br
= au_sbr(sb
, bindex
);
715 err
= au_hnotify_reset_br(udba
, br
, br
->br_perm
);
717 AuIOErr("hnotify failed on br %d, %d, ignored\n",
719 /* go on even if err */
721 au_hn_reset(inode
, au_hi_flags(inode
, /*isdir*/1));
724 if (au_ftest_si(sbi
, NO_DREVAL
)) {
725 AuDebugOn(sb
->s_d_op
== &aufs_dop_noreval
);
726 sb
->s_d_op
= &aufs_dop_noreval
;
727 AuDebugOn(sbi
->si_iop_array
== aufs_iop_nogetattr
);
728 sbi
->si_iop_array
= aufs_iop_nogetattr
;
730 AuDebugOn(sb
->s_d_op
== &aufs_dop
);
731 sb
->s_d_op
= &aufs_dop
;
732 AuDebugOn(sbi
->si_iop_array
== aufs_iop
);
733 sbi
->si_iop_array
= aufs_iop
;
735 pr_info("reset to %pf and %pf\n",
736 sb
->s_d_op
, sbi
->si_iop_array
);
739 di_write_unlock(root
);
740 err
= au_refresh_d(sb
, do_idop
);
741 e
= au_refresh_i(sb
, do_idop
);
742 if (unlikely(e
&& !err
))
744 /* aufs_write_lock() calls ..._child() */
745 di_write_lock_child(root
);
747 au_cpup_attr_all(inode
, /*force*/1);
750 AuIOErr("refresh failed, ignored, %d\n", err
);
753 /* stop extra interpretation of errno in mount(8), and strange error messages */
754 static int cvt_err(int err
)
768 static int aufs_remount_fs(struct super_block
*sb
, int *flags
, char *data
)
771 unsigned int mntflags
;
772 struct au_opts opts
= {
777 struct au_sbinfo
*sbinfo
;
781 if (!data
|| !*data
) {
782 err
= si_write_lock(sb
, AuLock_FLUSH
| AuLock_NOPLM
);
784 di_write_lock_child(root
);
785 err
= au_opts_verify(sb
, *flags
, /*pending*/0);
786 aufs_write_unlock(root
);
792 opts
.opt
= (void *)__get_free_page(GFP_NOFS
);
793 if (unlikely(!opts
.opt
))
795 opts
.max_opt
= PAGE_SIZE
/ sizeof(*opts
.opt
);
796 opts
.flags
= AuOpts_REMOUNT
;
797 opts
.sb_flags
= *flags
;
799 /* parse it before aufs lock */
800 err
= au_opts_parse(sb
, data
, &opts
);
805 inode
= d_inode(root
);
807 err
= si_write_lock(sb
, AuLock_FLUSH
| AuLock_NOPLM
);
810 di_write_lock_child(root
);
812 /* au_opts_remount() may return an error */
813 err
= au_opts_remount(sb
, &opts
);
816 if (au_ftest_opts(opts
.flags
, REFRESH
))
817 au_remount_refresh(sb
, au_ftest_opts(opts
.flags
, REFRESH_IDOP
));
819 if (au_ftest_opts(opts
.flags
, REFRESH_DYAOP
)) {
820 mntflags
= au_mntflags(sb
);
821 do_dx
= !!au_opt_test(mntflags
, DIO
);
822 au_dy_arefresh(do_dx
);
825 au_fhsm_wrote_all(sb
, /*force*/1); /* ?? */
826 aufs_write_unlock(root
);
831 au_delayed_free_page((unsigned long)opts
.opt
);
838 static const struct super_operations aufs_sop
= {
839 .alloc_inode
= aufs_alloc_inode
,
840 .destroy_inode
= aufs_destroy_inode
,
841 /* always deleting, no clearing */
842 .drop_inode
= generic_delete_inode
,
843 .show_options
= aufs_show_options
,
844 .statfs
= aufs_statfs
,
845 .put_super
= aufs_put_super
,
846 .sync_fs
= aufs_sync_fs
,
847 .remount_fs
= aufs_remount_fs
850 /* ---------------------------------------------------------------------- */
852 static int alloc_root(struct super_block
*sb
)
859 inode
= au_iget_locked(sb
, AUFS_ROOT_INO
);
860 err
= PTR_ERR(inode
);
864 inode
->i_op
= aufs_iop
+ AuIop_DIR
; /* with getattr by default */
865 inode
->i_fop
= &aufs_dir_fop
;
866 inode
->i_mode
= S_IFDIR
;
868 unlock_new_inode(inode
);
870 root
= d_make_root(inode
);
877 err
= au_di_init(root
);
880 return 0; /* success */
888 static int aufs_fill_super(struct super_block
*sb
, void *raw_data
,
889 int silent __maybe_unused
)
892 struct au_opts opts
= {
895 struct au_sbinfo
*sbinfo
;
898 char *arg
= raw_data
;
900 if (unlikely(!arg
|| !*arg
)) {
907 opts
.opt
= (void *)__get_free_page(GFP_NOFS
);
908 if (unlikely(!opts
.opt
))
910 opts
.max_opt
= PAGE_SIZE
/ sizeof(*opts
.opt
);
911 opts
.sb_flags
= sb
->s_flags
;
913 err
= au_si_alloc(sb
);
918 /* all timestamps always follow the ones on the branch */
919 sb
->s_flags
|= MS_NOATIME
| MS_NODIRATIME
;
920 sb
->s_op
= &aufs_sop
;
921 sb
->s_d_op
= &aufs_dop
;
922 sb
->s_magic
= AUFS_SUPER_MAGIC
;
924 sb
->s_stack_depth
= 1;
926 /* au_xattr_init(sb); */
928 err
= alloc_root(sb
);
934 inode
= d_inode(root
);
937 * actually we can parse options regardless aufs lock here.
938 * but at remount time, parsing must be done before aufs lock.
939 * so we follow the same rule.
941 ii_write_lock_parent(inode
);
942 aufs_write_unlock(root
);
943 err
= au_opts_parse(sb
, arg
, &opts
);
947 /* lock vfs_inode first, then aufs. */
949 aufs_write_lock(root
);
950 err
= au_opts_mount(sb
, &opts
);
952 if (!err
&& au_ftest_si(sbinfo
, NO_DREVAL
)) {
953 sb
->s_d_op
= &aufs_dop_noreval
;
954 pr_info("%pf\n", sb
->s_d_op
);
955 au_refresh_dop(root
, /*force_reval*/0);
956 sbinfo
->si_iop_array
= aufs_iop_nogetattr
;
957 au_refresh_iop(inode
, /*force_getattr*/0);
959 aufs_write_unlock(root
);
962 goto out_opts
; /* success */
968 dbgaufs_si_fin(sbinfo
);
969 kobject_put(&sbinfo
->si_kobj
);
970 sb
->s_fs_info
= NULL
;
972 au_delayed_free_page((unsigned long)opts
.opt
);
980 /* ---------------------------------------------------------------------- */
982 static struct dentry
*aufs_mount(struct file_system_type
*fs_type
, int flags
,
983 const char *dev_name __maybe_unused
,
987 struct super_block
*sb
;
989 /* all timestamps always follow the ones on the branch */
990 /* mnt->mnt_flags |= MNT_NOATIME | MNT_NODIRATIME; */
991 root
= mount_nodev(fs_type
, flags
, raw_data
, aufs_fill_super
);
996 si_write_lock(sb
, !AuLock_FLUSH
);
997 sysaufs_brs_add(sb
, 0);
1005 static void aufs_kill_sb(struct super_block
*sb
)
1007 struct au_sbinfo
*sbinfo
;
1009 sbinfo
= au_sbi(sb
);
1012 aufs_write_lock(sb
->s_root
);
1014 if (sbinfo
->si_wbr_create_ops
->fin
)
1015 sbinfo
->si_wbr_create_ops
->fin(sb
);
1016 if (au_opt_test(sbinfo
->si_mntflags
, UDBA_HNOTIFY
)) {
1017 au_opt_set_udba(sbinfo
->si_mntflags
, UDBA_NONE
);
1018 au_remount_refresh(sb
, /*do_idop*/0);
1020 if (au_opt_test(sbinfo
->si_mntflags
, PLINK
))
1021 au_plink_put(sb
, /*verbose*/1);
1023 sbinfo
->si_sb
= NULL
;
1024 aufs_write_unlock(sb
->s_root
);
1025 au_nwt_flush(&sbinfo
->si_nowait
);
1027 kill_anon_super(sb
);
1030 struct file_system_type aufs_fs_type
= {
1031 .name
= AUFS_FSTYPE
,
1032 /* a race between rename and others */
1033 .fs_flags
= FS_RENAME_DOES_D_MOVE
,
1034 .mount
= aufs_mount
,
1035 .kill_sb
= aufs_kill_sb
,
1036 /* no need to __module_get() and module_put(). */
1037 .owner
= THIS_MODULE
,