diff options
Diffstat (limited to 'fs/xfs/xfs_iops.c')
| -rw-r--r-- | fs/xfs/xfs_iops.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index c50311cae1b1..ce80eeb8faa4 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c | |||
| @@ -380,18 +380,27 @@ 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; |
| 387 | int omode = 0; | ||
| 386 | struct xfs_name oname; | 388 | struct xfs_name oname; |
| 387 | struct xfs_name nname; | 389 | struct xfs_name nname; |
| 388 | 390 | ||
| 389 | xfs_dentry_to_name(&oname, odentry, 0); | 391 | if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE)) |
| 392 | return -EINVAL; | ||
| 393 | |||
| 394 | /* if we are exchanging files, we need to set i_mode of both files */ | ||
| 395 | if (flags & RENAME_EXCHANGE) | ||
| 396 | omode = ndentry->d_inode->i_mode; | ||
| 397 | |||
| 398 | xfs_dentry_to_name(&oname, odentry, omode); | ||
| 390 | xfs_dentry_to_name(&nname, ndentry, odentry->d_inode->i_mode); | 399 | xfs_dentry_to_name(&nname, ndentry, odentry->d_inode->i_mode); |
| 391 | 400 | ||
| 392 | return xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode), | 401 | return xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode), |
| 393 | XFS_I(ndir), &nname, new_inode ? | 402 | XFS_I(ndir), &nname, |
| 394 | XFS_I(new_inode) : NULL); | 403 | new_inode ? XFS_I(new_inode) : NULL, flags); |
| 395 | } | 404 | } |
| 396 | 405 | ||
| 397 | /* | 406 | /* |
| @@ -1144,7 +1153,7 @@ static const struct inode_operations xfs_dir_inode_operations = { | |||
| 1144 | */ | 1153 | */ |
| 1145 | .rmdir = xfs_vn_unlink, | 1154 | .rmdir = xfs_vn_unlink, |
| 1146 | .mknod = xfs_vn_mknod, | 1155 | .mknod = xfs_vn_mknod, |
| 1147 | .rename = xfs_vn_rename, | 1156 | .rename2 = xfs_vn_rename, |
| 1148 | .get_acl = xfs_get_acl, | 1157 | .get_acl = xfs_get_acl, |
| 1149 | .set_acl = xfs_set_acl, | 1158 | .set_acl = xfs_set_acl, |
| 1150 | .getattr = xfs_vn_getattr, | 1159 | .getattr = xfs_vn_getattr, |
| @@ -1172,7 +1181,7 @@ static const struct inode_operations xfs_dir_ci_inode_operations = { | |||
| 1172 | */ | 1181 | */ |
| 1173 | .rmdir = xfs_vn_unlink, | 1182 | .rmdir = xfs_vn_unlink, |
| 1174 | .mknod = xfs_vn_mknod, | 1183 | .mknod = xfs_vn_mknod, |
| 1175 | .rename = xfs_vn_rename, | 1184 | .rename2 = xfs_vn_rename, |
| 1176 | .get_acl = xfs_get_acl, | 1185 | .get_acl = xfs_get_acl, |
| 1177 | .set_acl = xfs_set_acl, | 1186 | .set_acl = xfs_set_acl, |
| 1178 | .getattr = xfs_vn_getattr, | 1187 | .getattr = xfs_vn_getattr, |
