From: Carlos Maiolino <cmaiolino@redhat.com>
To: xfs@oss.sgi.com
Subject: [PATCH 1/2] Make xfs_vn_rename compliant with renameat2() syscall
Date: Tue, 11 Nov 2014 15:01:12 -0200 [thread overview]
Message-ID: <1415725273-5083-2-git-send-email-cmaiolino@redhat.com> (raw)
In-Reply-To: <1415725273-5083-1-git-send-email-cmaiolino@redhat.com>
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 returns -EINVAL.
RENAME_NOREPLACE is handled via VFS and we don't need to care about it inside
xfs_vn_rename.
Changelog:
V2: Use xfs_vn_rename as-is, instead of rename it to xfs_vn_rename2
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
---
fs/xfs/xfs_iops.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index ec6dcdc..0b8704c 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -383,18 +383,23 @@ xfs_vn_rename(
struct inode *odir,
struct dentry *odentry,
struct inode *ndir,
- struct dentry *ndentry)
+ struct dentry *ndentry,
+ unsigned int flags)
{
struct inode *new_inode = ndentry->d_inode;
struct xfs_name oname;
struct xfs_name nname;
+ /* XFS does not support RENAME_EXCHANGE yet */
+ if (flags & ~RENAME_NOREPLACE)
+ return -EINVAL;
+
xfs_dentry_to_name(&oname, odentry, 0);
xfs_dentry_to_name(&nname, ndentry, odentry->d_inode->i_mode);
return xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode),
- XFS_I(ndir), &nname, new_inode ?
- XFS_I(new_inode) : NULL);
+ XFS_I(ndir), &nname,
+ new_inode ? XFS_I(new_inode) : NULL);
}
/*
@@ -1147,7 +1152,7 @@ static const struct inode_operations xfs_dir_inode_operations = {
*/
.rmdir = xfs_vn_unlink,
.mknod = xfs_vn_mknod,
- .rename = xfs_vn_rename,
+ .rename2 = xfs_vn_rename,
.get_acl = xfs_get_acl,
.set_acl = xfs_set_acl,
.getattr = xfs_vn_getattr,
@@ -1175,7 +1180,7 @@ static const struct inode_operations xfs_dir_ci_inode_operations = {
*/
.rmdir = xfs_vn_unlink,
.mknod = xfs_vn_mknod,
- .rename = xfs_vn_rename,
+ .rename2 = xfs_vn_rename,
.get_acl = xfs_get_acl,
.set_acl = xfs_set_acl,
.getattr = xfs_vn_getattr,
--
2.1.0
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2014-11-11 17:01 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-11 17:01 [PATCH 0/2] Add support to RENAME_EXCHANGE flat to XFS V3 Carlos Maiolino
2014-11-11 17:01 ` Carlos Maiolino [this message]
2014-11-11 19:28 ` [PATCH 1/2] Make xfs_vn_rename compliant with renameat2() syscall Brian Foster
2014-11-11 17:01 ` [PATCH 2/2] Add support to RENAME_EXCHANGE flag V3 Carlos Maiolino
2014-11-11 19:29 ` Brian Foster
2014-11-12 17:32 ` Carlos Maiolino
2014-11-12 22:00 ` Dave Chinner
2014-11-13 13:04 ` Carlos Maiolino
-- strict thread matches above, loose matches on Subject: below --
2014-12-17 18:13 [PATCH 0/2] Add support to RENAME_EXCHANGE flag to XFS V9 Carlos Maiolino
2014-12-17 18:13 ` [PATCH 1/2] Make xfs_vn_rename compliant with renameat2() syscall Carlos Maiolino
2014-11-25 13:49 [PATCH 0/2] Add support to RENAME_EXCHANGE flag to XFS V8 Carlos Maiolino
2014-11-25 13:49 ` [PATCH 1/2] Make xfs_vn_rename compliant with renameat2() syscall Carlos Maiolino
2014-11-14 18:32 [PATCH 0/2] Add support to RENAME_EXCHANGE flag to XFS V7 Carlos Maiolino
2014-11-14 18:32 ` [PATCH 1/2] Make xfs_vn_rename compliant with renameat2() syscall Carlos Maiolino
2014-11-14 19:12 ` Brian Foster
2014-11-14 17:33 [PATCH 0/2] Add support to RENAME_EXCHANGE flag to XFS V6 Carlos Maiolino
2014-11-14 17:33 ` [PATCH 1/2] Make xfs_vn_rename compliant with renameat2() syscall Carlos Maiolino
2014-11-13 16:47 [PATCH 0/2] Add support to RENAME_EXCHANGE flag to XFS V5 Carlos Maiolino
2014-11-13 16:47 ` [PATCH 1/2] Make xfs_vn_rename compliant with renameat2() syscall Carlos Maiolino
2014-11-12 18:13 [PATCH 0/2] Add support to RENAME_EXCHANGE flag to XFS V4 Carlos Maiolino
2014-11-12 18:13 ` [PATCH 1/2] Make xfs_vn_rename compliant with renameat2() syscall Carlos Maiolino
2014-11-10 17:41 [PATCH 0/2] Add support to RENAME_EXCHANGE flat to XFS V2 Carlos Maiolino
2014-11-10 17:41 ` [PATCH 1/2] Make xfs_vn_rename compliant with renameat2() syscall Carlos Maiolino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1415725273-5083-2-git-send-email-cmaiolino@redhat.com \
--to=cmaiolino@redhat.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox