diff options
Diffstat (limited to 'fs/ocfs2/aops.c')
-rw-r--r-- | fs/ocfs2/aops.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 6af79adb2eca..6b647ec87bb3 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/swap.h> | 27 | #include <linux/swap.h> |
28 | #include <linux/pipe_fs_i.h> | 28 | #include <linux/pipe_fs_i.h> |
29 | #include <linux/mpage.h> | 29 | #include <linux/mpage.h> |
30 | #include <linux/quotaops.h> | ||
30 | 31 | ||
31 | #define MLOG_MASK_PREFIX ML_FILE_IO | 32 | #define MLOG_MASK_PREFIX ML_FILE_IO |
32 | #include <cluster/masklog.h> | 33 | #include <cluster/masklog.h> |
@@ -1730,6 +1731,11 @@ int ocfs2_write_begin_nolock(struct address_space *mapping, | |||
1730 | 1731 | ||
1731 | wc->w_handle = handle; | 1732 | wc->w_handle = handle; |
1732 | 1733 | ||
1734 | if (clusters_to_alloc && vfs_dq_alloc_space_nodirty(inode, | ||
1735 | ocfs2_clusters_to_bytes(osb->sb, clusters_to_alloc))) { | ||
1736 | ret = -EDQUOT; | ||
1737 | goto out_commit; | ||
1738 | } | ||
1733 | /* | 1739 | /* |
1734 | * We don't want this to fail in ocfs2_write_end(), so do it | 1740 | * We don't want this to fail in ocfs2_write_end(), so do it |
1735 | * here. | 1741 | * here. |
@@ -1738,7 +1744,7 @@ int ocfs2_write_begin_nolock(struct address_space *mapping, | |||
1738 | OCFS2_JOURNAL_ACCESS_WRITE); | 1744 | OCFS2_JOURNAL_ACCESS_WRITE); |
1739 | if (ret) { | 1745 | if (ret) { |
1740 | mlog_errno(ret); | 1746 | mlog_errno(ret); |
1741 | goto out_commit; | 1747 | goto out_quota; |
1742 | } | 1748 | } |
1743 | 1749 | ||
1744 | /* | 1750 | /* |
@@ -1751,14 +1757,14 @@ int ocfs2_write_begin_nolock(struct address_space *mapping, | |||
1751 | mmap_page); | 1757 | mmap_page); |
1752 | if (ret) { | 1758 | if (ret) { |
1753 | mlog_errno(ret); | 1759 | mlog_errno(ret); |
1754 | goto out_commit; | 1760 | goto out_quota; |
1755 | } | 1761 | } |
1756 | 1762 | ||
1757 | ret = ocfs2_write_cluster_by_desc(mapping, data_ac, meta_ac, wc, pos, | 1763 | ret = ocfs2_write_cluster_by_desc(mapping, data_ac, meta_ac, wc, pos, |
1758 | len); | 1764 | len); |
1759 | if (ret) { | 1765 | if (ret) { |
1760 | mlog_errno(ret); | 1766 | mlog_errno(ret); |
1761 | goto out_commit; | 1767 | goto out_quota; |
1762 | } | 1768 | } |
1763 | 1769 | ||
1764 | if (data_ac) | 1770 | if (data_ac) |
@@ -1770,6 +1776,10 @@ success: | |||
1770 | *pagep = wc->w_target_page; | 1776 | *pagep = wc->w_target_page; |
1771 | *fsdata = wc; | 1777 | *fsdata = wc; |
1772 | return 0; | 1778 | return 0; |
1779 | out_quota: | ||
1780 | if (clusters_to_alloc) | ||
1781 | vfs_dq_free_space(inode, | ||
1782 | ocfs2_clusters_to_bytes(osb->sb, clusters_to_alloc)); | ||
1773 | out_commit: | 1783 | out_commit: |
1774 | ocfs2_commit_trans(osb, handle); | 1784 | ocfs2_commit_trans(osb, handle); |
1775 | 1785 | ||