aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2005-06-24 01:01:01 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-24 03:05:19 -0400
commitbd6a1f16fffdfe010fdc2979fd01f12357816762 (patch)
tree528e4ed005ee45936d8d8bd5cc490e0826bd27e9 /fs/reiserfs
parent92198f7eaa5df3479341dd8fa20c2c81aa3b1e25 (diff)
[PATCH] reiserfs: add checking of journal_begin() return value
Check return values of journal_begin() and journal_end() in the quota code for reiserfs. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/reiserfs')
-rw-r--r--fs/reiserfs/inode.c6
-rw-r--r--fs/reiserfs/super.c66
2 files changed, 52 insertions, 20 deletions
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 2711dff1b7b4..073425e6e0a9 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -2798,7 +2798,9 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) {
2798 struct reiserfs_transaction_handle th; 2798 struct reiserfs_transaction_handle th;
2799 2799
2800 /* (user+group)*(old+new) structure - we count quota info and , inode write (sb, inode) */ 2800 /* (user+group)*(old+new) structure - we count quota info and , inode write (sb, inode) */
2801 journal_begin(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2); 2801 error = journal_begin(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2);
2802 if (error)
2803 goto out;
2802 error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0; 2804 error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0;
2803 if (error) { 2805 if (error) {
2804 journal_end(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2); 2806 journal_end(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2);
@@ -2811,7 +2813,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) {
2811 if (attr->ia_valid & ATTR_GID) 2813 if (attr->ia_valid & ATTR_GID)
2812 inode->i_gid = attr->ia_gid; 2814 inode->i_gid = attr->ia_gid;
2813 mark_inode_dirty(inode); 2815 mark_inode_dirty(inode);
2814 journal_end(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2); 2816 error = journal_end(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2);
2815 } 2817 }
2816 } 2818 }
2817 if (!error) 2819 if (!error)
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index aae0779ed5b4..031577fb41a1 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -1841,13 +1841,18 @@ static int reiserfs_statfs (struct super_block * s, struct kstatfs * buf)
1841static int reiserfs_dquot_initialize(struct inode *inode, int type) 1841static int reiserfs_dquot_initialize(struct inode *inode, int type)
1842{ 1842{
1843 struct reiserfs_transaction_handle th; 1843 struct reiserfs_transaction_handle th;
1844 int ret; 1844 int ret, err;
1845 1845
1846 /* We may create quota structure so we need to reserve enough blocks */ 1846 /* We may create quota structure so we need to reserve enough blocks */
1847 reiserfs_write_lock(inode->i_sb); 1847 reiserfs_write_lock(inode->i_sb);
1848 journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS); 1848 ret = journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS);
1849 if (ret)
1850 goto out;
1849 ret = dquot_initialize(inode, type); 1851 ret = dquot_initialize(inode, type);
1850 journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS); 1852 err = journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS);
1853 if (!ret && err)
1854 ret = err;
1855out:
1851 reiserfs_write_unlock(inode->i_sb); 1856 reiserfs_write_unlock(inode->i_sb);
1852 return ret; 1857 return ret;
1853} 1858}
@@ -1855,13 +1860,18 @@ static int reiserfs_dquot_initialize(struct inode *inode, int type)
1855static int reiserfs_dquot_drop(struct inode *inode) 1860static int reiserfs_dquot_drop(struct inode *inode)
1856{ 1861{
1857 struct reiserfs_transaction_handle th; 1862 struct reiserfs_transaction_handle th;
1858 int ret; 1863 int ret, err;
1859 1864
1860 /* We may delete quota structure so we need to reserve enough blocks */ 1865 /* We may delete quota structure so we need to reserve enough blocks */
1861 reiserfs_write_lock(inode->i_sb); 1866 reiserfs_write_lock(inode->i_sb);
1862 journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS); 1867 ret = journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS);
1868 if (ret)
1869 goto out;
1863 ret = dquot_drop(inode); 1870 ret = dquot_drop(inode);
1864 journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS); 1871 err = journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS);
1872 if (!ret && err)
1873 ret = err;
1874out:
1865 reiserfs_write_unlock(inode->i_sb); 1875 reiserfs_write_unlock(inode->i_sb);
1866 return ret; 1876 return ret;
1867} 1877}
@@ -1869,12 +1879,17 @@ static int reiserfs_dquot_drop(struct inode *inode)
1869static int reiserfs_write_dquot(struct dquot *dquot) 1879static int reiserfs_write_dquot(struct dquot *dquot)
1870{ 1880{
1871 struct reiserfs_transaction_handle th; 1881 struct reiserfs_transaction_handle th;
1872 int ret; 1882 int ret, err;
1873 1883
1874 reiserfs_write_lock(dquot->dq_sb); 1884 reiserfs_write_lock(dquot->dq_sb);
1875 journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS); 1885 ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS);
1886 if (ret)
1887 goto out;
1876 ret = dquot_commit(dquot); 1888 ret = dquot_commit(dquot);
1877 journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS); 1889 err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS);
1890 if (!ret && err)
1891 ret = err;
1892out:
1878 reiserfs_write_unlock(dquot->dq_sb); 1893 reiserfs_write_unlock(dquot->dq_sb);
1879 return ret; 1894 return ret;
1880} 1895}
@@ -1882,12 +1897,17 @@ static int reiserfs_write_dquot(struct dquot *dquot)
1882static int reiserfs_acquire_dquot(struct dquot *dquot) 1897static int reiserfs_acquire_dquot(struct dquot *dquot)
1883{ 1898{
1884 struct reiserfs_transaction_handle th; 1899 struct reiserfs_transaction_handle th;
1885 int ret; 1900 int ret, err;
1886 1901
1887 reiserfs_write_lock(dquot->dq_sb); 1902 reiserfs_write_lock(dquot->dq_sb);
1888 journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS); 1903 ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS);
1904 if (ret)
1905 goto out;
1889 ret = dquot_acquire(dquot); 1906 ret = dquot_acquire(dquot);
1890 journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS); 1907 err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS);
1908 if (!ret && err)
1909 ret = err;
1910out:
1891 reiserfs_write_unlock(dquot->dq_sb); 1911 reiserfs_write_unlock(dquot->dq_sb);
1892 return ret; 1912 return ret;
1893} 1913}
@@ -1895,12 +1915,17 @@ static int reiserfs_acquire_dquot(struct dquot *dquot)
1895static int reiserfs_release_dquot(struct dquot *dquot) 1915static int reiserfs_release_dquot(struct dquot *dquot)
1896{ 1916{
1897 struct reiserfs_transaction_handle th; 1917 struct reiserfs_transaction_handle th;
1898 int ret; 1918 int ret, err;
1899 1919
1900 reiserfs_write_lock(dquot->dq_sb); 1920 reiserfs_write_lock(dquot->dq_sb);
1901 journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS); 1921 ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS);
1922 if (ret)
1923 goto out;
1902 ret = dquot_release(dquot); 1924 ret = dquot_release(dquot);
1903 journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS); 1925 err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS);
1926 if (!ret && err)
1927 ret = err;
1928out:
1904 reiserfs_write_unlock(dquot->dq_sb); 1929 reiserfs_write_unlock(dquot->dq_sb);
1905 return ret; 1930 return ret;
1906} 1931}
@@ -1920,13 +1945,18 @@ static int reiserfs_mark_dquot_dirty(struct dquot *dquot)
1920static int reiserfs_write_info(struct super_block *sb, int type) 1945static int reiserfs_write_info(struct super_block *sb, int type)
1921{ 1946{
1922 struct reiserfs_transaction_handle th; 1947 struct reiserfs_transaction_handle th;
1923 int ret; 1948 int ret, err;
1924 1949
1925 /* Data block + inode block */ 1950 /* Data block + inode block */
1926 reiserfs_write_lock(sb); 1951 reiserfs_write_lock(sb);
1927 journal_begin(&th, sb, 2); 1952 ret = journal_begin(&th, sb, 2);
1953 if (ret)
1954 goto out;
1928 ret = dquot_commit_info(sb, type); 1955 ret = dquot_commit_info(sb, type);
1929 journal_end(&th, sb, 2); 1956 err = journal_end(&th, sb, 2);
1957 if (!ret && err)
1958 ret = err;
1959out:
1930 reiserfs_write_unlock(sb); 1960 reiserfs_write_unlock(sb);
1931 return ret; 1961 return ret;
1932} 1962}