diff options
| author | Dave Chinner <dchinner@redhat.com> | 2015-02-01 18:15:56 -0500 |
|---|---|---|
| committer | Dave Chinner <david@fromorbit.com> | 2015-02-01 18:15:56 -0500 |
| commit | f96291f6a39c2b60bede851efa059ba89e5f8277 (patch) | |
| tree | 12e598d3e71d0e0367a8114fabf1c37f7e359463 | |
| parent | 8f3d17ab060ec21cead88b81c65050a6ff77e9be (diff) | |
xfs: disaggregate xfs_ioctl_setattr
xfs_ioctl_setxflags doesn't need all of the functionailty in
xfs_ioctl_setattr() and now we have separate helper functions that
share the checks and modifications that xfs_ioctl_setxflags
requires. Hence disaggregate it from xfs_ioctl_setattr() to allow
further work to be done on xfs_ioctl_setattr.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
| -rw-r--r-- | fs/xfs/xfs_ioctl.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 0f62f5b3e221..383e61f514f7 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c | |||
| @@ -1324,14 +1324,14 @@ xfs_ioc_getxflags( | |||
| 1324 | 1324 | ||
| 1325 | STATIC int | 1325 | STATIC int |
| 1326 | xfs_ioc_setxflags( | 1326 | xfs_ioc_setxflags( |
| 1327 | xfs_inode_t *ip, | 1327 | struct xfs_inode *ip, |
| 1328 | struct file *filp, | 1328 | struct file *filp, |
| 1329 | void __user *arg) | 1329 | void __user *arg) |
| 1330 | { | 1330 | { |
| 1331 | struct xfs_trans *tp; | ||
| 1331 | struct fsxattr fa; | 1332 | struct fsxattr fa; |
| 1332 | unsigned int flags; | 1333 | unsigned int flags; |
| 1333 | unsigned int mask; | 1334 | int error; |
| 1334 | int error; | ||
| 1335 | 1335 | ||
| 1336 | if (copy_from_user(&flags, arg, sizeof(flags))) | 1336 | if (copy_from_user(&flags, arg, sizeof(flags))) |
| 1337 | return -EFAULT; | 1337 | return -EFAULT; |
| @@ -1341,13 +1341,26 @@ xfs_ioc_setxflags( | |||
| 1341 | FS_SYNC_FL)) | 1341 | FS_SYNC_FL)) |
| 1342 | return -EOPNOTSUPP; | 1342 | return -EOPNOTSUPP; |
| 1343 | 1343 | ||
| 1344 | mask = FSX_XFLAGS; | ||
| 1345 | fa.fsx_xflags = xfs_merge_ioc_xflags(flags, xfs_ip2xflags(ip)); | 1344 | fa.fsx_xflags = xfs_merge_ioc_xflags(flags, xfs_ip2xflags(ip)); |
| 1346 | 1345 | ||
| 1347 | error = mnt_want_write_file(filp); | 1346 | error = mnt_want_write_file(filp); |
| 1348 | if (error) | 1347 | if (error) |
| 1349 | return error; | 1348 | return error; |
| 1350 | error = xfs_ioctl_setattr(ip, &fa, mask); | 1349 | |
| 1350 | tp = xfs_ioctl_setattr_get_trans(ip); | ||
| 1351 | if (IS_ERR(tp)) { | ||
| 1352 | error = PTR_ERR(tp); | ||
| 1353 | goto out_drop_write; | ||
| 1354 | } | ||
| 1355 | |||
| 1356 | error = xfs_ioctl_setattr_xflags(tp, ip, &fa); | ||
| 1357 | if (error) { | ||
| 1358 | xfs_trans_cancel(tp, 0); | ||
| 1359 | goto out_drop_write; | ||
| 1360 | } | ||
| 1361 | |||
| 1362 | error = xfs_trans_commit(tp, 0); | ||
| 1363 | out_drop_write: | ||
| 1351 | mnt_drop_write_file(filp); | 1364 | mnt_drop_write_file(filp); |
| 1352 | return error; | 1365 | return error; |
| 1353 | } | 1366 | } |
