From 9a8b98855e7dbe067a3fe753382ca399c5c372de Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Tue, 24 Dec 2024 11:15:47 +0300 Subject: [PATCH] LU-10375 ptlrpc: fix error handling after tx creation we don't need to stop a transaction if it wasn't created (i.e. if dt_trans_create() returned an error). Fixes: 928714ddda ("LU-5092 nodemap: save id maps to targets in new index file") Signed-off-by: Alex Zhuravlev Change-Id: I04a707ab068ff1278c891cd1c7646ec37cac0055 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57583 Tested-by: Maloo Tested-by: jenkins Reviewed-by: Sebastien Buisson Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger --- lustre/ptlrpc/nodemap_storage.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lustre/ptlrpc/nodemap_storage.c b/lustre/ptlrpc/nodemap_storage.c index 7c39623..31a02ce 100644 --- a/lustre/ptlrpc/nodemap_storage.c +++ b/lustre/ptlrpc/nodemap_storage.c @@ -318,9 +318,8 @@ static int nodemap_idx_insert(const struct lu_env *env, BUILD_BUG_ON(sizeof(union nodemap_rec) != 32); th = dt_trans_create(env, dev); - if (IS_ERR(th)) - GOTO(out, rc = PTR_ERR(th)); + RETURN(PTR_ERR(th)); rc = dt_declare_insert(env, idx, (const struct dt_rec *)nr, @@ -359,9 +358,8 @@ static int nodemap_idx_update(const struct lu_env *env, int rc = 0; th = dt_trans_create(env, dev); - if (IS_ERR(th)) - GOTO(out, rc = PTR_ERR(th)); + RETURN(PTR_ERR(th)); rc = dt_declare_delete(env, idx, (const struct dt_key *)nk, th); if (rc != 0) @@ -410,9 +408,8 @@ static int nodemap_idx_delete(const struct lu_env *env, int rc = 0; th = dt_trans_create(env, dev); - if (IS_ERR(th)) - GOTO(out, rc = PTR_ERR(th)); + RETURN(PTR_ERR(th)); rc = dt_declare_delete(env, idx, (const struct dt_key *)nk, th); if (rc != 0) -- 1.8.3.1