From: Bob Peterson Date: Thu, 18 Aug 2022 18:32:36 +0000 (-0500) Subject: gfs2: Prevent double iput for journal on error X-Git-Tag: v6.1-rc1~64^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=04133b607a78f2fd3daadbe5519513942b0f3a05;p=thirdparty%2Fkernel%2Flinux.git gfs2: Prevent double iput for journal on error When a gfs2 file system is withdrawn it does iput on its journal to allow recovery from another cluster node. If it's unable to get a replacement inode for whatever reason, the journal descriptor would still be pointing at the evicted inode. So when unmount clears out the list of journals, it would do a second iput referencing the pointer. To avoid this, set the inode pointer to NULL. Signed-off-by: Bob Peterson Signed-off-by: Andreas Gruenbacher --- diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c index 8241029a2a5d2..95c79a3ec1612 100644 --- a/fs/gfs2/util.c +++ b/fs/gfs2/util.c @@ -204,6 +204,7 @@ static void signal_our_withdraw(struct gfs2_sbd *sdp) * exception code in glock_dq. */ iput(inode); + sdp->sd_jdesc->jd_inode = NULL; /* * Wait until the journal inode's glock is freed. This allows try locks * on other nodes to be successful, otherwise we remain the owner of