diff options
author | Carlos Maiolino <cmaiolino@redhat.com> | 2014-12-23 16:51:38 -0500 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-12-23 16:51:38 -0500 |
commit | dbe1b5ca26396b6c61d711c8ac4de13ebb02e9f6 (patch) | |
tree | 9c7401ae49d0642c2c36d8a7a816709bcca92fe4 /fs/xfs | |
parent | 97bf6af1f928216fd6c5a66e8a57bfa95a659672 (diff) |
xfs: Make xfs_vn_rename compliant with renameat2() syscall
To be able to support RENAME_EXCHANGE flag from renameat2() system
call, XFS must have its inode_operations updated, exporting .rename2
method, instead of .rename.
This patch just replaces the (now old) .rename method by .rename2,
using the same infra-structure, but checking rename flags. Calls to
.rename2 using RENAME_EXCHANGE flag, although now handled inside
XFS, still return -EINVAL.
RENAME_NOREPLACE is handled via VFS and we don't need to care about
it inside xfs_vn_rename.
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_iops.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index c50311cae1b1..abb838a565ee 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c | |||
@@ -380,18 +380,23 @@ xfs_vn_rename( | |||
380 | struct inode *odir, | 380 | struct inode *odir, |
381 | struct dentry *odentry, | 381 | struct dentry *odentry, |
382 | struct inode *ndir, | 382 | struct inode *ndir, |
383 | struct dentry *ndentry) | 383 | struct dentry *ndentry, |
384 | unsigned int flags) | ||
384 | { | 385 | { |
385 | struct inode *new_inode = ndentry->d_inode; | 386 | struct inode *new_inode = ndentry->d_inode; |
386 | struct xfs_name oname; | 387 | struct xfs_name oname; |
387 | struct xfs_name nname; | 388 | struct xfs_name nname; |
388 | 389 | ||
390 | /* XFS does not support RENAME_EXCHANGE yet */ | ||
391 | if (flags & ~RENAME_NOREPLACE) | ||
392 | return -EINVAL; | ||
393 | |||
389 | xfs_dentry_to_name(&oname, odentry, 0); | 394 | xfs_dentry_to_name(&oname, odentry, 0); |
390 | xfs_dentry_to_name(&nname, ndentry, odentry->d_inode->i_mode); | 395 | xfs_dentry_to_name(&nname, ndentry, odentry->d_inode->i_mode); |
391 | 396 | ||
392 | return xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode), | 397 | return xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode), |
393 | XFS_I(ndir), &nname, new_inode ? | 398 | XFS_I(ndir), &nname, |
394 | XFS_I(new_inode) : NULL); | 399 | new_inode ? XFS_I(new_inode) : NULL); |
395 | } | 400 | } |
396 | 401 | ||
397 | /* | 402 | /* |
@@ -1144,7 +1149,7 @@ static const struct inode_operations xfs_dir_inode_operations = { | |||
1144 | */ | 1149 | */ |
1145 | .rmdir = xfs_vn_unlink, | 1150 | .rmdir = xfs_vn_unlink, |
1146 | .mknod = xfs_vn_mknod, | 1151 | .mknod = xfs_vn_mknod, |
1147 | .rename = xfs_vn_rename, | 1152 | .rename2 = xfs_vn_rename, |
1148 | .get_acl = xfs_get_acl, | 1153 | .get_acl = xfs_get_acl, |
1149 | .set_acl = xfs_set_acl, | 1154 | .set_acl = xfs_set_acl, |
1150 | .getattr = xfs_vn_getattr, | 1155 | .getattr = xfs_vn_getattr, |
@@ -1172,7 +1177,7 @@ static const struct inode_operations xfs_dir_ci_inode_operations = { | |||
1172 | */ | 1177 | */ |
1173 | .rmdir = xfs_vn_unlink, | 1178 | .rmdir = xfs_vn_unlink, |
1174 | .mknod = xfs_vn_mknod, | 1179 | .mknod = xfs_vn_mknod, |
1175 | .rename = xfs_vn_rename, | 1180 | .rename2 = xfs_vn_rename, |
1176 | .get_acl = xfs_get_acl, | 1181 | .get_acl = xfs_get_acl, |
1177 | .set_acl = xfs_set_acl, | 1182 | .set_acl = xfs_set_acl, |
1178 | .getattr = xfs_vn_getattr, | 1183 | .getattr = xfs_vn_getattr, |