aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/file.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-09 01:34:53 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-09 01:34:53 -0400
commit38a4671cad3f0d277cf48445b49e42a475ebfb6a (patch)
tree7348f3dd5f4e1bec39758dcff748a9dcbbf3430c /fs/gfs2/file.c
parentd652f7022b359afd5d34fc9fffd71df118521ead (diff)
parent317ddd256b9c24b0d78fa8018f80f1e495481a10 (diff)
Merge 3.10-rc5 into char-misc-next
Diffstat (limited to 'fs/gfs2/file.c')
-rw-r--r--fs/gfs2/file.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index acd16764b133..ad0dc38d87ab 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -402,16 +402,20 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
402 /* Update file times before taking page lock */ 402 /* Update file times before taking page lock */
403 file_update_time(vma->vm_file); 403 file_update_time(vma->vm_file);
404 404
405 ret = get_write_access(inode);
406 if (ret)
407 goto out;
408
405 ret = gfs2_rs_alloc(ip); 409 ret = gfs2_rs_alloc(ip);
406 if (ret) 410 if (ret)
407 return ret; 411 goto out_write_access;
408 412
409 gfs2_size_hint(vma->vm_file, pos, PAGE_CACHE_SIZE); 413 gfs2_size_hint(vma->vm_file, pos, PAGE_CACHE_SIZE);
410 414
411 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); 415 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
412 ret = gfs2_glock_nq(&gh); 416 ret = gfs2_glock_nq(&gh);
413 if (ret) 417 if (ret)
414 goto out; 418 goto out_uninit;
415 419
416 set_bit(GLF_DIRTY, &ip->i_gl->gl_flags); 420 set_bit(GLF_DIRTY, &ip->i_gl->gl_flags);
417 set_bit(GIF_SW_PAGED, &ip->i_flags); 421 set_bit(GIF_SW_PAGED, &ip->i_flags);
@@ -480,12 +484,15 @@ out_quota_unlock:
480 gfs2_quota_unlock(ip); 484 gfs2_quota_unlock(ip);
481out_unlock: 485out_unlock:
482 gfs2_glock_dq(&gh); 486 gfs2_glock_dq(&gh);
483out: 487out_uninit:
484 gfs2_holder_uninit(&gh); 488 gfs2_holder_uninit(&gh);
485 if (ret == 0) { 489 if (ret == 0) {
486 set_page_dirty(page); 490 set_page_dirty(page);
487 wait_for_stable_page(page); 491 wait_for_stable_page(page);
488 } 492 }
493out_write_access:
494 put_write_access(inode);
495out:
489 sb_end_pagefault(inode->i_sb); 496 sb_end_pagefault(inode->i_sb);
490 return block_page_mkwrite_return(ret); 497 return block_page_mkwrite_return(ret);
491} 498}
@@ -594,10 +601,10 @@ static int gfs2_release(struct inode *inode, struct file *file)
594 kfree(file->private_data); 601 kfree(file->private_data);
595 file->private_data = NULL; 602 file->private_data = NULL;
596 603
597 if ((file->f_mode & FMODE_WRITE) && 604 if (!(file->f_mode & FMODE_WRITE))
598 (atomic_read(&inode->i_writecount) == 1)) 605 return 0;
599 gfs2_rs_delete(ip);
600 606
607 gfs2_rs_delete(ip);
601 return 0; 608 return 0;
602} 609}
603 610