summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_metafile.h
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2024-11-03 20:18:51 -0800
committerDarrick J. Wong <djwong@kernel.org>2024-11-05 13:38:31 -0800
commit7297fd0bebbd70efd12f72632a0f3ac49a8f59fe (patch)
tree946cb411a3ef830bfb2145569288c00ba6ec7507 /fs/xfs/libxfs/xfs_metafile.h
parentc555dd9b8c2d8f09ee31b17fc3ce059bacb4e359 (diff)
xfs: enforce metadata inode flag
Add checks for the metadata inode flag so that we don't ever leak metadata inodes out to userspace, and we don't ever try to read a regular inode as metadata. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/libxfs/xfs_metafile.h')
-rw-r--r--fs/xfs/libxfs/xfs_metafile.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_metafile.h b/fs/xfs/libxfs/xfs_metafile.h
index 60fe18906112..c66b0c51b461 100644
--- a/fs/xfs/libxfs/xfs_metafile.h
+++ b/fs/xfs/libxfs/xfs_metafile.h
@@ -6,6 +6,17 @@
#ifndef __XFS_METAFILE_H__
#define __XFS_METAFILE_H__
+/* All metadata files must have these flags set. */
+#define XFS_METAFILE_DIFLAGS (XFS_DIFLAG_IMMUTABLE | \
+ XFS_DIFLAG_SYNC | \
+ XFS_DIFLAG_NOATIME | \
+ XFS_DIFLAG_NODUMP | \
+ XFS_DIFLAG_NODEFRAG)
+
+/* All metadata directories must have these flags set. */
+#define XFS_METADIR_DIFLAGS (XFS_METAFILE_DIFLAGS | \
+ XFS_DIFLAG_NOSYMLINKS)
+
/* Code specific to kernel/userspace; must be provided externally. */
int xfs_trans_metafile_iget(struct xfs_trans *tp, xfs_ino_t ino,