From: Brian Foster <bfoster@redhat.com>
To: kaixuxia <xiakaixu1987@gmail.com>
Cc: fstests@vger.kernel.org, linux-xfs@vger.kernel.org,
guaneryu@gmail.com, newtongao@tencent.com,
jasperwang@tencent.com
Subject: Re: [PATCH 2/4] fsstress: add NOREPLACE and WHITEOUT renameat2 support
Date: Fri, 25 Oct 2019 12:01:06 -0400 [thread overview]
Message-ID: <20191025160106.GE11837@bfoster> (raw)
In-Reply-To: <1c7113e038b084962acf34f30b93a50ec5ed20aa.1571926790.git.kaixuxia@tencent.com>
On Thu, Oct 24, 2019 at 10:20:49PM +0800, kaixuxia wrote:
> Support the renameat2(NOREPLACE and WHITEOUT) syscall in fsstress.
>
> Signed-off-by: kaixuxia <kaixuxia@tencent.com>
> ---
> ltp/fsstress.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++++---------
> 1 file changed, 89 insertions(+), 15 deletions(-)
>
> diff --git a/ltp/fsstress.c b/ltp/fsstress.c
> index 95285f1..5059639 100644
> --- a/ltp/fsstress.c
> +++ b/ltp/fsstress.c
...
> @@ -4272,16 +4323,21 @@ rename_f(int opno, long r)
> if (flp - flist == FT_DIR)
> fix_parent(oldid, id);
>
> - del_from_flist(flp - flist, fep - flp->fents);
> - add_to_flist(flp - flist, id, parid, xattr_counter);
> + if (mode == RENAME_WHITEOUT)
> + add_to_flist(flp - flist, id, parid, xattr_counter);
Hmm, so we've added a new devnode for the target and a whiteout was
added in its place. What about the xattr_count of the original devnode?
I wonder if we should reset that to zero. Other than that the rest looks
fine to me.
Brian
> + else {
> + del_from_flist(flp - flist, fep - flp->fents);
> + add_to_flist(flp - flist, id, parid, xattr_counter);
> + }
> }
> if (v) {
> - printf("%d/%d: rename %s to %s %d\n", procid, opno, f.path,
> + printf("%d/%d: rename(%s) %s to %s %d\n", procid,
> + opno, translate_renameat2_flags(mode), f.path,
> newf.path, e);
> if (e == 0) {
> - printf("%d/%d: rename del entry: id=%d,parent=%d\n",
> + printf("%d/%d: rename source entry: id=%d,parent=%d\n",
> procid, opno, oldid, oldparid);
> - printf("%d/%d: rename add entry: id=%d,parent=%d\n",
> + printf("%d/%d: rename target entry: id=%d,parent=%d\n",
> procid, opno, id, parid);
> }
> }
> @@ -4290,6 +4346,24 @@ rename_f(int opno, long r)
> }
>
> void
> +rename_f(int opno, long r)
> +{
> + do_renameat2(opno, r, 0);
> +}
> +
> +void
> +rnoreplace_f(int opno, long r)
> +{
> + do_renameat2(opno, r, RENAME_NOREPLACE);
> +}
> +
> +void
> +rwhiteout_f(int opno, long r)
> +{
> + do_renameat2(opno, r, RENAME_WHITEOUT);
> +}
> +
> +void
> resvsp_f(int opno, long r)
> {
> int e;
> --
> 1.8.3.1
>
next prev parent reply other threads:[~2019-10-25 16:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-24 14:20 [PATCH 0/4] xfstests: add deadlock between the AGI and AGF with RENAME_WHITEOUT test kaixuxia
2019-10-24 14:20 ` [PATCH 1/4] fsstress: show the real file id and parid in rename_f() kaixuxia
2019-10-25 16:00 ` Brian Foster
2019-10-24 14:20 ` [PATCH 2/4] fsstress: add NOREPLACE and WHITEOUT renameat2 support kaixuxia
2019-10-25 16:01 ` Brian Foster [this message]
2019-10-24 14:20 ` [PATCH 3/4] fsstress: add EXCHANGE " kaixuxia
2019-10-25 16:01 ` Brian Foster
2019-10-24 14:20 ` [PATCH 4/4] xfs: test the deadlock between the AGI and AGF with RENAME_WHITEOUT kaixuxia
2019-10-25 16:01 ` Brian Foster
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=20191025160106.GE11837@bfoster \
--to=bfoster@redhat.com \
--cc=fstests@vger.kernel.org \
--cc=guaneryu@gmail.com \
--cc=jasperwang@tencent.com \
--cc=linux-xfs@vger.kernel.org \
--cc=newtongao@tencent.com \
--cc=xiakaixu1987@gmail.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