Skip to content

Commit

Permalink
GFS2: Ensure rindex is uptodate for fallocate
Browse files Browse the repository at this point in the history
This patch fixes a problem whereby gfs2_grow was failing and causing GFS2
to assert. The problem was that when GFS2's fallocate operation tried to
acquire an "allocation" it made sure the rindex was up to date, and if not,
it called gfs2_rindex_update. However, if the file being fallocated was
the rindex itself, it was already locked at that point. By calling
gfs2_rindex_update at an earlier point in time, we bring rindex up to date
and thereby avoid trying to lock it when the "allocation" is acquired.

Signed-off-by: Bob Peterson <[email protected]>
Signed-off-by: Steven Whitehouse <[email protected]>
  • Loading branch information
AstralBob authored and swhiteho committed Feb 28, 2012
1 parent 718b97b commit 9e73f57
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs/gfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,11 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset,
if (bytes == 0)
bytes = sdp->sd_sb.sb_bsize;

error = gfs2_rindex_update(sdp);
if (error) {
fs_warn(sdp, "rindex update returns %d\n", error);
return error;
}
gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &ip->i_gh);
error = gfs2_glock_nq(&ip->i_gh);
if (unlikely(error))
Expand Down

0 comments on commit 9e73f57

Please sign in to comment.