Skip to content

Commit 7009fa9

Browse files
author
Andreas Gruenbacher
committed
gfs2: Recursive gfs2_quota_hold in gfs2_iomap_end
When starting an iomap write, gfs2_quota_lock_check -> gfs2_quota_lock -> gfs2_quota_hold is called from gfs2_iomap_begin. At the end of the write, before unlocking the quotas, punch_hole -> gfs2_quota_hold can be called again in gfs2_iomap_end, which is incorrect and leads to a failed assertion. Instead, move the call to gfs2_quota_unlock before the call to punch_hole to fix that. Fixes: 64bc06b ("gfs2: iomap buffered write support") Cc: stable@vger.kernel.org # v4.19+ Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent 866eef4 commit 7009fa9

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

fs/gfs2/bmap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,9 @@ static int gfs2_iomap_end(struct inode *inode, loff_t pos, loff_t length,
12301230

12311231
gfs2_inplace_release(ip);
12321232

1233+
if (ip->i_qadata && ip->i_qadata->qa_qd_num)
1234+
gfs2_quota_unlock(ip);
1235+
12331236
if (length != written && (iomap->flags & IOMAP_F_NEW)) {
12341237
/* Deallocate blocks that were just allocated. */
12351238
loff_t blockmask = i_blocksize(inode) - 1;
@@ -1242,9 +1245,6 @@ static int gfs2_iomap_end(struct inode *inode, loff_t pos, loff_t length,
12421245
}
12431246
}
12441247

1245-
if (ip->i_qadata && ip->i_qadata->qa_qd_num)
1246-
gfs2_quota_unlock(ip);
1247-
12481248
if (unlikely(!written))
12491249
goto out_unlock;
12501250

0 commit comments

Comments
 (0)