diff options
Diffstat (limited to 'fs/gfs2/ops_address.c')
-rw-r--r-- | fs/gfs2/ops_address.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index ac772b6d9dbb..90a04a6e3789 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | 2 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
3 | * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. | 3 | * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. |
4 | * | 4 | * |
5 | * This copyrighted material is made available to anyone wishing to use, | 5 | * This copyrighted material is made available to anyone wishing to use, |
6 | * modify, copy, or redistribute it subject to the terms and conditions | 6 | * modify, copy, or redistribute it subject to the terms and conditions |
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/gfs2_ondisk.h> | 21 | #include <linux/gfs2_ondisk.h> |
22 | #include <linux/lm_interface.h> | 22 | #include <linux/lm_interface.h> |
23 | #include <linux/backing-dev.h> | 23 | #include <linux/backing-dev.h> |
24 | #include <linux/pagevec.h> | ||
25 | 24 | ||
26 | #include "gfs2.h" | 25 | #include "gfs2.h" |
27 | #include "incore.h" | 26 | #include "incore.h" |
@@ -104,11 +103,9 @@ static int gfs2_writepage_common(struct page *page, | |||
104 | loff_t i_size = i_size_read(inode); | 103 | loff_t i_size = i_size_read(inode); |
105 | pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT; | 104 | pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT; |
106 | unsigned offset; | 105 | unsigned offset; |
107 | int ret = -EIO; | ||
108 | 106 | ||
109 | if (gfs2_assert_withdraw(sdp, gfs2_glock_is_held_excl(ip->i_gl))) | 107 | if (gfs2_assert_withdraw(sdp, gfs2_glock_is_held_excl(ip->i_gl))) |
110 | goto out; | 108 | goto out; |
111 | ret = 0; | ||
112 | if (current->journal_info) | 109 | if (current->journal_info) |
113 | goto redirty; | 110 | goto redirty; |
114 | /* Is the page fully outside i_size? (truncate in progress) */ | 111 | /* Is the page fully outside i_size? (truncate in progress) */ |
@@ -280,7 +277,7 @@ static int gfs2_write_jdata_pagevec(struct address_space *mapping, | |||
280 | int i; | 277 | int i; |
281 | int ret; | 278 | int ret; |
282 | 279 | ||
283 | ret = gfs2_trans_begin(sdp, nrblocks, 0); | 280 | ret = gfs2_trans_begin(sdp, nrblocks, nrblocks); |
284 | if (ret < 0) | 281 | if (ret < 0) |
285 | return ret; | 282 | return ret; |
286 | 283 | ||
@@ -510,23 +507,26 @@ static int __gfs2_readpage(void *file, struct page *page) | |||
510 | static int gfs2_readpage(struct file *file, struct page *page) | 507 | static int gfs2_readpage(struct file *file, struct page *page) |
511 | { | 508 | { |
512 | struct gfs2_inode *ip = GFS2_I(page->mapping->host); | 509 | struct gfs2_inode *ip = GFS2_I(page->mapping->host); |
513 | struct gfs2_holder gh; | 510 | struct gfs2_holder *gh; |
514 | int error; | 511 | int error; |
515 | 512 | ||
516 | gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME|LM_FLAG_TRY_1CB, &gh); | 513 | gh = gfs2_glock_is_locked_by_me(ip->i_gl); |
517 | error = gfs2_glock_nq_atime(&gh); | 514 | if (!gh) { |
518 | if (unlikely(error)) { | 515 | gh = kmalloc(sizeof(struct gfs2_holder), GFP_NOFS); |
516 | if (!gh) | ||
517 | return -ENOBUFS; | ||
518 | gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, gh); | ||
519 | unlock_page(page); | 519 | unlock_page(page); |
520 | goto out; | 520 | error = gfs2_glock_nq_atime(gh); |
521 | if (likely(error != 0)) | ||
522 | goto out; | ||
523 | return AOP_TRUNCATED_PAGE; | ||
521 | } | 524 | } |
522 | error = __gfs2_readpage(file, page); | 525 | error = __gfs2_readpage(file, page); |
523 | gfs2_glock_dq(&gh); | 526 | gfs2_glock_dq(gh); |
524 | out: | 527 | out: |
525 | gfs2_holder_uninit(&gh); | 528 | gfs2_holder_uninit(gh); |
526 | if (error == GLR_TRYFAILED) { | 529 | kfree(gh); |
527 | yield(); | ||
528 | return AOP_TRUNCATED_PAGE; | ||
529 | } | ||
530 | return error; | 530 | return error; |
531 | } | 531 | } |
532 | 532 | ||
@@ -648,15 +648,15 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping, | |||
648 | 648 | ||
649 | if (alloc_required) { | 649 | if (alloc_required) { |
650 | al = gfs2_alloc_get(ip); | 650 | al = gfs2_alloc_get(ip); |
651 | if (!al) { | ||
652 | error = -ENOMEM; | ||
653 | goto out_unlock; | ||
654 | } | ||
651 | 655 | ||
652 | error = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); | 656 | error = gfs2_quota_lock_check(ip); |
653 | if (error) | 657 | if (error) |
654 | goto out_alloc_put; | 658 | goto out_alloc_put; |
655 | 659 | ||
656 | error = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid); | ||
657 | if (error) | ||
658 | goto out_qunlock; | ||
659 | |||
660 | al->al_requested = data_blocks + ind_blocks; | 660 | al->al_requested = data_blocks + ind_blocks; |
661 | error = gfs2_inplace_reserve(ip); | 661 | error = gfs2_inplace_reserve(ip); |
662 | if (error) | 662 | if (error) |
@@ -828,7 +828,7 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping, | |||
828 | unsigned int to = from + len; | 828 | unsigned int to = from + len; |
829 | int ret; | 829 | int ret; |
830 | 830 | ||
831 | BUG_ON(gfs2_glock_is_locked_by_me(ip->i_gl) == 0); | 831 | BUG_ON(gfs2_glock_is_locked_by_me(ip->i_gl) == NULL); |
832 | 832 | ||
833 | ret = gfs2_meta_inode_buffer(ip, &dibh); | 833 | ret = gfs2_meta_inode_buffer(ip, &dibh); |
834 | if (unlikely(ret)) { | 834 | if (unlikely(ret)) { |