diff options
author | Lukas Czerner <lczerner@redhat.com> | 2017-08-03 16:19:13 -0400 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2017-08-04 16:43:36 -0400 |
commit | 56bdf855e676f1f2ed7033f288f57dfd315725ba (patch) | |
tree | 45f1e00147384ae06000eb3e24a5bee542907706 | |
parent | ea7bd56fa309d10a41b1041827a63c0746c47554 (diff) |
xfs: Fix per-inode DAX flag inheritance
According to the commit that implemented per-inode DAX flag:
commit 58f88ca2df72 ("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: 58f88ca2df72 ("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>
-rw-r--r-- | fs/xfs/xfs_inode.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index ceef77c0416a..ff48f0096810 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -874,7 +874,6 @@ xfs_ialloc( | |||
874 | case S_IFREG: | 874 | case S_IFREG: |
875 | case S_IFDIR: | 875 | case S_IFDIR: |
876 | if (pip && (pip->i_d.di_flags & XFS_DIFLAG_ANY)) { | 876 | if (pip && (pip->i_d.di_flags & XFS_DIFLAG_ANY)) { |
877 | uint64_t di_flags2 = 0; | ||
878 | uint di_flags = 0; | 877 | uint di_flags = 0; |
879 | 878 | ||
880 | if (S_ISDIR(mode)) { | 879 | if (S_ISDIR(mode)) { |
@@ -911,20 +910,23 @@ xfs_ialloc( | |||
911 | di_flags |= XFS_DIFLAG_NODEFRAG; | 910 | di_flags |= XFS_DIFLAG_NODEFRAG; |
912 | if (pip->i_d.di_flags & XFS_DIFLAG_FILESTREAM) | 911 | if (pip->i_d.di_flags & XFS_DIFLAG_FILESTREAM) |
913 | di_flags |= XFS_DIFLAG_FILESTREAM; | 912 | di_flags |= XFS_DIFLAG_FILESTREAM; |
914 | if (pip->i_d.di_flags2 & XFS_DIFLAG2_DAX) | ||
915 | di_flags2 |= XFS_DIFLAG2_DAX; | ||
916 | 913 | ||
917 | ip->i_d.di_flags |= di_flags; | 914 | ip->i_d.di_flags |= di_flags; |
918 | ip->i_d.di_flags2 |= di_flags2; | ||
919 | } | 915 | } |
920 | if (pip && | 916 | if (pip && |
921 | (pip->i_d.di_flags2 & XFS_DIFLAG2_ANY) && | 917 | (pip->i_d.di_flags2 & XFS_DIFLAG2_ANY) && |
922 | pip->i_d.di_version == 3 && | 918 | pip->i_d.di_version == 3 && |
923 | ip->i_d.di_version == 3) { | 919 | ip->i_d.di_version == 3) { |
920 | uint64_t di_flags2 = 0; | ||
921 | |||
924 | if (pip->i_d.di_flags2 & XFS_DIFLAG2_COWEXTSIZE) { | 922 | if (pip->i_d.di_flags2 & XFS_DIFLAG2_COWEXTSIZE) { |
925 | ip->i_d.di_flags2 |= XFS_DIFLAG2_COWEXTSIZE; | 923 | di_flags2 |= XFS_DIFLAG2_COWEXTSIZE; |
926 | ip->i_d.di_cowextsize = pip->i_d.di_cowextsize; | 924 | ip->i_d.di_cowextsize = pip->i_d.di_cowextsize; |
927 | } | 925 | } |
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; | ||
928 | } | 930 | } |
929 | /* FALLTHROUGH */ | 931 | /* FALLTHROUGH */ |
930 | case S_IFLNK: | 932 | case S_IFLNK: |