diff mbox series

[1/4] fsstress: show the real file id and parid in rename_f()

Message ID d68b2f32b3dbe57427e6bacaeb6e4a32d8576b0c.1571926790.git.kaixuxia@tencent.com (mailing list archive)
State New, archived
Headers show
Series xfstests: add deadlock between the AGI and AGF with RENAME_WHITEOUT test | expand

Commit Message

Kaixu Xia Oct. 24, 2019, 2:20 p.m. UTC
The source file id and parentid are overwritten by del_from_flist()
call, and should show the actually values.

Signed-off-by: kaixuxia <kaixuxia@tencent.com>
---
 ltp/fsstress.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Brian Foster Oct. 25, 2019, 4 p.m. UTC | #1
On Thu, Oct 24, 2019 at 10:20:48PM +0800, kaixuxia wrote:
> The source file id and parentid are overwritten by del_from_flist()
> call, and should show the actually values.
> 
> Signed-off-by: kaixuxia <kaixuxia@tencent.com>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  ltp/fsstress.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/ltp/fsstress.c b/ltp/fsstress.c
> index 51976f5..95285f1 100644
> --- a/ltp/fsstress.c
> +++ b/ltp/fsstress.c
> @@ -4227,6 +4227,7 @@ rename_f(int opno, long r)
>  	pathname_t	newf;
>  	int		oldid;
>  	int		parid;
> +	int		oldparid;
>  	int		v;
>  	int		v1;
>  
> @@ -4265,10 +4266,12 @@ rename_f(int opno, long r)
>  	if (e == 0) {
>  		int xattr_counter = fep->xattr_counter;
>  
> -		if (flp - flist == FT_DIR) {
> -			oldid = fep->id;
> +		oldid = fep->id;
> +		oldparid = fep->parent;
> +
> +		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);
>  	}
> @@ -4277,7 +4280,7 @@ rename_f(int opno, long r)
>  			newf.path, e);
>  		if (e == 0) {
>  			printf("%d/%d: rename del entry: id=%d,parent=%d\n",
> -				procid, opno, fep->id, fep->parent);
> +				procid, opno, oldid, oldparid);
>  			printf("%d/%d: rename add entry: id=%d,parent=%d\n",
>  				procid, opno, id, parid);
>  		}
> -- 
> 1.8.3.1
>
diff mbox series

Patch

diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 51976f5..95285f1 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -4227,6 +4227,7 @@  rename_f(int opno, long r)
 	pathname_t	newf;
 	int		oldid;
 	int		parid;
+	int		oldparid;
 	int		v;
 	int		v1;
 
@@ -4265,10 +4266,12 @@  rename_f(int opno, long r)
 	if (e == 0) {
 		int xattr_counter = fep->xattr_counter;
 
-		if (flp - flist == FT_DIR) {
-			oldid = fep->id;
+		oldid = fep->id;
+		oldparid = fep->parent;
+
+		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);
 	}
@@ -4277,7 +4280,7 @@  rename_f(int opno, long r)
 			newf.path, e);
 		if (e == 0) {
 			printf("%d/%d: rename del entry: id=%d,parent=%d\n",
-				procid, opno, fep->id, fep->parent);
+				procid, opno, oldid, oldparid);
 			printf("%d/%d: rename add entry: id=%d,parent=%d\n",
 				procid, opno, id, parid);
 		}