xfs: project id inheritance is a directory only flag
authorDave Chinner <dchinner@redhat.com>
Wed, 1 Oct 2014 23:18:40 +0000 (09:18 +1000)
committerDave Chinner <david@fromorbit.com>
Wed, 1 Oct 2014 23:18:40 +0000 (09:18 +1000)
xfs_set_diflags() allows it to be set on non-directory inodes, and
this flags errors in xfs_repair. Further, inode allocation allows
the same directory-only flag to be inherited to non-directories.
Make sure directory inode flags don't appear on other types of
inodes.

This fixes several xfstests scratch fileystem corruption reports
(e.g. xfs/050) now that xfstests checks scratch filesystems after
test completion.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_inode.c
fs/xfs/xfs_ioctl.c

index 4c130ff..2f63742 100644 (file)
@@ -769,6 +769,8 @@ xfs_ialloc(
                                        di_flags |= XFS_DIFLAG_EXTSZINHERIT;
                                        ip->i_d.di_extsize = pip->i_d.di_extsize;
                                }
+                               if (pip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
+                                       di_flags |= XFS_DIFLAG_PROJINHERIT;
                        } else if (S_ISREG(mode)) {
                                if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT)
                                        di_flags |= XFS_DIFLAG_REALTIME;
@@ -789,8 +791,6 @@ xfs_ialloc(
                        if ((pip->i_d.di_flags & XFS_DIFLAG_NOSYMLINKS) &&
                            xfs_inherit_nosymlinks)
                                di_flags |= XFS_DIFLAG_NOSYMLINKS;
-                       if (pip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
-                               di_flags |= XFS_DIFLAG_PROJINHERIT;
                        if ((pip->i_d.di_flags & XFS_DIFLAG_NODEFRAG) &&
                            xfs_inherit_nodefrag)
                                di_flags |= XFS_DIFLAG_NODEFRAG;
index 3799695..05a1955 100644 (file)
@@ -968,8 +968,6 @@ xfs_set_diflags(
                di_flags |= XFS_DIFLAG_NOATIME;
        if (xflags & XFS_XFLAG_NODUMP)
                di_flags |= XFS_DIFLAG_NODUMP;
-       if (xflags & XFS_XFLAG_PROJINHERIT)
-               di_flags |= XFS_DIFLAG_PROJINHERIT;
        if (xflags & XFS_XFLAG_NODEFRAG)
                di_flags |= XFS_DIFLAG_NODEFRAG;
        if (xflags & XFS_XFLAG_FILESTREAM)
@@ -981,6 +979,8 @@ xfs_set_diflags(
                        di_flags |= XFS_DIFLAG_NOSYMLINKS;
                if (xflags & XFS_XFLAG_EXTSZINHERIT)
                        di_flags |= XFS_DIFLAG_EXTSZINHERIT;
+               if (xflags & XFS_XFLAG_PROJINHERIT)
+                       di_flags |= XFS_DIFLAG_PROJINHERIT;
        } else if (S_ISREG(ip->i_d.di_mode)) {
                if (xflags & XFS_XFLAG_REALTIME)
                        di_flags |= XFS_DIFLAG_REALTIME;