3 * Copyright (C) 2011 Novell Inc.
4 * Copyright (C) 2016 Red Hat, Inc.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
15 bool default_permissions
;
18 const char *redirect_mode
;
26 struct super_block
*sb
;
33 /* Index of this layer in fs root (upper idx == 0) */
35 /* One fsid per unique underlying sb (upper fsid == 0) */
40 struct ovl_layer
*layer
;
41 struct dentry
*dentry
;
44 /* private information held for overlayfs's superblock */
46 struct vfsmount
*upper_mnt
;
47 unsigned int numlower
;
48 /* Number of unique lower sb that differ from upper sb */
49 unsigned int numlowerfs
;
50 struct ovl_layer
*lower_layers
;
51 struct ovl_sb
*lower_fs
;
52 /* workbasedir is the path at workdir= mount option */
53 struct dentry
*workbasedir
;
54 /* workdir is the 'work' directory under workbasedir */
55 struct dentry
*workdir
;
56 /* index directory listing overlay inodes by origin file handle */
57 struct dentry
*indexdir
;
59 /* pathnames of lower and upper dirs, for show_options */
60 struct ovl_config config
;
61 /* creds of process who forced instantiation of super block */
62 const struct cred
*creator_cred
;
65 /* Did we take the inuse lock? */
68 /* Inode numbers in all layers do not use the high xino_bits */
69 unsigned int xino_bits
;
72 /* private information held for every overlayfs dentry */
81 struct ovl_path lowerstack
[];
84 struct ovl_entry
*ovl_alloc_entry(unsigned int numlower
);
86 static inline struct ovl_entry
*OVL_E(struct dentry
*dentry
)
88 return (struct ovl_entry
*) dentry
->d_fsdata
;
93 struct ovl_dir_cache
*cache
; /* directory */
94 struct inode
*lowerdata
; /* regular file */
99 struct inode vfs_inode
;
100 struct dentry
*__upperdentry
;
103 /* synchronize copy up and more */
107 static inline struct ovl_inode
*OVL_I(struct inode
*inode
)
109 return container_of(inode
, struct ovl_inode
, vfs_inode
);
112 static inline struct dentry
*ovl_upperdentry_dereference(struct ovl_inode
*oi
)
114 return READ_ONCE(oi
->__upperdentry
);