aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/ops_address.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/ops_address.c')
-rw-r--r--fs/gfs2/ops_address.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index f55394e57cb2..2b556dd034bb 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -507,26 +507,23 @@ static int __gfs2_readpage(void *file, struct page *page)
507static int gfs2_readpage(struct file *file, struct page *page) 507static int gfs2_readpage(struct file *file, struct page *page)
508{ 508{
509 struct gfs2_inode *ip = GFS2_I(page->mapping->host); 509 struct gfs2_inode *ip = GFS2_I(page->mapping->host);
510 struct gfs2_holder *gh; 510 struct gfs2_holder gh;
511 int error; 511 int error;
512 512
513 gh = gfs2_glock_is_locked_by_me(ip->i_gl); 513 gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME|LM_FLAG_TRY_1CB, &gh);
514 if (!gh) { 514 error = gfs2_glock_nq_atime(&gh);
515 gh = kmalloc(sizeof(struct gfs2_holder), GFP_NOFS); 515 if (unlikely(error)) {
516 if (!gh)
517 return -ENOBUFS;
518 gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, gh);
519 unlock_page(page); 516 unlock_page(page);
520 error = gfs2_glock_nq_atime(gh); 517 goto out;
521 if (likely(error != 0))
522 goto out;
523 return AOP_TRUNCATED_PAGE;
524 } 518 }
525 error = __gfs2_readpage(file, page); 519 error = __gfs2_readpage(file, page);
526 gfs2_glock_dq(gh); 520 gfs2_glock_dq(&gh);
527out: 521out:
528 gfs2_holder_uninit(gh); 522 gfs2_holder_uninit(&gh);
529 kfree(gh); 523 if (error == GLR_TRYFAILED) {
524 yield();
525 return AOP_TRUNCATED_PAGE;
526 }
530 return error; 527 return error;
531} 528}
532 529