Skip to content

Commit 35c23fb

Browse files
author
Andreas Gruenbacher
committed
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 <[email protected]>
1 parent b7b275e commit 35c23fb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/gfs2/inode.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,12 +403,15 @@ static int alloc_dinode(struct gfs2_inode *ip, u32 flags, unsigned *dblocks)
403403
goto out_ipreserv;
404404

405405
error = gfs2_alloc_blocks(ip, &ip->i_no_addr, dblocks, 1, &ip->i_generation);
406+
if (error)
407+
goto out_trans_end;
408+
406409
ip->i_no_formal_ino = ip->i_generation;
407410
ip->i_inode.i_ino = ip->i_no_addr;
408411
ip->i_goal = ip->i_no_addr;
409412

413+
out_trans_end:
410414
gfs2_trans_end(sdp);
411-
412415
out_ipreserv:
413416
gfs2_inplace_release(ip);
414417
out_quota:

0 commit comments

Comments
 (0)