summaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2017-07-17 03:45:35 -0400
committerDavid Howells <dhowells@redhat.com>2017-07-17 03:45:35 -0400
commite462ec50cb5fad19f6003a3d8087f4a0945dd2b1 (patch)
tree7e56b715ce6b1c4ad13a4c3cfbce9462efe875bc /include/linux/fs.h
parentbc98a42c1f7d0f886c0c1b75a92a004976a46d9f (diff)
VFS: Differentiate mount flags (MS_*) from internal superblock flags
Differentiate the MS_* flags passed to mount(2) from the internal flags set in the super_block's s_flags. s_flags are now called SB_*, with the names and the values for the moment mirroring the MS_* flags that they're equivalent to. In this patch, just the headers are altered and some kernel code where blind automated conversion isn't necessarily correct. Note that this shows up some interesting issues: (1) Some MS_* flags get translated to MNT_* flags (such as MS_NODEV -> MNT_NODEV) without passing this on to the filesystem, but some filesystems set such flags anyway. (2) The ->remount_fs() methods of some filesystems adjust the *flags argument by setting MS_* flags in it, such as MS_NOATIME - but these flags are then scrubbed by do_remount_sb() (only the occupants of MS_RMT_MASK are permitted: MS_RDONLY, MS_SYNCHRONOUS, MS_MANDLOCK, MS_I_VERSION and MS_LAZYTIME) I'm not sure what's the best way to solve all these cases. Suggested-by: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h45
1 files changed, 36 insertions, 9 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 6ae137c1bdf6..3d6ee0c0ebb0 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1270,6 +1270,33 @@ extern int send_sigurg(struct fown_struct *fown);
1270struct mm_struct; 1270struct mm_struct;
1271 1271
1272/* 1272/*
1273 * sb->s_flags. Note that these mirror the equivalent MS_* flags where
1274 * represented in both.
1275 */
1276#define SB_RDONLY 1 /* Mount read-only */
1277#define SB_NOSUID 2 /* Ignore suid and sgid bits */
1278#define SB_NODEV 4 /* Disallow access to device special files */
1279#define SB_NOEXEC 8 /* Disallow program execution */
1280#define SB_SYNCHRONOUS 16 /* Writes are synced at once */
1281#define SB_MANDLOCK 64 /* Allow mandatory locks on an FS */
1282#define SB_DIRSYNC 128 /* Directory modifications are synchronous */
1283#define SB_NOATIME 1024 /* Do not update access times. */
1284#define SB_NODIRATIME 2048 /* Do not update directory access times */
1285#define SB_SILENT 32768
1286#define SB_POSIXACL (1<<16) /* VFS does not apply the umask */
1287#define SB_KERNMOUNT (1<<22) /* this is a kern_mount call */
1288#define SB_I_VERSION (1<<23) /* Update inode I_version field */
1289#define SB_LAZYTIME (1<<25) /* Update the on-disk [acm]times lazily */
1290
1291/* These sb flags are internal to the kernel */
1292#define SB_SUBMOUNT (1<<26)
1293#define SB_NOREMOTELOCK (1<<27)
1294#define SB_NOSEC (1<<28)
1295#define SB_BORN (1<<29)
1296#define SB_ACTIVE (1<<30)
1297#define SB_NOUSER (1<<31)
1298
1299/*
1273 * Umount options 1300 * Umount options
1274 */ 1301 */
1275 1302
@@ -1835,7 +1862,7 @@ struct super_operations {
1835 * possible to override it selectively if you really wanted to with some 1862 * possible to override it selectively if you really wanted to with some
1836 * ioctl() that is not currently implemented. 1863 * ioctl() that is not currently implemented.
1837 * 1864 *
1838 * Exception: MS_RDONLY is always applied to the entire file system. 1865 * Exception: SB_RDONLY is always applied to the entire file system.
1839 * 1866 *
1840 * Unfortunately, it is possible to change a filesystems flags with it mounted 1867 * Unfortunately, it is possible to change a filesystems flags with it mounted
1841 * with files in use. This means that all of the inodes will not have their 1868 * with files in use. This means that all of the inodes will not have their
@@ -1846,18 +1873,18 @@ struct super_operations {
1846 1873
1847static inline bool sb_rdonly(const struct super_block *sb) { return sb->s_flags & MS_RDONLY; } 1874static inline bool sb_rdonly(const struct super_block *sb) { return sb->s_flags & MS_RDONLY; }
1848#define IS_RDONLY(inode) sb_rdonly((inode)->i_sb) 1875#define IS_RDONLY(inode) sb_rdonly((inode)->i_sb)
1849#define IS_SYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS) || \ 1876#define IS_SYNC(inode) (__IS_FLG(inode, SB_SYNCHRONOUS) || \
1850 ((inode)->i_flags & S_SYNC)) 1877 ((inode)->i_flags & S_SYNC))
1851#define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \ 1878#define IS_DIRSYNC(inode) (__IS_FLG(inode, SB_SYNCHRONOUS|SB_DIRSYNC) || \
1852 ((inode)->i_flags & (S_SYNC|S_DIRSYNC))) 1879 ((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
1853#define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK) 1880#define IS_MANDLOCK(inode) __IS_FLG(inode, SB_MANDLOCK)
1854#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME) 1881#define IS_NOATIME(inode) __IS_FLG(inode, SB_RDONLY|SB_NOATIME)
1855#define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION) 1882#define IS_I_VERSION(inode) __IS_FLG(inode, SB_I_VERSION)
1856 1883
1857#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) 1884#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
1858#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) 1885#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
1859#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) 1886#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
1860#define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL) 1887#define IS_POSIXACL(inode) __IS_FLG(inode, SB_POSIXACL)
1861 1888
1862#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) 1889#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD)
1863#define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME) 1890#define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME)
@@ -2178,7 +2205,7 @@ static inline int __mandatory_lock(struct inode *ino)
2178} 2205}
2179 2206
2180/* 2207/*
2181 * ... and these candidates should be on MS_MANDLOCK mounted fs, 2208 * ... and these candidates should be on SB_MANDLOCK mounted fs,
2182 * otherwise these will be advisory locks 2209 * otherwise these will be advisory locks
2183 */ 2210 */
2184 2211
@@ -3274,7 +3301,7 @@ static inline int check_sticky(struct inode *dir, struct inode *inode)
3274 3301
3275static inline void inode_has_no_xattr(struct inode *inode) 3302static inline void inode_has_no_xattr(struct inode *inode)
3276{ 3303{
3277 if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC)) 3304 if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & SB_NOSEC))
3278 inode->i_flags |= S_NOSEC; 3305 inode->i_flags |= S_NOSEC;
3279} 3306}
3280 3307