1 /* SPDX-License-Identifier: GPL-2.0-only */
4 * Copyright (C) 2011 Novell Inc.
5 * Copyright (C) 2016 Red Hat, Inc.
12 bool default_permissions;
15 const char *redirect_mode;
23 struct super_block *sb;
25 /* Unusable (conflicting) uuid */
31 /* Trap in ovl inode cache */
34 /* Index of this layer in fs root (upper idx == 0) */
36 /* One fsid per unique underlying sb (upper fsid == 0) */
41 struct ovl_layer *layer;
42 struct dentry *dentry;
45 /* private information held for overlayfs's superblock */
47 struct vfsmount *upper_mnt;
48 unsigned int numlower;
49 /* Number of unique lower sb that differ from upper sb */
50 unsigned int numlowerfs;
51 struct ovl_layer *lower_layers;
52 struct ovl_sb *lower_fs;
53 /* workbasedir is the path at workdir= mount option */
54 struct dentry *workbasedir;
55 /* workdir is the 'work' directory under workbasedir */
56 struct dentry *workdir;
57 /* index directory listing overlay inodes by origin file handle */
58 struct dentry *indexdir;
60 /* pathnames of lower and upper dirs, for show_options */
61 struct ovl_config config;
62 /* creds of process who forced instantiation of super block */
63 const struct cred *creator_cred;
66 /* Did we take the inuse lock? */
69 /* Traps in ovl inode cache */
70 struct inode *upperdir_trap;
71 struct inode *workbasedir_trap;
72 struct inode *workdir_trap;
73 struct inode *indexdir_trap;
74 /* Inode numbers in all layers do not use the high xino_bits */
75 unsigned int xino_bits;
78 /* private information held for every overlayfs dentry */
87 struct ovl_path lowerstack[];
90 struct ovl_entry *ovl_alloc_entry(unsigned int numlower);
92 static inline struct ovl_entry *OVL_E(struct dentry *dentry)
94 return (struct ovl_entry *) dentry->d_fsdata;
99 struct ovl_dir_cache *cache; /* directory */
100 struct inode *lowerdata; /* regular file */
102 const char *redirect;
105 struct inode vfs_inode;
106 struct dentry *__upperdentry;
109 /* synchronize copy up and more */
113 static inline struct ovl_inode *OVL_I(struct inode *inode)
115 return container_of(inode, struct ovl_inode, vfs_inode);
118 static inline struct dentry *ovl_upperdentry_dereference(struct ovl_inode *oi)
120 return READ_ONCE(oi->__upperdentry);