Skip to content

Commit 56bdf85

Browse files
Lukas Czernerdjwong
authored andcommitted
xfs: Fix per-inode DAX flag inheritance
According to the commit that implemented per-inode DAX flag: commit 58f88ca ("xfs: introduce per-inode DAX enablement") the flag is supposed to act as "inherit flag". Currently this only works in the situations where parent directory already has a flag in di_flags set, otherwise inheritance does not work. This is because setting the XFS_DIFLAG2_DAX flag is done in a wrong branch designated for di_flags, not di_flags2. Fix this by moving the code to branch designated for setting di_flags2, which does test for flags in di_flags2. Fixes: 58f88ca ("xfs: introduce per-inode DAX enablement") Signed-off-by: Lukas Czerner <lczerner@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
1 parent ea7bd56 commit 56bdf85

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

fs/xfs/xfs_inode.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,6 @@ xfs_ialloc(
874874
case S_IFREG:
875875
case S_IFDIR:
876876
if (pip && (pip->i_d.di_flags & XFS_DIFLAG_ANY)) {
877-
uint64_t di_flags2 = 0;
878877
uint di_flags = 0;
879878

880879
if (S_ISDIR(mode)) {
@@ -911,20 +910,23 @@ xfs_ialloc(
911910
di_flags |= XFS_DIFLAG_NODEFRAG;
912911
if (pip->i_d.di_flags & XFS_DIFLAG_FILESTREAM)
913912
di_flags |= XFS_DIFLAG_FILESTREAM;
914-
if (pip->i_d.di_flags2 & XFS_DIFLAG2_DAX)
915-
di_flags2 |= XFS_DIFLAG2_DAX;
916913

917914
ip->i_d.di_flags |= di_flags;
918-
ip->i_d.di_flags2 |= di_flags2;
919915
}
920916
if (pip &&
921917
(pip->i_d.di_flags2 & XFS_DIFLAG2_ANY) &&
922918
pip->i_d.di_version == 3 &&
923919
ip->i_d.di_version == 3) {
920+
uint64_t di_flags2 = 0;
921+
924922
if (pip->i_d.di_flags2 & XFS_DIFLAG2_COWEXTSIZE) {
925-
ip->i_d.di_flags2 |= XFS_DIFLAG2_COWEXTSIZE;
923+
di_flags2 |= XFS_DIFLAG2_COWEXTSIZE;
926924
ip->i_d.di_cowextsize = pip->i_d.di_cowextsize;
927925
}
926+
if (pip->i_d.di_flags2 & XFS_DIFLAG2_DAX)
927+
di_flags2 |= XFS_DIFLAG2_DAX;
928+
929+
ip->i_d.di_flags2 |= di_flags2;
928930
}
929931
/* FALLTHROUGH */
930932
case S_IFLNK:

0 commit comments

Comments
 (0)