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
& SB_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
);
291 AuBool(DIRREN
, dirren
);
293 /* AuBool(SUM_W, wsum); */
294 AuBool(WARN_PERM
, warn_perm
);
295 AuBool(VERBOSE
, verbose
);
298 /* be sure to print "br:" last */
311 /* ---------------------------------------------------------------------- */
313 /* sum mode which returns the summation for statfs(2) */
315 static u64
au_add_till_max(u64 a
, u64 b
)
326 static u64
au_mul_till_max(u64 a
, long mul
)
337 static int au_statfs_sum(struct super_block
*sb
, struct kstatfs
*buf
)
341 u64 blocks
, bfree
, bavail
, files
, ffree
;
342 aufs_bindex_t bbot
, bindex
, i
;
343 unsigned char shared
;
345 struct super_block
*h_sb
;
355 for (bindex
= 0; bindex
<= bbot
; bindex
++) {
356 h_path
.mnt
= au_sbr_mnt(sb
, bindex
);
357 h_sb
= h_path
.mnt
->mnt_sb
;
359 for (i
= 0; !shared
&& i
< bindex
; i
++)
360 shared
= (au_sbr_sb(sb
, i
) == h_sb
);
364 /* sb->s_root for NFS is unreliable */
365 h_path
.dentry
= h_path
.mnt
->mnt_root
;
366 err
= vfs_statfs(&h_path
, buf
);
370 if (bsize
> buf
->f_bsize
) {
372 * we will reduce bsize, so we have to expand blocks
373 * etc. to match them again
375 factor
= (bsize
/ buf
->f_bsize
);
376 blocks
= au_mul_till_max(blocks
, factor
);
377 bfree
= au_mul_till_max(bfree
, factor
);
378 bavail
= au_mul_till_max(bavail
, factor
);
379 bsize
= buf
->f_bsize
;
382 factor
= (buf
->f_bsize
/ bsize
);
383 blocks
= au_add_till_max(blocks
,
384 au_mul_till_max(buf
->f_blocks
, factor
));
385 bfree
= au_add_till_max(bfree
,
386 au_mul_till_max(buf
->f_bfree
, factor
));
387 bavail
= au_add_till_max(bavail
,
388 au_mul_till_max(buf
->f_bavail
, factor
));
389 files
= au_add_till_max(files
, buf
->f_files
);
390 ffree
= au_add_till_max(ffree
, buf
->f_ffree
);
393 buf
->f_bsize
= bsize
;
394 buf
->f_blocks
= blocks
;
395 buf
->f_bfree
= bfree
;
396 buf
->f_bavail
= bavail
;
397 buf
->f_files
= files
;
398 buf
->f_ffree
= ffree
;
405 static int aufs_statfs(struct dentry
*dentry
, struct kstatfs
*buf
)
409 struct super_block
*sb
;
411 /* lock free root dinfo */
413 si_noflush_read_lock(sb
);
414 if (!au_opt_test(au_mntflags(sb
), SUM
)) {
415 /* sb->s_root for NFS is unreliable */
416 h_path
.mnt
= au_sbr_mnt(sb
, 0);
417 h_path
.dentry
= h_path
.mnt
->mnt_root
;
418 err
= vfs_statfs(&h_path
, buf
);
420 err
= au_statfs_sum(sb
, buf
);
424 buf
->f_type
= AUFS_SUPER_MAGIC
;
425 buf
->f_namelen
= AUFS_MAX_NAMELEN
;
426 memset(&buf
->f_fsid
, 0, sizeof(buf
->f_fsid
));
428 /* buf->f_bsize = buf->f_blocks = buf->f_bfree = buf->f_bavail = -1; */
433 /* ---------------------------------------------------------------------- */
435 static int aufs_sync_fs(struct super_block
*sb
, int wait
)
438 aufs_bindex_t bbot
, bindex
;
439 struct au_branch
*br
;
440 struct super_block
*h_sb
;
443 si_noflush_read_lock(sb
);
445 for (bindex
= 0; bindex
<= bbot
; bindex
++) {
446 br
= au_sbr(sb
, bindex
);
447 if (!au_br_writable(br
->br_perm
))
450 h_sb
= au_sbr_sb(sb
, bindex
);
451 e
= vfsub_sync_filesystem(h_sb
, wait
);
452 if (unlikely(e
&& !err
))
454 /* go on even if an error happens */
461 /* ---------------------------------------------------------------------- */
463 /* final actions when unmounting a file system */
464 static void aufs_put_super(struct super_block
*sb
)
466 struct au_sbinfo
*sbinfo
;
472 dbgaufs_si_fin(sbinfo
);
473 kobject_put(&sbinfo
->si_kobj
);
476 /* ---------------------------------------------------------------------- */
478 void *au_array_alloc(unsigned long long *hint
, au_arraycb_t cb
,
479 struct super_block
*sb
, void *arg
)
482 unsigned long long n
, sz
;
489 if (*hint
> ULLONG_MAX
/ sizeof(array
)) {
490 array
= ERR_PTR(-EMFILE
);
491 pr_err("hint %llu\n", *hint
);
495 sz
= sizeof(array
) * *hint
;
496 array
= kzalloc(sz
, GFP_NOFS
);
497 if (unlikely(!array
))
499 if (unlikely(!array
)) {
500 array
= ERR_PTR(-ENOMEM
);
504 n
= cb(sb
, array
, *hint
, arg
);
505 AuDebugOn(n
> *hint
);
512 static unsigned long long au_iarray_cb(struct super_block
*sb
, void *a
,
513 unsigned long long max __maybe_unused
,
516 unsigned long long n
;
517 struct inode
**p
, *inode
;
518 struct list_head
*head
;
523 spin_lock(&sb
->s_inode_list_lock
);
524 list_for_each_entry(inode
, head
, i_sb_list
) {
525 if (!au_is_bad_inode(inode
)
526 && au_ii(inode
)->ii_btop
>= 0) {
527 spin_lock(&inode
->i_lock
);
528 if (atomic_read(&inode
->i_count
)) {
534 spin_unlock(&inode
->i_lock
);
537 spin_unlock(&sb
->s_inode_list_lock
);
542 struct inode
**au_iarray_alloc(struct super_block
*sb
, unsigned long long *max
)
544 *max
= au_ninodes(sb
);
545 return au_array_alloc(max
, au_iarray_cb
, sb
, &sb
->s_inodes
);
548 void au_iarray_free(struct inode
**a
, unsigned long long max
)
550 unsigned long long ull
;
552 for (ull
= 0; ull
< max
; ull
++)
557 /* ---------------------------------------------------------------------- */
560 * refresh dentry and inode at remount time.
562 /* todo: consolidate with simple_reval_dpath() and au_reval_for_attr() */
563 static int au_do_refresh(struct dentry
*dentry
, unsigned int dir_flags
,
564 struct dentry
*parent
)
568 di_write_lock_child(dentry
);
569 di_read_lock_parent(parent
, AuLock_IR
);
570 err
= au_refresh_dentry(dentry
, parent
);
571 if (!err
&& dir_flags
)
572 au_hn_reset(d_inode(dentry
), dir_flags
);
573 di_read_unlock(parent
, AuLock_IR
);
574 di_write_unlock(dentry
);
579 static int au_do_refresh_d(struct dentry
*dentry
, unsigned int sigen
,
580 struct au_sbinfo
*sbinfo
,
581 const unsigned int dir_flags
, unsigned int do_idop
)
584 struct dentry
*parent
;
587 parent
= dget_parent(dentry
);
588 if (!au_digen_test(parent
, sigen
) && au_digen_test(dentry
, sigen
)) {
589 if (d_really_is_positive(dentry
)) {
590 if (!d_is_dir(dentry
))
591 err
= au_do_refresh(dentry
, /*dir_flags*/0,
594 err
= au_do_refresh(dentry
, dir_flags
, parent
);
596 au_fset_si(sbinfo
, FAILED_REFRESH_DIR
);
599 err
= au_do_refresh(dentry
, /*dir_flags*/0, parent
);
606 au_refresh_dop(dentry
, /*force_reval*/0);
608 au_refresh_dop(dentry
, /*force_reval*/1);
614 static int au_refresh_d(struct super_block
*sb
, unsigned int do_idop
)
616 int err
, i
, j
, ndentry
, e
;
618 struct au_dcsub_pages dpages
;
619 struct au_dpage
*dpage
;
620 struct dentry
**dentries
, *d
;
621 struct au_sbinfo
*sbinfo
;
622 struct dentry
*root
= sb
->s_root
;
623 const unsigned int dir_flags
= au_hi_flags(d_inode(root
), /*isdir*/1);
626 au_refresh_dop(root
, /*force_reval*/0);
628 err
= au_dpages_init(&dpages
, GFP_NOFS
);
631 err
= au_dcsub_pages(&dpages
, root
, NULL
, NULL
);
635 sigen
= au_sigen(sb
);
637 for (i
= 0; i
< dpages
.ndpage
; i
++) {
638 dpage
= dpages
.dpages
+ i
;
639 dentries
= dpage
->dentries
;
640 ndentry
= dpage
->ndentry
;
641 for (j
= 0; j
< ndentry
; j
++) {
643 e
= au_do_refresh_d(d
, sigen
, sbinfo
, dir_flags
,
645 if (unlikely(e
&& !err
))
652 au_dpages_free(&dpages
);
657 static int au_refresh_i(struct super_block
*sb
, unsigned int do_idop
)
661 unsigned long long max
, ull
;
662 struct inode
*inode
, **array
;
664 array
= au_iarray_alloc(sb
, &max
);
665 err
= PTR_ERR(array
);
670 sigen
= au_sigen(sb
);
671 for (ull
= 0; ull
< max
; ull
++) {
673 if (unlikely(!inode
))
677 ii_write_lock_child(inode
);
678 if (au_iigen(inode
, NULL
) != sigen
) {
679 e
= au_refresh_hinode_self(inode
);
681 au_refresh_iop(inode
, /*force_getattr*/1);
682 pr_err("error %d, i%lu\n", e
, inode
->i_ino
);
685 /* go on even if err */
689 au_refresh_iop(inode
, /*force_getattr*/0);
690 ii_write_unlock(inode
);
693 au_iarray_free(array
, max
);
699 static void au_remount_refresh(struct super_block
*sb
, unsigned int do_idop
)
703 aufs_bindex_t bindex
, bbot
;
706 struct au_branch
*br
;
707 struct au_sbinfo
*sbi
;
711 au_fclr_si(sbi
, FAILED_REFRESH_DIR
);
714 DiMustNoWaiters(root
);
715 inode
= d_inode(root
);
716 IiMustNoWaiters(inode
);
718 udba
= au_opt_udba(sb
);
720 for (bindex
= 0; bindex
<= bbot
; bindex
++) {
721 br
= au_sbr(sb
, bindex
);
722 err
= au_hnotify_reset_br(udba
, br
, br
->br_perm
);
724 AuIOErr("hnotify failed on br %d, %d, ignored\n",
726 /* go on even if err */
728 au_hn_reset(inode
, au_hi_flags(inode
, /*isdir*/1));
731 if (au_ftest_si(sbi
, NO_DREVAL
)) {
732 AuDebugOn(sb
->s_d_op
== &aufs_dop_noreval
);
733 sb
->s_d_op
= &aufs_dop_noreval
;
734 AuDebugOn(sbi
->si_iop_array
== aufs_iop_nogetattr
);
735 sbi
->si_iop_array
= aufs_iop_nogetattr
;
737 AuDebugOn(sb
->s_d_op
== &aufs_dop
);
738 sb
->s_d_op
= &aufs_dop
;
739 AuDebugOn(sbi
->si_iop_array
== aufs_iop
);
740 sbi
->si_iop_array
= aufs_iop
;
742 pr_info("reset to %pf and %pf\n",
743 sb
->s_d_op
, sbi
->si_iop_array
);
746 di_write_unlock(root
);
747 err
= au_refresh_d(sb
, do_idop
);
748 e
= au_refresh_i(sb
, do_idop
);
749 if (unlikely(e
&& !err
))
751 /* aufs_write_lock() calls ..._child() */
752 di_write_lock_child(root
);
754 au_cpup_attr_all(inode
, /*force*/1);
757 AuIOErr("refresh failed, ignored, %d\n", err
);
760 /* stop extra interpretation of errno in mount(8), and strange error messages */
761 static int cvt_err(int err
)
775 static int aufs_remount_fs(struct super_block
*sb
, int *flags
, char *data
)
778 unsigned int mntflags
;
779 struct au_opts opts
= {
784 struct au_sbinfo
*sbinfo
;
788 if (!data
|| !*data
) {
789 err
= si_write_lock(sb
, AuLock_FLUSH
| AuLock_NOPLM
);
791 di_write_lock_child(root
);
792 err
= au_opts_verify(sb
, *flags
, /*pending*/0);
793 aufs_write_unlock(root
);
799 opts
.opt
= (void *)__get_free_page(GFP_NOFS
);
800 if (unlikely(!opts
.opt
))
802 opts
.max_opt
= PAGE_SIZE
/ sizeof(*opts
.opt
);
803 opts
.flags
= AuOpts_REMOUNT
;
804 opts
.sb_flags
= *flags
;
806 /* parse it before aufs lock */
807 err
= au_opts_parse(sb
, data
, &opts
);
812 inode
= d_inode(root
);
814 err
= si_write_lock(sb
, AuLock_FLUSH
| AuLock_NOPLM
);
817 di_write_lock_child(root
);
819 /* au_opts_remount() may return an error */
820 err
= au_opts_remount(sb
, &opts
);
823 if (au_ftest_opts(opts
.flags
, REFRESH
))
824 au_remount_refresh(sb
, au_ftest_opts(opts
.flags
, REFRESH_IDOP
));
826 if (au_ftest_opts(opts
.flags
, REFRESH_DYAOP
)) {
827 mntflags
= au_mntflags(sb
);
828 do_dx
= !!au_opt_test(mntflags
, DIO
);
829 au_dy_arefresh(do_dx
);
832 au_fhsm_wrote_all(sb
, /*force*/1); /* ?? */
833 aufs_write_unlock(root
);
838 free_page((unsigned long)opts
.opt
);
845 static const struct super_operations aufs_sop
= {
846 .alloc_inode
= aufs_alloc_inode
,
847 .destroy_inode
= aufs_destroy_inode
,
848 /* always deleting, no clearing */
849 .drop_inode
= generic_delete_inode
,
850 .show_options
= aufs_show_options
,
851 .statfs
= aufs_statfs
,
852 .put_super
= aufs_put_super
,
853 .sync_fs
= aufs_sync_fs
,
854 .remount_fs
= aufs_remount_fs
,
855 #ifdef CONFIG_AUFS_BDEV_LOOP
856 .real_loop
= aufs_real_loop
860 /* ---------------------------------------------------------------------- */
862 static int alloc_root(struct super_block
*sb
)
869 inode
= au_iget_locked(sb
, AUFS_ROOT_INO
);
870 err
= PTR_ERR(inode
);
874 inode
->i_op
= aufs_iop
+ AuIop_DIR
; /* with getattr by default */
875 inode
->i_fop
= &aufs_dir_fop
;
876 inode
->i_mode
= S_IFDIR
;
878 unlock_new_inode(inode
);
880 root
= d_make_root(inode
);
887 err
= au_di_init(root
);
890 return 0; /* success */
898 static int aufs_fill_super(struct super_block
*sb
, void *raw_data
,
899 int silent __maybe_unused
)
902 struct au_opts opts
= {
905 struct au_sbinfo
*sbinfo
;
908 char *arg
= raw_data
;
910 if (unlikely(!arg
|| !*arg
)) {
917 opts
.opt
= (void *)__get_free_page(GFP_NOFS
);
918 if (unlikely(!opts
.opt
))
920 opts
.max_opt
= PAGE_SIZE
/ sizeof(*opts
.opt
);
921 opts
.sb_flags
= sb
->s_flags
;
923 err
= au_si_alloc(sb
);
928 /* all timestamps always follow the ones on the branch */
929 sb
->s_flags
|= SB_NOATIME
| SB_NODIRATIME
;
930 sb
->s_op
= &aufs_sop
;
931 sb
->s_d_op
= &aufs_dop
;
932 sb
->s_magic
= AUFS_SUPER_MAGIC
;
934 sb
->s_stack_depth
= 1;
938 err
= alloc_root(sb
);
944 inode
= d_inode(root
);
947 * actually we can parse options regardless aufs lock here.
948 * but at remount time, parsing must be done before aufs lock.
949 * so we follow the same rule.
951 ii_write_lock_parent(inode
);
952 aufs_write_unlock(root
);
953 err
= au_opts_parse(sb
, arg
, &opts
);
957 /* lock vfs_inode first, then aufs. */
959 aufs_write_lock(root
);
960 err
= au_opts_mount(sb
, &opts
);
962 if (!err
&& au_ftest_si(sbinfo
, NO_DREVAL
)) {
963 sb
->s_d_op
= &aufs_dop_noreval
;
964 pr_info("%pf\n", sb
->s_d_op
);
965 au_refresh_dop(root
, /*force_reval*/0);
966 sbinfo
->si_iop_array
= aufs_iop_nogetattr
;
967 au_refresh_iop(inode
, /*force_getattr*/0);
969 aufs_write_unlock(root
);
972 goto out_opts
; /* success */
978 dbgaufs_si_fin(sbinfo
);
979 kobject_put(&sbinfo
->si_kobj
);
980 sb
->s_fs_info
= NULL
;
982 free_page((unsigned long)opts
.opt
);
990 /* ---------------------------------------------------------------------- */
992 static struct dentry
*aufs_mount(struct file_system_type
*fs_type
, int flags
,
993 const char *dev_name __maybe_unused
,
997 struct super_block
*sb
;
999 /* all timestamps always follow the ones on the branch */
1000 /* mnt->mnt_flags |= MNT_NOATIME | MNT_NODIRATIME; */
1001 root
= mount_nodev(fs_type
, flags
, raw_data
, aufs_fill_super
);
1006 si_write_lock(sb
, !AuLock_FLUSH
);
1007 sysaufs_brs_add(sb
, 0);
1008 si_write_unlock(sb
);
1015 static void aufs_kill_sb(struct super_block
*sb
)
1017 struct au_sbinfo
*sbinfo
;
1019 sbinfo
= au_sbi(sb
);
1022 aufs_write_lock(sb
->s_root
);
1024 if (sbinfo
->si_wbr_create_ops
->fin
)
1025 sbinfo
->si_wbr_create_ops
->fin(sb
);
1026 if (au_opt_test(sbinfo
->si_mntflags
, UDBA_HNOTIFY
)) {
1027 au_opt_set_udba(sbinfo
->si_mntflags
, UDBA_NONE
);
1028 au_remount_refresh(sb
, /*do_idop*/0);
1030 if (au_opt_test(sbinfo
->si_mntflags
, PLINK
))
1031 au_plink_put(sb
, /*verbose*/1);
1033 au_dr_opt_flush(sb
);
1034 sbinfo
->si_sb
= NULL
;
1035 aufs_write_unlock(sb
->s_root
);
1036 au_nwt_flush(&sbinfo
->si_nowait
);
1038 kill_anon_super(sb
);
1041 struct file_system_type aufs_fs_type
= {
1042 .name
= AUFS_FSTYPE
,
1043 /* a race between rename and others */
1044 .fs_flags
= FS_RENAME_DOES_D_MOVE
,
1045 .mount
= aufs_mount
,
1046 .kill_sb
= aufs_kill_sb
,
1047 /* no need to __module_get() and module_put(). */
1048 .owner
= THIS_MODULE
,