aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2012-02-17 09:15:52 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2012-02-28 04:48:30 -0500
commit9e73f571ea3afffca78c1f54128d57796e27532f (patch)
tree65210fa95c01ca3c6b44a92bea2068887e6a7fcf /fs/gfs2
parent718b97bd6b03445be53098e3c8f896aeebc304aa (diff)
GFS2: Ensure rindex is uptodate for fallocate
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 <rpeterso@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/file.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index c5fb3597f696..7f906c8b02ac 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -772,6 +772,11 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset,
772 if (bytes == 0) 772 if (bytes == 0)
773 bytes = sdp->sd_sb.sb_bsize; 773 bytes = sdp->sd_sb.sb_bsize;
774 774
775 error = gfs2_rindex_update(sdp);
776 if (error) {
777 fs_warn(sdp, "rindex update returns %d\n", error);
778 return error;
779 }
775 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &ip->i_gh); 780 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &ip->i_gh);
776 error = gfs2_glock_nq(&ip->i_gh); 781 error = gfs2_glock_nq(&ip->i_gh);
777 if (unlikely(error)) 782 if (unlikely(error))