Iustin Pop 9b94fcc398 xfs: fix behaviour of XFS_IOC_FSSETXATTR on directories
Currently, the ioctl handling code for XFS_IOC_FSSETXATTR treats all
targets as regular files: it refuses to change the extent size if
extents are allocated. This is wrong for directories, as there the
extent size is only used as a default for children.

The patch fixes this issue and improves validation of flag
combinations:

- only disallow extent size changes after extents have been allocated
  for regular files
- only allow XFS_XFLAG_EXTSIZE for regular files
- only allow XFS_XFLAG_EXTSZINHERIT for directories
- automatically clear the flags if the extent size is zero

Thanks to Dave Chinner for guidance on the proper fix for this issue.

[dchinner: ported changes onto cleanup series. Makes changes clear
	   and obvious.]
[dchinner: added comments documenting validity checking rules.]

Signed-off-by: Iustin Pop <iustin@k1024.org>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-02-02 10:26:26 +11:00
..
2014-07-30 09:12:05 +10:00
2014-10-02 09:18:13 +10:00
2013-11-06 16:31:27 -06:00
2014-07-15 08:07:01 +10:00
2013-05-07 18:45:36 -05:00
2011-08-12 16:21:35 -05:00
2012-11-19 20:11:24 -06:00
2013-08-12 16:53:39 -05:00
2011-08-12 16:21:35 -05:00
2014-06-25 14:58:08 +10:00
2011-08-12 16:21:35 -05:00
2013-08-12 16:56:06 -05:00
2013-05-07 18:45:36 -05:00
2014-07-30 09:12:05 +10:00
2014-09-09 11:52:42 +10:00
2014-07-30 09:12:05 +10:00
2013-05-07 18:45:36 -05:00