summaryrefslogtreecommitdiffstats
path: root/fs/gfs2/inode.c
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2022-11-02 23:57:50 +0100
committerAndreas Gruenbacher <agruenba@redhat.com>2022-12-02 15:58:00 +0100
commit35c23fba4eb4b3043b42acbdd3fbabdd8824f56f (patch)
tree8cde3a2f293465782e69ff558f79541f9b320219 /fs/gfs2/inode.c
parentLinux 6.1-rc7 (diff)
downloadlinux-35c23fba4eb4b3043b42acbdd3fbabdd8824f56f.tar.xz
linux-35c23fba4eb4b3043b42acbdd3fbabdd8824f56f.zip
gfs2: Add extra error check in alloc_dinode
We have reserved the number of blocks we want to allocate, so the actual allocation isn't expected to fail. Nevertheless, make the code behave correctly even when things go wrong. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r--fs/gfs2/inode.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 04a201584fa7..41fa69c1be1b 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -403,12 +403,15 @@ static int alloc_dinode(struct gfs2_inode *ip, u32 flags, unsigned *dblocks)
goto out_ipreserv;
error = gfs2_alloc_blocks(ip, &ip->i_no_addr, dblocks, 1, &ip->i_generation);
+ if (error)
+ goto out_trans_end;
+
ip->i_no_formal_ino = ip->i_generation;
ip->i_inode.i_ino = ip->i_no_addr;
ip->i_goal = ip->i_no_addr;
+out_trans_end:
gfs2_trans_end(sdp);
-
out_ipreserv:
gfs2_inplace_release(ip);
out_quota: