forked from Minki/linux
GFS2: Make sure rindex is uptodate before starting transactions
This patch removes the call from gfs2_blk2rgrd to function gfs2_rindex_update and replaces it with individual calls. The former way turned out to be too problematic. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
This commit is contained in:
parent
97cc008aaa
commit
5e2f7d617b
@ -724,7 +724,11 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh,
|
||||
int metadata;
|
||||
unsigned int revokes = 0;
|
||||
int x;
|
||||
int error = 0;
|
||||
int error;
|
||||
|
||||
error = gfs2_rindex_update(sdp);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (!*top)
|
||||
sm->sm_first = 0;
|
||||
|
@ -1844,6 +1844,10 @@ static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len,
|
||||
unsigned int x, size = len * sizeof(u64);
|
||||
int error;
|
||||
|
||||
error = gfs2_rindex_update(sdp);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
memset(&rlist, 0, sizeof(struct gfs2_rgrp_list));
|
||||
|
||||
ht = kzalloc(size, GFP_NOFS);
|
||||
|
@ -1031,7 +1031,13 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
|
||||
struct buffer_head *bh;
|
||||
struct gfs2_holder ghs[3];
|
||||
struct gfs2_rgrpd *rgd;
|
||||
int error = -EROFS;
|
||||
int error;
|
||||
|
||||
error = gfs2_rindex_update(sdp);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
error = -EROFS;
|
||||
|
||||
gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs);
|
||||
gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1);
|
||||
@ -1224,6 +1230,10 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
|
||||
return 0;
|
||||
}
|
||||
|
||||
error = gfs2_rindex_update(sdp);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (odip != ndip) {
|
||||
error = gfs2_glock_nq_init(sdp->sd_rename_gl, LM_ST_EXCLUSIVE,
|
||||
0, &r_gh);
|
||||
@ -1345,7 +1355,6 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
|
||||
error = alloc_required;
|
||||
if (error < 0)
|
||||
goto out_gunlock;
|
||||
error = 0;
|
||||
|
||||
if (alloc_required) {
|
||||
struct gfs2_qadata *qa = gfs2_qadata_get(ndip);
|
||||
|
@ -332,9 +332,6 @@ struct gfs2_rgrpd *gfs2_blk2rgrpd(struct gfs2_sbd *sdp, u64 blk, bool exact)
|
||||
struct rb_node *n, *next;
|
||||
struct gfs2_rgrpd *cur;
|
||||
|
||||
if (gfs2_rindex_update(sdp))
|
||||
return NULL;
|
||||
|
||||
spin_lock(&sdp->sd_rindex_spin);
|
||||
n = sdp->sd_rindex_tree.rb_node;
|
||||
while (n) {
|
||||
@ -928,6 +925,10 @@ int gfs2_fitrim(struct file *filp, void __user *argp)
|
||||
} else if (copy_from_user(&r, argp, sizeof(r)))
|
||||
return -EFAULT;
|
||||
|
||||
ret = gfs2_rindex_update(sdp);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
rgd = gfs2_blk2rgrpd(sdp, r.start, 0);
|
||||
rgd_end = gfs2_blk2rgrpd(sdp, r.start + r.len, 0);
|
||||
|
||||
|
@ -238,6 +238,10 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
|
||||
unsigned int x;
|
||||
int error;
|
||||
|
||||
error = gfs2_rindex_update(sdp);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (GFS2_EA_IS_STUFFED(ea))
|
||||
return 0;
|
||||
|
||||
@ -1330,6 +1334,10 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
|
||||
unsigned int x;
|
||||
int error;
|
||||
|
||||
error = gfs2_rindex_update(sdp);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
memset(&rlist, 0, sizeof(struct gfs2_rgrp_list));
|
||||
|
||||
error = gfs2_meta_read(ip->i_gl, ip->i_eattr, DIO_WAIT, &indbh);
|
||||
@ -1439,6 +1447,10 @@ static int ea_dealloc_block(struct gfs2_inode *ip)
|
||||
struct gfs2_holder gh;
|
||||
int error;
|
||||
|
||||
error = gfs2_rindex_update(sdp);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
rgd = gfs2_blk2rgrpd(sdp, ip->i_eattr, 1);
|
||||
if (!rgd) {
|
||||
gfs2_consist_inode(ip);
|
||||
|
Loading…
Reference in New Issue
Block a user