All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Xu <xuyang2018.jy@fujitsu.com>
To: <fstests@vger.kernel.org>
Cc: Yang Xu <xuyang2018.jy@fujitsu.com>
Subject: [PATCH v1 3/4] src/idmapped-mounts/idmapped-mounts.c: Use renameat instead of renameat2
Date: Wed, 1 Sep 2021 20:43:25 +0800	[thread overview]
Message-ID: <1630500206-15545-3-git-send-email-xuyang2018.jy@fujitsu.com> (raw)
In-Reply-To: <1630500206-15545-1-git-send-email-xuyang2018.jy@fujitsu.com>

We don't add fallback for renameat2, so it build failed on old
kernel. So use renameat instead.

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 src/idmapped-mounts/idmapped-mounts.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/idmapped-mounts/idmapped-mounts.c b/src/idmapped-mounts/idmapped-mounts.c
index e83f8b04..4230cb48 100644
--- a/src/idmapped-mounts/idmapped-mounts.c
+++ b/src/idmapped-mounts/idmapped-mounts.c
@@ -10433,9 +10433,9 @@ static int btrfs_subvolumes_fsids_unmapped(void)
 	}
 
 	/* try to rename a subvolume */
-	if (!renameat2(open_tree_fd, BTRFS_SUBVOLUME1, open_tree_fd,
-		       BTRFS_SUBVOLUME1_RENAME, 0)) {
-		log_stderr("failure: renameat2");
+	if (!renameat(open_tree_fd, BTRFS_SUBVOLUME1, open_tree_fd,
+		       BTRFS_SUBVOLUME1_RENAME)) {
+		log_stderr("failure: renameat");
 		goto out;
 	}
 	if (errno != EOVERFLOW) {
@@ -10552,9 +10552,9 @@ static int btrfs_subvolumes_fsids_unmapped_userns(void)
 			die("failure: errno");
 
 		/* try to rename a subvolume */
-		if (!renameat2(open_tree_fd, BTRFS_SUBVOLUME1, open_tree_fd,
-					BTRFS_SUBVOLUME1_RENAME, 0))
-			die("failure: renameat2");
+		if (!renameat(open_tree_fd, BTRFS_SUBVOLUME1, open_tree_fd,
+					BTRFS_SUBVOLUME1_RENAME))
+			die("failure: renameat");
 		if (errno != EOVERFLOW)
 			die("failure: errno");
 
@@ -10993,9 +10993,9 @@ static int btrfs_snapshots_fsids_unmapped(void)
 			die("failure: errno");
 
 		/* try to rename a directory */
-		if (!renameat2(open_tree_fd, BTRFS_SUBVOLUME1, open_tree_fd,
-			       BTRFS_SUBVOLUME1_RENAME, 0))
-			die("failure: renameat2");
+		if (!renameat(open_tree_fd, BTRFS_SUBVOLUME1, open_tree_fd,
+			       BTRFS_SUBVOLUME1_RENAME))
+			die("failure: renameat");
 		if (errno != EOVERFLOW)
 			die("failure: errno");
 
@@ -11174,9 +11174,9 @@ static int btrfs_snapshots_fsids_unmapped_userns(void)
 			die("failure: errno");
 
 		/* try to rename a directory */
-		if (!renameat2(open_tree_fd, BTRFS_SUBVOLUME1, open_tree_fd,
-			       BTRFS_SUBVOLUME1_RENAME, 0))
-			die("failure: renameat2");
+		if (!renameat(open_tree_fd, BTRFS_SUBVOLUME1, open_tree_fd,
+			       BTRFS_SUBVOLUME1_RENAME))
+			die("failure: renameat");
 		if (errno != EOVERFLOW)
 			die("failure: errno");
 
-- 
2.23.0


  parent reply	other threads:[~2021-09-01 12:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01 12:43 [PATCH v1 1/4] src/idmapped-mounts: Fix an error for the loop initialization declaration Yang Xu
2021-09-01 12:43 ` [PATCH v1 2/4] configure.ac: Fix uncorrect detection because of linux/btrfs.h Yang Xu
2021-09-01 12:43 ` Yang Xu [this message]
2021-09-01 12:43 ` [PATCH v1 4/4] src/idmapped-mounts/idmapped-mounts.c: Fix build error because of undefined reallocarray Yang Xu

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=1630500206-15545-3-git-send-email-xuyang2018.jy@fujitsu.com \
    --to=xuyang2018.jy@fujitsu.com \
    --cc=fstests@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.