diff options
Diffstat (limited to 'fs/gfs2/rgrp.c')
| -rw-r--r-- | fs/gfs2/rgrp.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 117fa4171f62..171a744f8e45 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
| @@ -1192,7 +1192,6 @@ int gfs2_inplace_reserve_i(struct gfs2_inode *ip, char *file, unsigned int line) | |||
| 1192 | { | 1192 | { |
| 1193 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1193 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
| 1194 | struct gfs2_alloc *al = ip->i_alloc; | 1194 | struct gfs2_alloc *al = ip->i_alloc; |
| 1195 | struct inode *inode; | ||
| 1196 | int error = 0; | 1195 | int error = 0; |
| 1197 | u64 last_unlinked = NO_BLOCK, unlinked; | 1196 | u64 last_unlinked = NO_BLOCK, unlinked; |
| 1198 | 1197 | ||
| @@ -1210,22 +1209,27 @@ try_again: | |||
| 1210 | if (error) | 1209 | if (error) |
| 1211 | return error; | 1210 | return error; |
| 1212 | 1211 | ||
| 1212 | /* Find an rgrp suitable for allocation. If it encounters any unlinked | ||
| 1213 | dinodes along the way, error will equal -EAGAIN and unlinked will | ||
| 1214 | contains it block address. We then need to look up that inode and | ||
| 1215 | try to free it, and try the allocation again. */ | ||
| 1213 | error = get_local_rgrp(ip, &unlinked, &last_unlinked); | 1216 | error = get_local_rgrp(ip, &unlinked, &last_unlinked); |
| 1214 | if (error) { | 1217 | if (error) { |
| 1215 | if (ip != GFS2_I(sdp->sd_rindex)) | 1218 | if (ip != GFS2_I(sdp->sd_rindex)) |
| 1216 | gfs2_glock_dq_uninit(&al->al_ri_gh); | 1219 | gfs2_glock_dq_uninit(&al->al_ri_gh); |
| 1217 | if (error != -EAGAIN) | 1220 | if (error != -EAGAIN) |
| 1218 | return error; | 1221 | return error; |
| 1219 | error = gfs2_unlinked_inode_lookup(ip->i_inode.i_sb, | 1222 | |
| 1220 | unlinked, &inode); | 1223 | gfs2_process_unlinked_inode(ip->i_inode.i_sb, unlinked); |
| 1221 | if (inode) | 1224 | /* regardless of whether or not gfs2_process_unlinked_inode |
| 1222 | iput(inode); | 1225 | was successful, we don't want to repeat it again. */ |
| 1226 | last_unlinked = unlinked; | ||
| 1223 | gfs2_log_flush(sdp, NULL); | 1227 | gfs2_log_flush(sdp, NULL); |
| 1224 | if (error == GLR_TRYFAILED) | 1228 | error = 0; |
| 1225 | error = 0; | 1229 | |
| 1226 | goto try_again; | 1230 | goto try_again; |
| 1227 | } | 1231 | } |
| 1228 | 1232 | /* no error, so we have the rgrp set in the inode's allocation. */ | |
| 1229 | al->al_file = file; | 1233 | al->al_file = file; |
| 1230 | al->al_line = line; | 1234 | al->al_line = line; |
| 1231 | 1235 | ||
