2 * Copyright (C) 2005-2017 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_free_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_gen_fmt(char *fmt
, int len __maybe_unused
, const char *pat
,
131 AuDebugOn(strlen(fmt
) >= len
);
134 static void au_show_wbr_create(struct seq_file
*m
, int v
,
135 struct au_sbinfo
*sbinfo
)
139 struct au_wbr_mfs
*mfs
;
141 AuRwMustAnyLock(&sbinfo
->si_rwsem
);
143 seq_puts(m
, ",create=");
144 pat
= au_optstr_wbr_create(v
);
145 mfs
= &sbinfo
->si_wbr_mfs
;
147 case AuWbrCreate_TDP
:
149 case AuWbrCreate_MFS
:
150 case AuWbrCreate_PMFS
:
153 case AuWbrCreate_MFSRR
:
154 case AuWbrCreate_TDMFS
:
155 case AuWbrCreate_PMFSRR
:
156 au_gen_fmt(fmt
, sizeof(fmt
), pat
, "%llu");
157 seq_printf(m
, fmt
, mfs
->mfsrr_watermark
);
159 case AuWbrCreate_MFSV
:
160 case AuWbrCreate_PMFSV
:
161 au_gen_fmt(fmt
, sizeof(fmt
), pat
, "%lu");
163 jiffies_to_msecs(mfs
->mfs_expire
)
166 case AuWbrCreate_MFSRRV
:
167 case AuWbrCreate_TDMFSV
:
168 case AuWbrCreate_PMFSRRV
:
169 au_gen_fmt(fmt
, sizeof(fmt
), pat
, "%llu:%lu");
170 seq_printf(m
, fmt
, mfs
->mfsrr_watermark
,
171 jiffies_to_msecs(mfs
->mfs_expire
) / MSEC_PER_SEC
);
178 static int au_show_xino(struct seq_file
*seq
, struct super_block
*sb
)
184 const int len
= sizeof(AUFS_XINO_FNAME
) - 1;
185 aufs_bindex_t bindex
, brid
;
188 struct dentry
*d
, *h_root
;
190 AuRwMustAnyLock(&sbinfo
->si_rwsem
);
193 f
= au_sbi(sb
)->si_xib
;
197 /* stop printing the default xino path on the first writable branch */
199 brid
= au_xino_brid(sb
);
201 bindex
= au_br_index(sb
, brid
);
202 h_root
= au_hdentry(au_di(sb
->s_root
), bindex
)->hd_dentry
;
204 d
= f
->f_path
.dentry
;
206 /* safe ->d_parent because the file is unlinked */
207 if (d
->d_parent
== h_root
209 && !memcmp(name
->name
, AUFS_XINO_FNAME
, len
))
212 seq_puts(seq
, ",xino=");
213 err
= au_xino_path(seq
, f
);
220 /* seq_file will re-call me in case of too long string */
221 static int aufs_show_options(struct seq_file
*m
, struct dentry
*dentry
)
224 unsigned int mnt_flags
, v
;
225 struct super_block
*sb
;
226 struct au_sbinfo
*sbinfo
;
228 #define AuBool(name, str) do { \
229 v = au_opt_test(mnt_flags, name); \
230 if (v != au_opt_test(AuOpt_Def, name)) \
231 seq_printf(m, ",%s" #str, v ? "" : "no"); \
234 #define AuStr(name, str) do { \
235 v = mnt_flags & AuOptMask_##name; \
236 if (v != (AuOpt_Def & AuOptMask_##name)) \
237 seq_printf(m, "," #str "=%s", au_optstr_##str(v)); \
240 #define AuUInt(name, str, val) do { \
241 if (val != AUFS_##name##_DEF) \
242 seq_printf(m, "," #str "=%u", val); \
246 if (sb
->s_flags
& MS_POSIXACL
)
249 /* lock free root dinfo */
250 si_noflush_read_lock(sb
);
252 seq_printf(m
, ",si=%lx", sysaufs_si_id(sbinfo
));
254 mnt_flags
= au_mntflags(sb
);
255 if (au_opt_test(mnt_flags
, XINO
)) {
256 err
= au_show_xino(m
, sb
);
260 seq_puts(m
, ",noxino");
262 AuBool(TRUNC_XINO
, trunc_xino
);
265 AuBool(PLINK
, plink
);
267 AuBool(DIRPERM1
, dirperm1
);
269 v
= sbinfo
->si_wbr_create
;
270 if (v
!= AuWbrCreate_Def
)
271 au_show_wbr_create(m
, v
, sbinfo
);
273 v
= sbinfo
->si_wbr_copyup
;
274 if (v
!= AuWbrCopyup_Def
)
275 seq_printf(m
, ",cpup=%s", au_optstr_wbr_copyup(v
));
277 v
= au_opt_test(mnt_flags
, ALWAYS_DIROPQ
);
278 if (v
!= au_opt_test(AuOpt_Def
, ALWAYS_DIROPQ
))
279 seq_printf(m
, ",diropq=%c", v
? 'a' : 'w');
281 AuUInt(DIRWH
, dirwh
, sbinfo
->si_dirwh
);
283 v
= jiffies_to_msecs(sbinfo
->si_rdcache
) / MSEC_PER_SEC
;
284 AuUInt(RDCACHE
, rdcache
, v
);
286 AuUInt(RDBLK
, rdblk
, sbinfo
->si_rdblk
);
287 AuUInt(RDHASH
, rdhash
, sbinfo
->si_rdhash
);
289 au_fhsm_show(m
, sbinfo
);
292 /* AuBool(SUM_W, wsum); */
293 AuBool(WARN_PERM
, warn_perm
);
294 AuBool(VERBOSE
, verbose
);
297 /* be sure to print "br:" last */
310 /* ---------------------------------------------------------------------- */
312 /* sum mode which returns the summation for statfs(2) */
314 static u64
au_add_till_max(u64 a
, u64 b
)
325 static u64
au_mul_till_max(u64 a
, long mul
)
336 static int au_statfs_sum(struct super_block
*sb
, struct kstatfs
*buf
)
340 u64 blocks
, bfree
, bavail
, files
, ffree
;
341 aufs_bindex_t bbot
, bindex
, i
;
342 unsigned char shared
;
344 struct super_block
*h_sb
;
354 for (bindex
= 0; bindex
<= bbot
; bindex
++) {
355 h_path
.mnt
= au_sbr_mnt(sb
, bindex
);
356 h_sb
= h_path
.mnt
->mnt_sb
;
358 for (i
= 0; !shared
&& i
< bindex
; i
++)
359 shared
= (au_sbr_sb(sb
, i
) == h_sb
);
363 /* sb->s_root for NFS is unreliable */
364 h_path
.dentry
= h_path
.mnt
->mnt_root
;
365 err
= vfs_statfs(&h_path
, buf
);
369 if (bsize
> buf
->f_bsize
) {
371 * we will reduce bsize, so we have to expand blocks
372 * etc. to match them again
374 factor
= (bsize
/ buf
->f_bsize
);
375 blocks
= au_mul_till_max(blocks
, factor
);
376 bfree
= au_mul_till_max(bfree
, factor
);
377 bavail
= au_mul_till_max(bavail
, factor
);
378 bsize
= buf
->f_bsize
;
381 factor
= (buf
->f_bsize
/ bsize
);
382 blocks
= au_add_till_max(blocks
,
383 au_mul_till_max(buf
->f_blocks
, factor
));
384 bfree
= au_add_till_max(bfree
,
385 au_mul_till_max(buf
->f_bfree
, factor
));
386 bavail
= au_add_till_max(bavail
,
387 au_mul_till_max(buf
->f_bavail
, factor
));
388 files
= au_add_till_max(files
, buf
->f_files
);
389 ffree
= au_add_till_max(ffree
, buf
->f_ffree
);
392 buf
->f_bsize
= bsize
;
393 buf
->f_blocks
= blocks
;
394 buf
->f_bfree
= bfree
;
395 buf
->f_bavail
= bavail
;
396 buf
->f_files
= files
;
397 buf
->f_ffree
= ffree
;
404 static int aufs_statfs(struct dentry
*dentry
, struct kstatfs
*buf
)
408 struct super_block
*sb
;
410 /* lock free root dinfo */
412 si_noflush_read_lock(sb
);
413 if (!au_opt_test(au_mntflags(sb
), SUM
)) {
414 /* sb->s_root for NFS is unreliable */
415 h_path
.mnt
= au_sbr_mnt(sb
, 0);
416 h_path
.dentry
= h_path
.mnt
->mnt_root
;
417 err
= vfs_statfs(&h_path
, buf
);
419 err
= au_statfs_sum(sb
, buf
);
423 buf
->f_type
= AUFS_SUPER_MAGIC
;
424 buf
->f_namelen
= AUFS_MAX_NAMELEN
;
425 memset(&buf
->f_fsid
, 0, sizeof(buf
->f_fsid
));
427 /* buf->f_bsize = buf->f_blocks = buf->f_bfree = buf->f_bavail = -1; */
432 /* ---------------------------------------------------------------------- */
434 static int aufs_sync_fs(struct super_block
*sb
, int wait
)
437 aufs_bindex_t bbot
, bindex
;
438 struct au_branch
*br
;
439 struct super_block
*h_sb
;
442 si_noflush_read_lock(sb
);
444 for (bindex
= 0; bindex
<= bbot
; bindex
++) {
445 br
= au_sbr(sb
, bindex
);
446 if (!au_br_writable(br
->br_perm
))
449 h_sb
= au_sbr_sb(sb
, bindex
);
450 e
= vfsub_sync_filesystem(h_sb
, wait
);
451 if (unlikely(e
&& !err
))
453 /* go on even if an error happens */
460 /* ---------------------------------------------------------------------- */
462 /* final actions when unmounting a file system */
463 static void aufs_put_super(struct super_block
*sb
)
465 struct au_sbinfo
*sbinfo
;
471 dbgaufs_si_fin(sbinfo
);
472 kobject_put(&sbinfo
->si_kobj
);
475 /* ---------------------------------------------------------------------- */
477 void *au_array_alloc(unsigned long long *hint
, au_arraycb_t cb
,
478 struct super_block
*sb
, void *arg
)
481 unsigned long long n
, sz
;
488 if (*hint
> ULLONG_MAX
/ sizeof(array
)) {
489 array
= ERR_PTR(-EMFILE
);
490 pr_err("hint %llu\n", *hint
);
494 sz
= sizeof(array
) * *hint
;
495 array
= kzalloc(sz
, GFP_NOFS
);
496 if (unlikely(!array
))
498 if (unlikely(!array
)) {
499 array
= ERR_PTR(-ENOMEM
);
503 n
= cb(sb
, array
, *hint
, arg
);
504 AuDebugOn(n
> *hint
);
511 static unsigned long long au_iarray_cb(struct super_block
*sb
, void *a
,
512 unsigned long long max __maybe_unused
,
515 unsigned long long n
;
516 struct inode
**p
, *inode
;
517 struct list_head
*head
;
522 spin_lock(&sb
->s_inode_list_lock
);
523 list_for_each_entry(inode
, head
, i_sb_list
) {
524 if (!au_is_bad_inode(inode
)
525 && au_ii(inode
)->ii_btop
>= 0) {
526 spin_lock(&inode
->i_lock
);
527 if (atomic_read(&inode
->i_count
)) {
533 spin_unlock(&inode
->i_lock
);
536 spin_unlock(&sb
->s_inode_list_lock
);
541 struct inode
**au_iarray_alloc(struct super_block
*sb
, unsigned long long *max
)
543 *max
= au_ninodes(sb
);
544 return au_array_alloc(max
, au_iarray_cb
, sb
, &sb
->s_inodes
);
547 void au_iarray_free(struct inode
**a
, unsigned long long max
)
549 unsigned long long ull
;
551 for (ull
= 0; ull
< max
; ull
++)
556 /* ---------------------------------------------------------------------- */
559 * refresh dentry and inode at remount time.
561 /* todo: consolidate with simple_reval_dpath() and au_reval_for_attr() */
562 static int au_do_refresh(struct dentry
*dentry
, unsigned int dir_flags
,
563 struct dentry
*parent
)
567 di_write_lock_child(dentry
);
568 di_read_lock_parent(parent
, AuLock_IR
);
569 err
= au_refresh_dentry(dentry
, parent
);
570 if (!err
&& dir_flags
)
571 au_hn_reset(d_inode(dentry
), dir_flags
);
572 di_read_unlock(parent
, AuLock_IR
);
573 di_write_unlock(dentry
);
578 static int au_do_refresh_d(struct dentry
*dentry
, unsigned int sigen
,
579 struct au_sbinfo
*sbinfo
,
580 const unsigned int dir_flags
, unsigned int do_idop
)
583 struct dentry
*parent
;
586 parent
= dget_parent(dentry
);
587 if (!au_digen_test(parent
, sigen
) && au_digen_test(dentry
, sigen
)) {
588 if (d_really_is_positive(dentry
)) {
589 if (!d_is_dir(dentry
))
590 err
= au_do_refresh(dentry
, /*dir_flags*/0,
593 err
= au_do_refresh(dentry
, dir_flags
, parent
);
595 au_fset_si(sbinfo
, FAILED_REFRESH_DIR
);
598 err
= au_do_refresh(dentry
, /*dir_flags*/0, parent
);
605 au_refresh_dop(dentry
, /*force_reval*/0);
607 au_refresh_dop(dentry
, /*force_reval*/1);
613 static int au_refresh_d(struct super_block
*sb
, unsigned int do_idop
)
615 int err
, i
, j
, ndentry
, e
;
617 struct au_dcsub_pages dpages
;
618 struct au_dpage
*dpage
;
619 struct dentry
**dentries
, *d
;
620 struct au_sbinfo
*sbinfo
;
621 struct dentry
*root
= sb
->s_root
;
622 const unsigned int dir_flags
= au_hi_flags(d_inode(root
), /*isdir*/1);
625 au_refresh_dop(root
, /*force_reval*/0);
627 err
= au_dpages_init(&dpages
, GFP_NOFS
);
630 err
= au_dcsub_pages(&dpages
, root
, NULL
, NULL
);
634 sigen
= au_sigen(sb
);
636 for (i
= 0; i
< dpages
.ndpage
; i
++) {
637 dpage
= dpages
.dpages
+ i
;
638 dentries
= dpage
->dentries
;
639 ndentry
= dpage
->ndentry
;
640 for (j
= 0; j
< ndentry
; j
++) {
642 e
= au_do_refresh_d(d
, sigen
, sbinfo
, dir_flags
,
644 if (unlikely(e
&& !err
))
651 au_dpages_free(&dpages
);
656 static int au_refresh_i(struct super_block
*sb
, unsigned int do_idop
)
660 unsigned long long max
, ull
;
661 struct inode
*inode
, **array
;
663 array
= au_iarray_alloc(sb
, &max
);
664 err
= PTR_ERR(array
);
669 sigen
= au_sigen(sb
);
670 for (ull
= 0; ull
< max
; ull
++) {
672 if (unlikely(!inode
))
676 ii_write_lock_child(inode
);
677 if (au_iigen(inode
, NULL
) != sigen
) {
678 e
= au_refresh_hinode_self(inode
);
680 au_refresh_iop(inode
, /*force_getattr*/1);
681 pr_err("error %d, i%lu\n", e
, inode
->i_ino
);
684 /* go on even if err */
688 au_refresh_iop(inode
, /*force_getattr*/0);
689 ii_write_unlock(inode
);
692 au_iarray_free(array
, max
);
698 static void au_remount_refresh(struct super_block
*sb
, unsigned int do_idop
)
702 aufs_bindex_t bindex
, bbot
;
705 struct au_branch
*br
;
706 struct au_sbinfo
*sbi
;
710 au_fclr_si(sbi
, FAILED_REFRESH_DIR
);
713 DiMustNoWaiters(root
);
714 inode
= d_inode(root
);
715 IiMustNoWaiters(inode
);
717 udba
= au_opt_udba(sb
);
719 for (bindex
= 0; bindex
<= bbot
; bindex
++) {
720 br
= au_sbr(sb
, bindex
);
721 err
= au_hnotify_reset_br(udba
, br
, br
->br_perm
);
723 AuIOErr("hnotify failed on br %d, %d, ignored\n",
725 /* go on even if err */
727 au_hn_reset(inode
, au_hi_flags(inode
, /*isdir*/1));
730 if (au_ftest_si(sbi
, NO_DREVAL
)) {
731 AuDebugOn(sb
->s_d_op
== &aufs_dop_noreval
);
732 sb
->s_d_op
= &aufs_dop_noreval
;
733 AuDebugOn(sbi
->si_iop_array
== aufs_iop_nogetattr
);
734 sbi
->si_iop_array
= aufs_iop_nogetattr
;
736 AuDebugOn(sb
->s_d_op
== &aufs_dop
);
737 sb
->s_d_op
= &aufs_dop
;
738 AuDebugOn(sbi
->si_iop_array
== aufs_iop
);
739 sbi
->si_iop_array
= aufs_iop
;
741 pr_info("reset to %pf and %pf\n",
742 sb
->s_d_op
, sbi
->si_iop_array
);
745 di_write_unlock(root
);
746 err
= au_refresh_d(sb
, do_idop
);
747 e
= au_refresh_i(sb
, do_idop
);
748 if (unlikely(e
&& !err
))
750 /* aufs_write_lock() calls ..._child() */
751 di_write_lock_child(root
);
753 au_cpup_attr_all(inode
, /*force*/1);
756 AuIOErr("refresh failed, ignored, %d\n", err
);
759 /* stop extra interpretation of errno in mount(8), and strange error messages */
760 static int cvt_err(int err
)
774 static int aufs_remount_fs(struct super_block
*sb
, int *flags
, char *data
)
777 unsigned int mntflags
;
778 struct au_opts opts
= {
783 struct au_sbinfo
*sbinfo
;
787 if (!data
|| !*data
) {
788 err
= si_write_lock(sb
, AuLock_FLUSH
| AuLock_NOPLM
);
790 di_write_lock_child(root
);
791 err
= au_opts_verify(sb
, *flags
, /*pending*/0);
792 aufs_write_unlock(root
);
798 opts
.opt
= (void *)__get_free_page(GFP_NOFS
);
799 if (unlikely(!opts
.opt
))
801 opts
.max_opt
= PAGE_SIZE
/ sizeof(*opts
.opt
);
802 opts
.flags
= AuOpts_REMOUNT
;
803 opts
.sb_flags
= *flags
;
805 /* parse it before aufs lock */
806 err
= au_opts_parse(sb
, data
, &opts
);
811 inode
= d_inode(root
);
813 err
= si_write_lock(sb
, AuLock_FLUSH
| AuLock_NOPLM
);
816 di_write_lock_child(root
);
818 /* au_opts_remount() may return an error */
819 err
= au_opts_remount(sb
, &opts
);
822 if (au_ftest_opts(opts
.flags
, REFRESH
))
823 au_remount_refresh(sb
, au_ftest_opts(opts
.flags
, REFRESH_IDOP
));
825 if (au_ftest_opts(opts
.flags
, REFRESH_DYAOP
)) {
826 mntflags
= au_mntflags(sb
);
827 do_dx
= !!au_opt_test(mntflags
, DIO
);
828 au_dy_arefresh(do_dx
);
831 au_fhsm_wrote_all(sb
, /*force*/1); /* ?? */
832 aufs_write_unlock(root
);
837 free_page((unsigned long)opts
.opt
);
844 static const struct super_operations aufs_sop
= {
845 .alloc_inode
= aufs_alloc_inode
,
846 .destroy_inode
= aufs_destroy_inode
,
847 /* always deleting, no clearing */
848 .drop_inode
= generic_delete_inode
,
849 .show_options
= aufs_show_options
,
850 .statfs
= aufs_statfs
,
851 .put_super
= aufs_put_super
,
852 .sync_fs
= aufs_sync_fs
,
853 .remount_fs
= aufs_remount_fs
,
854 #ifdef CONFIG_AUFS_BDEV_LOOP
855 .real_loop
= aufs_real_loop
859 /* ---------------------------------------------------------------------- */
861 static int alloc_root(struct super_block
*sb
)
868 inode
= au_iget_locked(sb
, AUFS_ROOT_INO
);
869 err
= PTR_ERR(inode
);
873 inode
->i_op
= aufs_iop
+ AuIop_DIR
; /* with getattr by default */
874 inode
->i_fop
= &aufs_dir_fop
;
875 inode
->i_mode
= S_IFDIR
;
877 unlock_new_inode(inode
);
879 root
= d_make_root(inode
);
886 err
= au_di_init(root
);
889 return 0; /* success */
897 static int aufs_fill_super(struct super_block
*sb
, void *raw_data
,
898 int silent __maybe_unused
)
901 struct au_opts opts
= {
904 struct au_sbinfo
*sbinfo
;
907 char *arg
= raw_data
;
909 if (unlikely(!arg
|| !*arg
)) {
916 opts
.opt
= (void *)__get_free_page(GFP_NOFS
);
917 if (unlikely(!opts
.opt
))
919 opts
.max_opt
= PAGE_SIZE
/ sizeof(*opts
.opt
);
920 opts
.sb_flags
= sb
->s_flags
;
922 err
= au_si_alloc(sb
);
927 /* all timestamps always follow the ones on the branch */
928 sb
->s_flags
|= MS_NOATIME
| MS_NODIRATIME
;
929 sb
->s_op
= &aufs_sop
;
930 sb
->s_d_op
= &aufs_dop
;
931 sb
->s_magic
= AUFS_SUPER_MAGIC
;
933 sb
->s_stack_depth
= 1;
937 err
= alloc_root(sb
);
943 inode
= d_inode(root
);
946 * actually we can parse options regardless aufs lock here.
947 * but at remount time, parsing must be done before aufs lock.
948 * so we follow the same rule.
950 ii_write_lock_parent(inode
);
951 aufs_write_unlock(root
);
952 err
= au_opts_parse(sb
, arg
, &opts
);
956 /* lock vfs_inode first, then aufs. */
958 aufs_write_lock(root
);
959 err
= au_opts_mount(sb
, &opts
);
961 if (!err
&& au_ftest_si(sbinfo
, NO_DREVAL
)) {
962 sb
->s_d_op
= &aufs_dop_noreval
;
963 pr_info("%pf\n", sb
->s_d_op
);
964 au_refresh_dop(root
, /*force_reval*/0);
965 sbinfo
->si_iop_array
= aufs_iop_nogetattr
;
966 au_refresh_iop(inode
, /*force_getattr*/0);
968 aufs_write_unlock(root
);
971 goto out_opts
; /* success */
977 dbgaufs_si_fin(sbinfo
);
978 kobject_put(&sbinfo
->si_kobj
);
979 sb
->s_fs_info
= NULL
;
981 free_page((unsigned long)opts
.opt
);
989 /* ---------------------------------------------------------------------- */
991 static struct dentry
*aufs_mount(struct file_system_type
*fs_type
, int flags
,
992 const char *dev_name __maybe_unused
,
996 struct super_block
*sb
;
998 /* all timestamps always follow the ones on the branch */
999 /* mnt->mnt_flags |= MNT_NOATIME | MNT_NODIRATIME; */
1000 root
= mount_nodev(fs_type
, flags
, raw_data
, aufs_fill_super
);
1005 si_write_lock(sb
, !AuLock_FLUSH
);
1006 sysaufs_brs_add(sb
, 0);
1007 si_write_unlock(sb
);
1014 static void aufs_kill_sb(struct super_block
*sb
)
1016 struct au_sbinfo
*sbinfo
;
1018 sbinfo
= au_sbi(sb
);
1021 aufs_write_lock(sb
->s_root
);
1023 if (sbinfo
->si_wbr_create_ops
->fin
)
1024 sbinfo
->si_wbr_create_ops
->fin(sb
);
1025 if (au_opt_test(sbinfo
->si_mntflags
, UDBA_HNOTIFY
)) {
1026 au_opt_set_udba(sbinfo
->si_mntflags
, UDBA_NONE
);
1027 au_remount_refresh(sb
, /*do_idop*/0);
1029 if (au_opt_test(sbinfo
->si_mntflags
, PLINK
))
1030 au_plink_put(sb
, /*verbose*/1);
1032 sbinfo
->si_sb
= NULL
;
1033 aufs_write_unlock(sb
->s_root
);
1034 au_nwt_flush(&sbinfo
->si_nowait
);
1036 kill_anon_super(sb
);
1039 struct file_system_type aufs_fs_type
= {
1040 .name
= AUFS_FSTYPE
,
1041 /* a race between rename and others */
1042 .fs_flags
= FS_RENAME_DOES_D_MOVE
,
1043 .mount
= aufs_mount
,
1044 .kill_sb
= aufs_kill_sb
,
1045 /* no need to __module_get() and module_put(). */
1046 .owner
= THIS_MODULE
,