diff options
Diffstat (limited to 'fs/gfs2/meta_io.c')
-rw-r--r-- | fs/gfs2/meta_io.c | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c index 8d6f13256b26..75b2aec06f85 100644 --- a/fs/gfs2/meta_io.c +++ b/fs/gfs2/meta_io.c | |||
@@ -201,16 +201,32 @@ struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl, u64 blkno) | |||
201 | int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags, | 201 | int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags, |
202 | struct buffer_head **bhp) | 202 | struct buffer_head **bhp) |
203 | { | 203 | { |
204 | *bhp = gfs2_getbuf(gl, blkno, CREATE); | 204 | struct gfs2_sbd *sdp = gl->gl_sbd; |
205 | if (!buffer_uptodate(*bhp)) { | 205 | struct buffer_head *bh; |
206 | ll_rw_block(READ_META, 1, bhp); | 206 | |
207 | if (flags & DIO_WAIT) { | 207 | if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) |
208 | int error = gfs2_meta_wait(gl->gl_sbd, *bhp); | 208 | return -EIO; |
209 | if (error) { | 209 | |
210 | brelse(*bhp); | 210 | *bhp = bh = gfs2_getbuf(gl, blkno, CREATE); |
211 | return error; | 211 | |
212 | } | 212 | lock_buffer(bh); |
213 | } | 213 | if (buffer_uptodate(bh)) { |
214 | unlock_buffer(bh); | ||
215 | return 0; | ||
216 | } | ||
217 | bh->b_end_io = end_buffer_read_sync; | ||
218 | get_bh(bh); | ||
219 | submit_bh(READ_SYNC | (1 << BIO_RW_META), bh); | ||
220 | if (!(flags & DIO_WAIT)) | ||
221 | return 0; | ||
222 | |||
223 | wait_on_buffer(bh); | ||
224 | if (unlikely(!buffer_uptodate(bh))) { | ||
225 | struct gfs2_trans *tr = current->journal_info; | ||
226 | if (tr && tr->tr_touched) | ||
227 | gfs2_io_error_bh(sdp, bh); | ||
228 | brelse(bh); | ||
229 | return -EIO; | ||
214 | } | 230 | } |
215 | 231 | ||
216 | return 0; | 232 | return 0; |
@@ -404,7 +420,7 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen) | |||
404 | if (buffer_uptodate(first_bh)) | 420 | if (buffer_uptodate(first_bh)) |
405 | goto out; | 421 | goto out; |
406 | if (!buffer_locked(first_bh)) | 422 | if (!buffer_locked(first_bh)) |
407 | ll_rw_block(READ_META, 1, &first_bh); | 423 | ll_rw_block(READ_SYNC | (1 << BIO_RW_META), 1, &first_bh); |
408 | 424 | ||
409 | dblock++; | 425 | dblock++; |
410 | extlen--; | 426 | extlen--; |