GFS2: Make sure rindex is uptodate before starting transactions
A message that is not in the archive (sent off-list or not yet received): fec51564-d2da-46ef-a067-16d79b5bbffa@zmail12.collab.prod.int.phx2.redhat.com
PATCH 1/1 GFS2: Make sure rindex is uptodate before starting transactions
Hi,
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.
Regards,
Bob Peterson
Red Hat File Systems
--
Author: Bob Peterson <[email protected]> Date: Wed Apr 4 22:04:57 2012 -0500
GFS2: Make sure rindex is uptodate before starting transactions
This patch checks to make sure rindex is uptodate (all the rgrps are read in properly) in case gfs2_grow adds some. It replaces the call from gfs2_blk2rgrd which was too frought with danger.
fs/gfs2/bmap.c +5 -1
@@ -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 ;
fs/gfs2/dir.c +4 -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 );
fs/gfs2/inode.c +11 -2
@@ -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);
fs/gfs2/rgrp.c +4 -3
@@ -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 );
fs/gfs2/xattr.c +12 -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);
PATCH 1/1 GFS2: Make sure rindex is uptodate before starting transactions
Hi,
Now in the -nmw and -fixes tree. Thanks,
Steve.
Quoted 155 lines · Bob Peterson
Hi,
This patch removes the call from
gfs2_blk2rgrdto functiongfs2_rindex_updateand replaces it with individual calls. The former way turned out to be too problematic.Regards,
Bob Peterson
Red Hat File SystemsSigned-off-by Bob Peterson <[email protected]>--
Author: Bob Peterson <[email protected]> Date: Wed Apr 4 22:04:57 2012 -0500GFS2: Make sure rindex is uptodate before starting transactions
This patch checks to make sure rindex is uptodate (all the rgrps are read in properly) in case
gfs2_growadds some. It replaces the call fromgfs2_blk2rgrdwhich was too frought with danger.fs/gfs2/bmap.c +5
-1@@ -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 ;fs/gfs2/dir.c +4
-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 );fs/gfs2/inode.c +11
-2@@ -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);fs/gfs2/rgrp.c +4
-3@@ -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 );fs/gfs2/xattr.c +12
-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);