From: Brian Foster <bfoster@redhat.com>
To: kaixuxia <xiakaixu1987@gmail.com>
Cc: fstests@vger.kernel.org, linux-xfs@vger.kernel.org,
Eryu Guan <guaneryu@gmail.com>,
"Darrick J. Wong" <darrick.wong@oracle.com>,
newtongao@tencent.com, jasperwang@tencent.com
Subject: Re: [PATCH v4] fsstress: add renameat2 support
Date: Mon, 21 Oct 2019 09:54:52 -0400 [thread overview]
Message-ID: <20191021135452.GB26105@bfoster> (raw)
In-Reply-To: <5df7cc7b-31b4-69e2-f623-83a2c90bfca7@gmail.com>
On Fri, Oct 18, 2019 at 05:57:55PM +0800, kaixuxia wrote:
> Support the renameat2 syscall in fsstress.
>
> Signed-off-by: kaixuxia <kaixuxia@tencent.com>
> ---
> Changes in v4:
> -Fix long line((> 80 characters) problem.
> -Fix the RENAME_WHITEOUT RENAME_EXCHANGE file flist problem.
>
> ltp/fsstress.c | 174 +++++++++++++++++++++++++++++++++++++++++++++++----------
> 1 file changed, 143 insertions(+), 31 deletions(-)
>
> diff --git a/ltp/fsstress.c b/ltp/fsstress.c
> index 51976f5..f268a5a 100644
> --- a/ltp/fsstress.c
> +++ b/ltp/fsstress.c
...
> @@ -4269,16 +4348,26 @@ rename_f(int opno, long r)
> oldid = fep->id;
> fix_parent(oldid, id);
> }
> +
> + if (mode == RENAME_WHITEOUT)
> + add_to_flist(FT_DEV, fep->id, fep->parent, 0);
> + else if (mode == RENAME_EXCHANGE) {
> + del_from_flist(dflp - flist, dfep - dflp->fents);
> + add_to_flist(dflp - flist, fep->id, fep->parent,
> + dfep->xattr_counter);
I think dfep->xattr_counter is overwritten by the del_from_flist() call.
Also if the source and the target happen to be on the same file type
list, what prevents the del_from_flist() call above from relocating the
entry associated with the target, invalidating the fep reference used
below? I'm wondering if we need some kind of entry swap helper function
here to get this right for the exchange case (i.e. pass two list+slot
pairs to swap and let the function make a local copy as appropriate)...
Brian
> + }
> +
> 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, fep->id, fep->parent);
> - 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);
> }
> }
> @@ -4287,6 +4376,29 @@ 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
> +rexchange_f(int opno, long r)
> +{
> + do_renameat2(opno, r, RENAME_EXCHANGE);
> +}
> +
> +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
>
> --
> kaixuxia
prev parent reply other threads:[~2019-10-21 13:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-18 9:57 [PATCH v4] fsstress: add renameat2 support kaixuxia
2019-10-21 6:41 ` kaixuxia
2019-10-21 13:54 ` Brian Foster [this message]
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=20191021135452.GB26105@bfoster \
--to=bfoster@redhat.com \
--cc=darrick.wong@oracle.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