]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
GFS2: Make sure rindex is uptodate before starting transactions
authorBob Peterson <rpeterso@redhat.com>
Thu, 5 Apr 2012 02:11:16 +0000 (22:11 -0400)
committerSteven Whitehouse <swhiteho@redhat.com>
Thu, 5 Apr 2012 09:20:10 +0000 (10:20 +0100)
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>
fs/gfs2/bmap.c
fs/gfs2/dir.c
fs/gfs2/inode.c
fs/gfs2/rgrp.c
fs/gfs2/xattr.c

index 197c5c47e57763c7f8c926be7e8c527463107c0e..03c04febe26f095e58d36504e7fb4400c30be6ca 100644 (file)
@@ -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;
index c35573abd3710a123112edcdf30c29c5e9f41023..a836056343f077bee81a6f54c7a1e5b0f86cf604 100644 (file)
@@ -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);
index c98a60ee6dfd5bf84921e1fd8ad626c4922ca86c..a9ba2444e077ac145f23c25161038a0f8ac2f468 100644 (file)
@@ -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);
index 19354a20e5b1e1b90abcfa5854b41b005f516975..3df65c9ab73b3ff3b56b338f37100d1f404ab594 100644 (file)
@@ -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);
 
index 2e5ba425cae743f006b938a39b8e70469c9f471a..927f4df874ae788c744e1e7e51edb19d92b60e36 100644 (file)
@@ -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);