diff options
-rw-r--r-- | fs/ext2/file.c | 4 | ||||
-rw-r--r-- | fs/ext2/inode.c | 5 | ||||
-rw-r--r-- | fs/ext2/namei.c | 51 | ||||
-rw-r--r-- | fs/ext3/file.c | 2 | ||||
-rw-r--r-- | fs/ext3/inode.c | 5 | ||||
-rw-r--r-- | fs/ext3/namei.c | 18 | ||||
-rw-r--r-- | fs/ext4/file.c | 2 | ||||
-rw-r--r-- | fs/ext4/inode.c | 5 | ||||
-rw-r--r-- | fs/ext4/namei.c | 17 | ||||
-rw-r--r-- | fs/inode.c | 3 | ||||
-rw-r--r-- | fs/jfs/file.c | 4 | ||||
-rw-r--r-- | fs/jfs/inode.c | 3 | ||||
-rw-r--r-- | fs/jfs/namei.c | 15 | ||||
-rw-r--r-- | fs/namei.c | 16 | ||||
-rw-r--r-- | fs/nfsd/vfs.c | 4 | ||||
-rw-r--r-- | fs/ocfs2/file.c | 5 | ||||
-rw-r--r-- | fs/ocfs2/inode.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/namei.c | 11 | ||||
-rw-r--r-- | fs/open.c | 5 | ||||
-rw-r--r-- | fs/quota/dquot.c | 14 | ||||
-rw-r--r-- | fs/reiserfs/file.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/inode.c | 5 | ||||
-rw-r--r-- | fs/reiserfs/namei.c | 17 | ||||
-rw-r--r-- | fs/reiserfs/xattr.c | 4 | ||||
-rw-r--r-- | fs/udf/file.c | 5 | ||||
-rw-r--r-- | fs/udf/inode.c | 4 | ||||
-rw-r--r-- | fs/udf/namei.c | 17 | ||||
-rw-r--r-- | fs/ufs/file.c | 2 | ||||
-rw-r--r-- | fs/ufs/inode.c | 4 | ||||
-rw-r--r-- | fs/ufs/namei.c | 18 | ||||
-rw-r--r-- | fs/ufs/truncate.c | 3 | ||||
-rw-r--r-- | include/linux/quotaops.h | 4 |
32 files changed, 220 insertions, 56 deletions
diff --git a/fs/ext2/file.c b/fs/ext2/file.c index 586e3589d4c2..d11f6e484519 100644 --- a/fs/ext2/file.c +++ b/fs/ext2/file.c | |||
@@ -70,7 +70,7 @@ const struct file_operations ext2_file_operations = { | |||
70 | .compat_ioctl = ext2_compat_ioctl, | 70 | .compat_ioctl = ext2_compat_ioctl, |
71 | #endif | 71 | #endif |
72 | .mmap = generic_file_mmap, | 72 | .mmap = generic_file_mmap, |
73 | .open = generic_file_open, | 73 | .open = dquot_file_open, |
74 | .release = ext2_release_file, | 74 | .release = ext2_release_file, |
75 | .fsync = ext2_fsync, | 75 | .fsync = ext2_fsync, |
76 | .splice_read = generic_file_splice_read, | 76 | .splice_read = generic_file_splice_read, |
@@ -87,7 +87,7 @@ const struct file_operations ext2_xip_file_operations = { | |||
87 | .compat_ioctl = ext2_compat_ioctl, | 87 | .compat_ioctl = ext2_compat_ioctl, |
88 | #endif | 88 | #endif |
89 | .mmap = xip_file_mmap, | 89 | .mmap = xip_file_mmap, |
90 | .open = generic_file_open, | 90 | .open = dquot_file_open, |
91 | .release = ext2_release_file, | 91 | .release = ext2_release_file, |
92 | .fsync = ext2_fsync, | 92 | .fsync = ext2_fsync, |
93 | }; | 93 | }; |
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 3cfcfd9a131a..c87840c33e17 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
@@ -58,6 +58,8 @@ static inline int ext2_inode_is_fast_symlink(struct inode *inode) | |||
58 | */ | 58 | */ |
59 | void ext2_delete_inode (struct inode * inode) | 59 | void ext2_delete_inode (struct inode * inode) |
60 | { | 60 | { |
61 | if (!is_bad_inode(inode)) | ||
62 | vfs_dq_init(inode); | ||
61 | truncate_inode_pages(&inode->i_data, 0); | 63 | truncate_inode_pages(&inode->i_data, 0); |
62 | 64 | ||
63 | if (is_bad_inode(inode)) | 65 | if (is_bad_inode(inode)) |
@@ -1457,6 +1459,9 @@ int ext2_setattr(struct dentry *dentry, struct iattr *iattr) | |||
1457 | error = inode_change_ok(inode, iattr); | 1459 | error = inode_change_ok(inode, iattr); |
1458 | if (error) | 1460 | if (error) |
1459 | return error; | 1461 | return error; |
1462 | |||
1463 | if (iattr->ia_valid & ATTR_SIZE) | ||
1464 | vfs_dq_init(inode); | ||
1460 | if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || | 1465 | if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || |
1461 | (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { | 1466 | (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { |
1462 | error = dquot_transfer(inode, iattr); | 1467 | error = dquot_transfer(inode, iattr); |
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c index dd7175ce5606..5923df7b22af 100644 --- a/fs/ext2/namei.c +++ b/fs/ext2/namei.c | |||
@@ -31,6 +31,7 @@ | |||
31 | */ | 31 | */ |
32 | 32 | ||
33 | #include <linux/pagemap.h> | 33 | #include <linux/pagemap.h> |
34 | #include <linux/quotaops.h> | ||
34 | #include "ext2.h" | 35 | #include "ext2.h" |
35 | #include "xattr.h" | 36 | #include "xattr.h" |
36 | #include "acl.h" | 37 | #include "acl.h" |
@@ -99,24 +100,27 @@ struct dentry *ext2_get_parent(struct dentry *child) | |||
99 | */ | 100 | */ |
100 | static int ext2_create (struct inode * dir, struct dentry * dentry, int mode, struct nameidata *nd) | 101 | static int ext2_create (struct inode * dir, struct dentry * dentry, int mode, struct nameidata *nd) |
101 | { | 102 | { |
102 | struct inode * inode = ext2_new_inode (dir, mode); | 103 | struct inode *inode; |
103 | int err = PTR_ERR(inode); | 104 | |
104 | if (!IS_ERR(inode)) { | 105 | vfs_dq_init(dir); |
105 | inode->i_op = &ext2_file_inode_operations; | 106 | |
106 | if (ext2_use_xip(inode->i_sb)) { | 107 | inode = ext2_new_inode(dir, mode); |
107 | inode->i_mapping->a_ops = &ext2_aops_xip; | 108 | if (IS_ERR(inode)) |
108 | inode->i_fop = &ext2_xip_file_operations; | 109 | return PTR_ERR(inode); |
109 | } else if (test_opt(inode->i_sb, NOBH)) { | 110 | |
110 | inode->i_mapping->a_ops = &ext2_nobh_aops; | 111 | inode->i_op = &ext2_file_inode_operations; |
111 | inode->i_fop = &ext2_file_operations; | 112 | if (ext2_use_xip(inode->i_sb)) { |
112 | } else { | 113 | inode->i_mapping->a_ops = &ext2_aops_xip; |
113 | inode->i_mapping->a_ops = &ext2_aops; | 114 | inode->i_fop = &ext2_xip_file_operations; |
114 | inode->i_fop = &ext2_file_operations; | 115 | } else if (test_opt(inode->i_sb, NOBH)) { |
115 | } | 116 | inode->i_mapping->a_ops = &ext2_nobh_aops; |
116 | mark_inode_dirty(inode); | 117 | inode->i_fop = &ext2_file_operations; |
117 | err = ext2_add_nondir(dentry, inode); | 118 | } else { |
119 | inode->i_mapping->a_ops = &ext2_aops; | ||
120 | inode->i_fop = &ext2_file_operations; | ||
118 | } | 121 | } |
119 | return err; | 122 | mark_inode_dirty(inode); |
123 | return ext2_add_nondir(dentry, inode); | ||
120 | } | 124 | } |
121 | 125 | ||
122 | static int ext2_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t rdev) | 126 | static int ext2_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t rdev) |
@@ -127,6 +131,8 @@ static int ext2_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_ | |||
127 | if (!new_valid_dev(rdev)) | 131 | if (!new_valid_dev(rdev)) |
128 | return -EINVAL; | 132 | return -EINVAL; |
129 | 133 | ||
134 | vfs_dq_init(dir); | ||
135 | |||
130 | inode = ext2_new_inode (dir, mode); | 136 | inode = ext2_new_inode (dir, mode); |
131 | err = PTR_ERR(inode); | 137 | err = PTR_ERR(inode); |
132 | if (!IS_ERR(inode)) { | 138 | if (!IS_ERR(inode)) { |
@@ -151,6 +157,8 @@ static int ext2_symlink (struct inode * dir, struct dentry * dentry, | |||
151 | if (l > sb->s_blocksize) | 157 | if (l > sb->s_blocksize) |
152 | goto out; | 158 | goto out; |
153 | 159 | ||
160 | vfs_dq_init(dir); | ||
161 | |||
154 | inode = ext2_new_inode (dir, S_IFLNK | S_IRWXUGO); | 162 | inode = ext2_new_inode (dir, S_IFLNK | S_IRWXUGO); |
155 | err = PTR_ERR(inode); | 163 | err = PTR_ERR(inode); |
156 | if (IS_ERR(inode)) | 164 | if (IS_ERR(inode)) |
@@ -194,6 +202,8 @@ static int ext2_link (struct dentry * old_dentry, struct inode * dir, | |||
194 | if (inode->i_nlink >= EXT2_LINK_MAX) | 202 | if (inode->i_nlink >= EXT2_LINK_MAX) |
195 | return -EMLINK; | 203 | return -EMLINK; |
196 | 204 | ||
205 | vfs_dq_init(dir); | ||
206 | |||
197 | inode->i_ctime = CURRENT_TIME_SEC; | 207 | inode->i_ctime = CURRENT_TIME_SEC; |
198 | inode_inc_link_count(inode); | 208 | inode_inc_link_count(inode); |
199 | atomic_inc(&inode->i_count); | 209 | atomic_inc(&inode->i_count); |
@@ -216,6 +226,8 @@ static int ext2_mkdir(struct inode * dir, struct dentry * dentry, int mode) | |||
216 | if (dir->i_nlink >= EXT2_LINK_MAX) | 226 | if (dir->i_nlink >= EXT2_LINK_MAX) |
217 | goto out; | 227 | goto out; |
218 | 228 | ||
229 | vfs_dq_init(dir); | ||
230 | |||
219 | inode_inc_link_count(dir); | 231 | inode_inc_link_count(dir); |
220 | 232 | ||
221 | inode = ext2_new_inode (dir, S_IFDIR | mode); | 233 | inode = ext2_new_inode (dir, S_IFDIR | mode); |
@@ -262,6 +274,8 @@ static int ext2_unlink(struct inode * dir, struct dentry *dentry) | |||
262 | struct page * page; | 274 | struct page * page; |
263 | int err = -ENOENT; | 275 | int err = -ENOENT; |
264 | 276 | ||
277 | vfs_dq_init(dir); | ||
278 | |||
265 | de = ext2_find_entry (dir, &dentry->d_name, &page); | 279 | de = ext2_find_entry (dir, &dentry->d_name, &page); |
266 | if (!de) | 280 | if (!de) |
267 | goto out; | 281 | goto out; |
@@ -304,6 +318,9 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, | |||
304 | struct ext2_dir_entry_2 * old_de; | 318 | struct ext2_dir_entry_2 * old_de; |
305 | int err = -ENOENT; | 319 | int err = -ENOENT; |
306 | 320 | ||
321 | vfs_dq_init(old_dir); | ||
322 | vfs_dq_init(new_dir); | ||
323 | |||
307 | old_de = ext2_find_entry (old_dir, &old_dentry->d_name, &old_page); | 324 | old_de = ext2_find_entry (old_dir, &old_dentry->d_name, &old_page); |
308 | if (!old_de) | 325 | if (!old_de) |
309 | goto out; | 326 | goto out; |
diff --git a/fs/ext3/file.c b/fs/ext3/file.c index a86d3302cdc2..3c7fb11a3b29 100644 --- a/fs/ext3/file.c +++ b/fs/ext3/file.c | |||
@@ -62,7 +62,7 @@ const struct file_operations ext3_file_operations = { | |||
62 | .compat_ioctl = ext3_compat_ioctl, | 62 | .compat_ioctl = ext3_compat_ioctl, |
63 | #endif | 63 | #endif |
64 | .mmap = generic_file_mmap, | 64 | .mmap = generic_file_mmap, |
65 | .open = generic_file_open, | 65 | .open = dquot_file_open, |
66 | .release = ext3_release_file, | 66 | .release = ext3_release_file, |
67 | .fsync = ext3_sync_file, | 67 | .fsync = ext3_sync_file, |
68 | .splice_read = generic_file_splice_read, | 68 | .splice_read = generic_file_splice_read, |
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 14d40a4dd6f0..d7962b0c57b3 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -196,6 +196,9 @@ void ext3_delete_inode (struct inode * inode) | |||
196 | { | 196 | { |
197 | handle_t *handle; | 197 | handle_t *handle; |
198 | 198 | ||
199 | if (!is_bad_inode(inode)) | ||
200 | vfs_dq_init(inode); | ||
201 | |||
199 | truncate_inode_pages(&inode->i_data, 0); | 202 | truncate_inode_pages(&inode->i_data, 0); |
200 | 203 | ||
201 | if (is_bad_inode(inode)) | 204 | if (is_bad_inode(inode)) |
@@ -3148,6 +3151,8 @@ int ext3_setattr(struct dentry *dentry, struct iattr *attr) | |||
3148 | if (error) | 3151 | if (error) |
3149 | return error; | 3152 | return error; |
3150 | 3153 | ||
3154 | if (ia_valid & ATTR_SIZE) | ||
3155 | vfs_dq_init(inode); | ||
3151 | if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || | 3156 | if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || |
3152 | (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { | 3157 | (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { |
3153 | handle_t *handle; | 3158 | handle_t *handle; |
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index 7b0e44f7d66f..a492b371b134 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -1696,6 +1696,8 @@ static int ext3_create (struct inode * dir, struct dentry * dentry, int mode, | |||
1696 | struct inode * inode; | 1696 | struct inode * inode; |
1697 | int err, retries = 0; | 1697 | int err, retries = 0; |
1698 | 1698 | ||
1699 | vfs_dq_init(dir); | ||
1700 | |||
1699 | retry: | 1701 | retry: |
1700 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + | 1702 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + |
1701 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 + | 1703 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 + |
@@ -1730,6 +1732,8 @@ static int ext3_mknod (struct inode * dir, struct dentry *dentry, | |||
1730 | if (!new_valid_dev(rdev)) | 1732 | if (!new_valid_dev(rdev)) |
1731 | return -EINVAL; | 1733 | return -EINVAL; |
1732 | 1734 | ||
1735 | vfs_dq_init(dir); | ||
1736 | |||
1733 | retry: | 1737 | retry: |
1734 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + | 1738 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + |
1735 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 + | 1739 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 + |
@@ -1766,6 +1770,8 @@ static int ext3_mkdir(struct inode * dir, struct dentry * dentry, int mode) | |||
1766 | if (dir->i_nlink >= EXT3_LINK_MAX) | 1770 | if (dir->i_nlink >= EXT3_LINK_MAX) |
1767 | return -EMLINK; | 1771 | return -EMLINK; |
1768 | 1772 | ||
1773 | vfs_dq_init(dir); | ||
1774 | |||
1769 | retry: | 1775 | retry: |
1770 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + | 1776 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + |
1771 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 + | 1777 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 + |
@@ -2060,7 +2066,9 @@ static int ext3_rmdir (struct inode * dir, struct dentry *dentry) | |||
2060 | 2066 | ||
2061 | /* Initialize quotas before so that eventual writes go in | 2067 | /* Initialize quotas before so that eventual writes go in |
2062 | * separate transaction */ | 2068 | * separate transaction */ |
2069 | vfs_dq_init(dir); | ||
2063 | vfs_dq_init(dentry->d_inode); | 2070 | vfs_dq_init(dentry->d_inode); |
2071 | |||
2064 | handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb)); | 2072 | handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb)); |
2065 | if (IS_ERR(handle)) | 2073 | if (IS_ERR(handle)) |
2066 | return PTR_ERR(handle); | 2074 | return PTR_ERR(handle); |
@@ -2119,7 +2127,9 @@ static int ext3_unlink(struct inode * dir, struct dentry *dentry) | |||
2119 | 2127 | ||
2120 | /* Initialize quotas before so that eventual writes go | 2128 | /* Initialize quotas before so that eventual writes go |
2121 | * in separate transaction */ | 2129 | * in separate transaction */ |
2130 | vfs_dq_init(dir); | ||
2122 | vfs_dq_init(dentry->d_inode); | 2131 | vfs_dq_init(dentry->d_inode); |
2132 | |||
2123 | handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb)); | 2133 | handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb)); |
2124 | if (IS_ERR(handle)) | 2134 | if (IS_ERR(handle)) |
2125 | return PTR_ERR(handle); | 2135 | return PTR_ERR(handle); |
@@ -2174,6 +2184,8 @@ static int ext3_symlink (struct inode * dir, | |||
2174 | if (l > dir->i_sb->s_blocksize) | 2184 | if (l > dir->i_sb->s_blocksize) |
2175 | return -ENAMETOOLONG; | 2185 | return -ENAMETOOLONG; |
2176 | 2186 | ||
2187 | vfs_dq_init(dir); | ||
2188 | |||
2177 | retry: | 2189 | retry: |
2178 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + | 2190 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + |
2179 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 5 + | 2191 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 5 + |
@@ -2228,6 +2240,9 @@ static int ext3_link (struct dentry * old_dentry, | |||
2228 | 2240 | ||
2229 | if (inode->i_nlink >= EXT3_LINK_MAX) | 2241 | if (inode->i_nlink >= EXT3_LINK_MAX) |
2230 | return -EMLINK; | 2242 | return -EMLINK; |
2243 | |||
2244 | vfs_dq_init(dir); | ||
2245 | |||
2231 | /* | 2246 | /* |
2232 | * Return -ENOENT if we've raced with unlink and i_nlink is 0. Doing | 2247 | * Return -ENOENT if we've raced with unlink and i_nlink is 0. Doing |
2233 | * otherwise has the potential to corrupt the orphan inode list. | 2248 | * otherwise has the potential to corrupt the orphan inode list. |
@@ -2278,6 +2293,9 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry, | |||
2278 | struct ext3_dir_entry_2 * old_de, * new_de; | 2293 | struct ext3_dir_entry_2 * old_de, * new_de; |
2279 | int retval, flush_file = 0; | 2294 | int retval, flush_file = 0; |
2280 | 2295 | ||
2296 | vfs_dq_init(old_dir); | ||
2297 | vfs_dq_init(new_dir); | ||
2298 | |||
2281 | old_bh = new_bh = dir_bh = NULL; | 2299 | old_bh = new_bh = dir_bh = NULL; |
2282 | 2300 | ||
2283 | /* Initialize quotas before so that eventual writes go | 2301 | /* Initialize quotas before so that eventual writes go |
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 9630583cef28..85fa464a24ad 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
@@ -127,7 +127,7 @@ static int ext4_file_open(struct inode * inode, struct file * filp) | |||
127 | sb->s_dirt = 1; | 127 | sb->s_dirt = 1; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | return generic_file_open(inode, filp); | 130 | return dquot_file_open(inode, filp); |
131 | } | 131 | } |
132 | 132 | ||
133 | const struct file_operations ext4_file_operations = { | 133 | const struct file_operations ext4_file_operations = { |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 6a002a6d0624..eaa22ae9f1f6 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -170,6 +170,9 @@ void ext4_delete_inode(struct inode *inode) | |||
170 | handle_t *handle; | 170 | handle_t *handle; |
171 | int err; | 171 | int err; |
172 | 172 | ||
173 | if (!is_bad_inode(inode)) | ||
174 | vfs_dq_init(inode); | ||
175 | |||
173 | if (ext4_should_order_data(inode)) | 176 | if (ext4_should_order_data(inode)) |
174 | ext4_begin_ordered_truncate(inode, 0); | 177 | ext4_begin_ordered_truncate(inode, 0); |
175 | truncate_inode_pages(&inode->i_data, 0); | 178 | truncate_inode_pages(&inode->i_data, 0); |
@@ -5251,6 +5254,8 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr) | |||
5251 | if (error) | 5254 | if (error) |
5252 | return error; | 5255 | return error; |
5253 | 5256 | ||
5257 | if (ia_valid & ATTR_SIZE) | ||
5258 | vfs_dq_init(inode); | ||
5254 | if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || | 5259 | if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || |
5255 | (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { | 5260 | (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { |
5256 | handle_t *handle; | 5261 | handle_t *handle; |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 17a17e10dd60..20f55c2e7571 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -1766,6 +1766,8 @@ static int ext4_create(struct inode *dir, struct dentry *dentry, int mode, | |||
1766 | struct inode *inode; | 1766 | struct inode *inode; |
1767 | int err, retries = 0; | 1767 | int err, retries = 0; |
1768 | 1768 | ||
1769 | vfs_dq_init(dir); | ||
1770 | |||
1769 | retry: | 1771 | retry: |
1770 | handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + | 1772 | handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + |
1771 | EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 + | 1773 | EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 + |
@@ -1800,6 +1802,8 @@ static int ext4_mknod(struct inode *dir, struct dentry *dentry, | |||
1800 | if (!new_valid_dev(rdev)) | 1802 | if (!new_valid_dev(rdev)) |
1801 | return -EINVAL; | 1803 | return -EINVAL; |
1802 | 1804 | ||
1805 | vfs_dq_init(dir); | ||
1806 | |||
1803 | retry: | 1807 | retry: |
1804 | handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + | 1808 | handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + |
1805 | EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 + | 1809 | EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 + |
@@ -1837,6 +1841,8 @@ static int ext4_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
1837 | if (EXT4_DIR_LINK_MAX(dir)) | 1841 | if (EXT4_DIR_LINK_MAX(dir)) |
1838 | return -EMLINK; | 1842 | return -EMLINK; |
1839 | 1843 | ||
1844 | vfs_dq_init(dir); | ||
1845 | |||
1840 | retry: | 1846 | retry: |
1841 | handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + | 1847 | handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + |
1842 | EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 + | 1848 | EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 + |
@@ -2136,7 +2142,9 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry) | |||
2136 | 2142 | ||
2137 | /* Initialize quotas before so that eventual writes go in | 2143 | /* Initialize quotas before so that eventual writes go in |
2138 | * separate transaction */ | 2144 | * separate transaction */ |
2145 | vfs_dq_init(dir); | ||
2139 | vfs_dq_init(dentry->d_inode); | 2146 | vfs_dq_init(dentry->d_inode); |
2147 | |||
2140 | handle = ext4_journal_start(dir, EXT4_DELETE_TRANS_BLOCKS(dir->i_sb)); | 2148 | handle = ext4_journal_start(dir, EXT4_DELETE_TRANS_BLOCKS(dir->i_sb)); |
2141 | if (IS_ERR(handle)) | 2149 | if (IS_ERR(handle)) |
2142 | return PTR_ERR(handle); | 2150 | return PTR_ERR(handle); |
@@ -2195,7 +2203,9 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) | |||
2195 | 2203 | ||
2196 | /* Initialize quotas before so that eventual writes go | 2204 | /* Initialize quotas before so that eventual writes go |
2197 | * in separate transaction */ | 2205 | * in separate transaction */ |
2206 | vfs_dq_init(dir); | ||
2198 | vfs_dq_init(dentry->d_inode); | 2207 | vfs_dq_init(dentry->d_inode); |
2208 | |||
2199 | handle = ext4_journal_start(dir, EXT4_DELETE_TRANS_BLOCKS(dir->i_sb)); | 2209 | handle = ext4_journal_start(dir, EXT4_DELETE_TRANS_BLOCKS(dir->i_sb)); |
2200 | if (IS_ERR(handle)) | 2210 | if (IS_ERR(handle)) |
2201 | return PTR_ERR(handle); | 2211 | return PTR_ERR(handle); |
@@ -2250,6 +2260,8 @@ static int ext4_symlink(struct inode *dir, | |||
2250 | if (l > dir->i_sb->s_blocksize) | 2260 | if (l > dir->i_sb->s_blocksize) |
2251 | return -ENAMETOOLONG; | 2261 | return -ENAMETOOLONG; |
2252 | 2262 | ||
2263 | vfs_dq_init(dir); | ||
2264 | |||
2253 | retry: | 2265 | retry: |
2254 | handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + | 2266 | handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + |
2255 | EXT4_INDEX_EXTRA_TRANS_BLOCKS + 5 + | 2267 | EXT4_INDEX_EXTRA_TRANS_BLOCKS + 5 + |
@@ -2308,6 +2320,8 @@ static int ext4_link(struct dentry *old_dentry, | |||
2308 | if (inode->i_nlink >= EXT4_LINK_MAX) | 2320 | if (inode->i_nlink >= EXT4_LINK_MAX) |
2309 | return -EMLINK; | 2321 | return -EMLINK; |
2310 | 2322 | ||
2323 | vfs_dq_init(dir); | ||
2324 | |||
2311 | /* | 2325 | /* |
2312 | * Return -ENOENT if we've raced with unlink and i_nlink is 0. Doing | 2326 | * Return -ENOENT if we've raced with unlink and i_nlink is 0. Doing |
2313 | * otherwise has the potential to corrupt the orphan inode list. | 2327 | * otherwise has the potential to corrupt the orphan inode list. |
@@ -2358,6 +2372,9 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
2358 | struct ext4_dir_entry_2 *old_de, *new_de; | 2372 | struct ext4_dir_entry_2 *old_de, *new_de; |
2359 | int retval, force_da_alloc = 0; | 2373 | int retval, force_da_alloc = 0; |
2360 | 2374 | ||
2375 | vfs_dq_init(old_dir); | ||
2376 | vfs_dq_init(new_dir); | ||
2377 | |||
2361 | old_bh = new_bh = dir_bh = NULL; | 2378 | old_bh = new_bh = dir_bh = NULL; |
2362 | 2379 | ||
2363 | /* Initialize quotas before so that eventual writes go | 2380 | /* Initialize quotas before so that eventual writes go |
diff --git a/fs/inode.c b/fs/inode.c index f1aef3482b0e..407bf392e20a 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -8,7 +8,6 @@ | |||
8 | #include <linux/mm.h> | 8 | #include <linux/mm.h> |
9 | #include <linux/dcache.h> | 9 | #include <linux/dcache.h> |
10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
11 | #include <linux/quotaops.h> | ||
12 | #include <linux/slab.h> | 11 | #include <linux/slab.h> |
13 | #include <linux/writeback.h> | 12 | #include <linux/writeback.h> |
14 | #include <linux/module.h> | 13 | #include <linux/module.h> |
@@ -1210,8 +1209,6 @@ void generic_delete_inode(struct inode *inode) | |||
1210 | 1209 | ||
1211 | if (op->delete_inode) { | 1210 | if (op->delete_inode) { |
1212 | void (*delete)(struct inode *) = op->delete_inode; | 1211 | void (*delete)(struct inode *) = op->delete_inode; |
1213 | if (!is_bad_inode(inode)) | ||
1214 | vfs_dq_init(inode); | ||
1215 | /* Filesystems implementing their own | 1212 | /* Filesystems implementing their own |
1216 | * s_op->delete_inode are required to call | 1213 | * s_op->delete_inode are required to call |
1217 | * truncate_inode_pages and clear_inode() | 1214 | * truncate_inode_pages and clear_inode() |
diff --git a/fs/jfs/file.c b/fs/jfs/file.c index 2c201783836f..f19bb33eb1eb 100644 --- a/fs/jfs/file.c +++ b/fs/jfs/file.c | |||
@@ -48,7 +48,7 @@ static int jfs_open(struct inode *inode, struct file *file) | |||
48 | { | 48 | { |
49 | int rc; | 49 | int rc; |
50 | 50 | ||
51 | if ((rc = generic_file_open(inode, file))) | 51 | if ((rc = dquot_file_open(inode, file))) |
52 | return rc; | 52 | return rc; |
53 | 53 | ||
54 | /* | 54 | /* |
@@ -98,6 +98,8 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr) | |||
98 | if (rc) | 98 | if (rc) |
99 | return rc; | 99 | return rc; |
100 | 100 | ||
101 | if (iattr->ia_valid & ATTR_SIZE) | ||
102 | vfs_dq_init(inode); | ||
101 | if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || | 103 | if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || |
102 | (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { | 104 | (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { |
103 | rc = dquot_transfer(inode, iattr); | 105 | rc = dquot_transfer(inode, iattr); |
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c index 22fa412c5289..1aa2dda16590 100644 --- a/fs/jfs/inode.c +++ b/fs/jfs/inode.c | |||
@@ -146,6 +146,9 @@ void jfs_delete_inode(struct inode *inode) | |||
146 | { | 146 | { |
147 | jfs_info("In jfs_delete_inode, inode = 0x%p", inode); | 147 | jfs_info("In jfs_delete_inode, inode = 0x%p", inode); |
148 | 148 | ||
149 | if (!is_bad_inode(inode)) | ||
150 | vfs_dq_init(inode); | ||
151 | |||
149 | if (!is_bad_inode(inode) && | 152 | if (!is_bad_inode(inode) && |
150 | (JFS_IP(inode)->fileset == FILESYSTEM_I)) { | 153 | (JFS_IP(inode)->fileset == FILESYSTEM_I)) { |
151 | truncate_inode_pages(&inode->i_data, 0); | 154 | truncate_inode_pages(&inode->i_data, 0); |
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index 1d1390afe55e..b7cc29da50b4 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c | |||
@@ -85,6 +85,8 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, int mode, | |||
85 | 85 | ||
86 | jfs_info("jfs_create: dip:0x%p name:%s", dip, dentry->d_name.name); | 86 | jfs_info("jfs_create: dip:0x%p name:%s", dip, dentry->d_name.name); |
87 | 87 | ||
88 | vfs_dq_init(dip); | ||
89 | |||
88 | /* | 90 | /* |
89 | * search parent directory for entry/freespace | 91 | * search parent directory for entry/freespace |
90 | * (dtSearch() returns parent directory page pinned) | 92 | * (dtSearch() returns parent directory page pinned) |
@@ -215,6 +217,8 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode) | |||
215 | 217 | ||
216 | jfs_info("jfs_mkdir: dip:0x%p name:%s", dip, dentry->d_name.name); | 218 | jfs_info("jfs_mkdir: dip:0x%p name:%s", dip, dentry->d_name.name); |
217 | 219 | ||
220 | vfs_dq_init(dip); | ||
221 | |||
218 | /* link count overflow on parent directory ? */ | 222 | /* link count overflow on parent directory ? */ |
219 | if (dip->i_nlink == JFS_LINK_MAX) { | 223 | if (dip->i_nlink == JFS_LINK_MAX) { |
220 | rc = -EMLINK; | 224 | rc = -EMLINK; |
@@ -356,6 +360,7 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry) | |||
356 | jfs_info("jfs_rmdir: dip:0x%p name:%s", dip, dentry->d_name.name); | 360 | jfs_info("jfs_rmdir: dip:0x%p name:%s", dip, dentry->d_name.name); |
357 | 361 | ||
358 | /* Init inode for quota operations. */ | 362 | /* Init inode for quota operations. */ |
363 | vfs_dq_init(dip); | ||
359 | vfs_dq_init(ip); | 364 | vfs_dq_init(ip); |
360 | 365 | ||
361 | /* directory must be empty to be removed */ | 366 | /* directory must be empty to be removed */ |
@@ -483,6 +488,7 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry) | |||
483 | jfs_info("jfs_unlink: dip:0x%p name:%s", dip, dentry->d_name.name); | 488 | jfs_info("jfs_unlink: dip:0x%p name:%s", dip, dentry->d_name.name); |
484 | 489 | ||
485 | /* Init inode for quota operations. */ | 490 | /* Init inode for quota operations. */ |
491 | vfs_dq_init(dip); | ||
486 | vfs_dq_init(ip); | 492 | vfs_dq_init(ip); |
487 | 493 | ||
488 | if ((rc = get_UCSname(&dname, dentry))) | 494 | if ((rc = get_UCSname(&dname, dentry))) |
@@ -805,6 +811,8 @@ static int jfs_link(struct dentry *old_dentry, | |||
805 | if (ip->i_nlink == 0) | 811 | if (ip->i_nlink == 0) |
806 | return -ENOENT; | 812 | return -ENOENT; |
807 | 813 | ||
814 | vfs_dq_init(dir); | ||
815 | |||
808 | tid = txBegin(ip->i_sb, 0); | 816 | tid = txBegin(ip->i_sb, 0); |
809 | 817 | ||
810 | mutex_lock_nested(&JFS_IP(dir)->commit_mutex, COMMIT_MUTEX_PARENT); | 818 | mutex_lock_nested(&JFS_IP(dir)->commit_mutex, COMMIT_MUTEX_PARENT); |
@@ -896,6 +904,8 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry, | |||
896 | 904 | ||
897 | jfs_info("jfs_symlink: dip:0x%p name:%s", dip, name); | 905 | jfs_info("jfs_symlink: dip:0x%p name:%s", dip, name); |
898 | 906 | ||
907 | vfs_dq_init(dip); | ||
908 | |||
899 | ssize = strlen(name) + 1; | 909 | ssize = strlen(name) + 1; |
900 | 910 | ||
901 | /* | 911 | /* |
@@ -1087,6 +1097,9 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1087 | jfs_info("jfs_rename: %s %s", old_dentry->d_name.name, | 1097 | jfs_info("jfs_rename: %s %s", old_dentry->d_name.name, |
1088 | new_dentry->d_name.name); | 1098 | new_dentry->d_name.name); |
1089 | 1099 | ||
1100 | vfs_dq_init(old_dir); | ||
1101 | vfs_dq_init(new_dir); | ||
1102 | |||
1090 | old_ip = old_dentry->d_inode; | 1103 | old_ip = old_dentry->d_inode; |
1091 | new_ip = new_dentry->d_inode; | 1104 | new_ip = new_dentry->d_inode; |
1092 | 1105 | ||
@@ -1360,6 +1373,8 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry, | |||
1360 | 1373 | ||
1361 | jfs_info("jfs_mknod: %s", dentry->d_name.name); | 1374 | jfs_info("jfs_mknod: %s", dentry->d_name.name); |
1362 | 1375 | ||
1376 | vfs_dq_init(dir); | ||
1377 | |||
1363 | if ((rc = get_UCSname(&dname, dentry))) | 1378 | if ((rc = get_UCSname(&dname, dentry))) |
1364 | goto out; | 1379 | goto out; |
1365 | 1380 | ||
diff --git a/fs/namei.c b/fs/namei.c index a4855af776a8..06abd2bf473c 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
21 | #include <linux/namei.h> | 21 | #include <linux/namei.h> |
22 | #include <linux/quotaops.h> | ||
23 | #include <linux/pagemap.h> | 22 | #include <linux/pagemap.h> |
24 | #include <linux/fsnotify.h> | 23 | #include <linux/fsnotify.h> |
25 | #include <linux/personality.h> | 24 | #include <linux/personality.h> |
@@ -1461,7 +1460,6 @@ int vfs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
1461 | error = security_inode_create(dir, dentry, mode); | 1460 | error = security_inode_create(dir, dentry, mode); |
1462 | if (error) | 1461 | if (error) |
1463 | return error; | 1462 | return error; |
1464 | vfs_dq_init(dir); | ||
1465 | error = dir->i_op->create(dir, dentry, mode, nd); | 1463 | error = dir->i_op->create(dir, dentry, mode, nd); |
1466 | if (!error) | 1464 | if (!error) |
1467 | fsnotify_create(dir, dentry); | 1465 | fsnotify_create(dir, dentry); |
@@ -1813,9 +1811,6 @@ ok: | |||
1813 | } | 1811 | } |
1814 | } | 1812 | } |
1815 | if (!IS_ERR(filp)) { | 1813 | if (!IS_ERR(filp)) { |
1816 | if (acc_mode & MAY_WRITE) | ||
1817 | vfs_dq_init(nd.path.dentry->d_inode); | ||
1818 | |||
1819 | if (will_truncate) { | 1814 | if (will_truncate) { |
1820 | error = handle_truncate(&nd.path); | 1815 | error = handle_truncate(&nd.path); |
1821 | if (error) { | 1816 | if (error) { |
@@ -1996,7 +1991,6 @@ int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) | |||
1996 | if (error) | 1991 | if (error) |
1997 | return error; | 1992 | return error; |
1998 | 1993 | ||
1999 | vfs_dq_init(dir); | ||
2000 | error = dir->i_op->mknod(dir, dentry, mode, dev); | 1994 | error = dir->i_op->mknod(dir, dentry, mode, dev); |
2001 | if (!error) | 1995 | if (!error) |
2002 | fsnotify_create(dir, dentry); | 1996 | fsnotify_create(dir, dentry); |
@@ -2095,7 +2089,6 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
2095 | if (error) | 2089 | if (error) |
2096 | return error; | 2090 | return error; |
2097 | 2091 | ||
2098 | vfs_dq_init(dir); | ||
2099 | error = dir->i_op->mkdir(dir, dentry, mode); | 2092 | error = dir->i_op->mkdir(dir, dentry, mode); |
2100 | if (!error) | 2093 | if (!error) |
2101 | fsnotify_mkdir(dir, dentry); | 2094 | fsnotify_mkdir(dir, dentry); |
@@ -2181,8 +2174,6 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
2181 | if (!dir->i_op->rmdir) | 2174 | if (!dir->i_op->rmdir) |
2182 | return -EPERM; | 2175 | return -EPERM; |
2183 | 2176 | ||
2184 | vfs_dq_init(dir); | ||
2185 | |||
2186 | mutex_lock(&dentry->d_inode->i_mutex); | 2177 | mutex_lock(&dentry->d_inode->i_mutex); |
2187 | dentry_unhash(dentry); | 2178 | dentry_unhash(dentry); |
2188 | if (d_mountpoint(dentry)) | 2179 | if (d_mountpoint(dentry)) |
@@ -2268,8 +2259,6 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry) | |||
2268 | if (!dir->i_op->unlink) | 2259 | if (!dir->i_op->unlink) |
2269 | return -EPERM; | 2260 | return -EPERM; |
2270 | 2261 | ||
2271 | vfs_dq_init(dir); | ||
2272 | |||
2273 | mutex_lock(&dentry->d_inode->i_mutex); | 2262 | mutex_lock(&dentry->d_inode->i_mutex); |
2274 | if (d_mountpoint(dentry)) | 2263 | if (d_mountpoint(dentry)) |
2275 | error = -EBUSY; | 2264 | error = -EBUSY; |
@@ -2379,7 +2368,6 @@ int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname) | |||
2379 | if (error) | 2368 | if (error) |
2380 | return error; | 2369 | return error; |
2381 | 2370 | ||
2382 | vfs_dq_init(dir); | ||
2383 | error = dir->i_op->symlink(dir, dentry, oldname); | 2371 | error = dir->i_op->symlink(dir, dentry, oldname); |
2384 | if (!error) | 2372 | if (!error) |
2385 | fsnotify_create(dir, dentry); | 2373 | fsnotify_create(dir, dentry); |
@@ -2463,7 +2451,6 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de | |||
2463 | return error; | 2451 | return error; |
2464 | 2452 | ||
2465 | mutex_lock(&inode->i_mutex); | 2453 | mutex_lock(&inode->i_mutex); |
2466 | vfs_dq_init(dir); | ||
2467 | error = dir->i_op->link(old_dentry, dir, new_dentry); | 2454 | error = dir->i_op->link(old_dentry, dir, new_dentry); |
2468 | mutex_unlock(&inode->i_mutex); | 2455 | mutex_unlock(&inode->i_mutex); |
2469 | if (!error) | 2456 | if (!error) |
@@ -2662,9 +2649,6 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
2662 | if (!old_dir->i_op->rename) | 2649 | if (!old_dir->i_op->rename) |
2663 | return -EPERM; | 2650 | return -EPERM; |
2664 | 2651 | ||
2665 | vfs_dq_init(old_dir); | ||
2666 | vfs_dq_init(new_dir); | ||
2667 | |||
2668 | old_name = fsnotify_oldname_init(old_dentry->d_name.name); | 2652 | old_name = fsnotify_oldname_init(old_dentry->d_name.name); |
2669 | 2653 | ||
2670 | if (is_dir) | 2654 | if (is_dir) |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 8715d194561a..09e9fc043600 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/fcntl.h> | 20 | #include <linux/fcntl.h> |
21 | #include <linux/namei.h> | 21 | #include <linux/namei.h> |
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/quotaops.h> | ||
24 | #include <linux/fsnotify.h> | 23 | #include <linux/fsnotify.h> |
25 | #include <linux/posix_acl_xattr.h> | 24 | #include <linux/posix_acl_xattr.h> |
26 | #include <linux/xattr.h> | 25 | #include <linux/xattr.h> |
@@ -377,7 +376,6 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | |||
377 | put_write_access(inode); | 376 | put_write_access(inode); |
378 | goto out_nfserr; | 377 | goto out_nfserr; |
379 | } | 378 | } |
380 | vfs_dq_init(inode); | ||
381 | } | 379 | } |
382 | 380 | ||
383 | /* sanitize the mode change */ | 381 | /* sanitize the mode change */ |
@@ -745,8 +743,6 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, | |||
745 | flags = O_RDWR|O_LARGEFILE; | 743 | flags = O_RDWR|O_LARGEFILE; |
746 | else | 744 | else |
747 | flags = O_WRONLY|O_LARGEFILE; | 745 | flags = O_WRONLY|O_LARGEFILE; |
748 | |||
749 | vfs_dq_init(inode); | ||
750 | } | 746 | } |
751 | *filp = dentry_open(dget(dentry), mntget(fhp->fh_export->ex_path.mnt), | 747 | *filp = dentry_open(dget(dentry), mntget(fhp->fh_export->ex_path.mnt), |
752 | flags, current_cred()); | 748 | flags, current_cred()); |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 472e8f8bc892..126198f5a67c 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -107,6 +107,9 @@ static int ocfs2_file_open(struct inode *inode, struct file *file) | |||
107 | mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file, | 107 | mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file, |
108 | file->f_path.dentry->d_name.len, file->f_path.dentry->d_name.name); | 108 | file->f_path.dentry->d_name.len, file->f_path.dentry->d_name.name); |
109 | 109 | ||
110 | if (file->f_mode & FMODE_WRITE) | ||
111 | vfs_dq_init(inode); | ||
112 | |||
110 | spin_lock(&oi->ip_lock); | 113 | spin_lock(&oi->ip_lock); |
111 | 114 | ||
112 | /* Check that the inode hasn't been wiped from disk by another | 115 | /* Check that the inode hasn't been wiped from disk by another |
@@ -977,6 +980,8 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) | |||
977 | 980 | ||
978 | size_change = S_ISREG(inode->i_mode) && attr->ia_valid & ATTR_SIZE; | 981 | size_change = S_ISREG(inode->i_mode) && attr->ia_valid & ATTR_SIZE; |
979 | if (size_change) { | 982 | if (size_change) { |
983 | vfs_dq_init(inode); | ||
984 | |||
980 | status = ocfs2_rw_lock(inode, 1); | 985 | status = ocfs2_rw_lock(inode, 1); |
981 | if (status < 0) { | 986 | if (status < 0) { |
982 | mlog_errno(status); | 987 | mlog_errno(status); |
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 00eb6a095e68..77681a690d16 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -971,6 +971,8 @@ void ocfs2_delete_inode(struct inode *inode) | |||
971 | goto bail; | 971 | goto bail; |
972 | } | 972 | } |
973 | 973 | ||
974 | vfs_dq_init(inode); | ||
975 | |||
974 | if (!ocfs2_inode_is_valid_to_delete(inode)) { | 976 | if (!ocfs2_inode_is_valid_to_delete(inode)) { |
975 | /* It's probably not necessary to truncate_inode_pages | 977 | /* It's probably not necessary to truncate_inode_pages |
976 | * here but we do it for safety anyway (it will most | 978 | * here but we do it for safety anyway (it will most |
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 99766b6418eb..8b5b142eb638 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -244,6 +244,8 @@ static int ocfs2_mknod(struct inode *dir, | |||
244 | (unsigned long)dev, dentry->d_name.len, | 244 | (unsigned long)dev, dentry->d_name.len, |
245 | dentry->d_name.name); | 245 | dentry->d_name.name); |
246 | 246 | ||
247 | vfs_dq_init(dir); | ||
248 | |||
247 | /* get our super block */ | 249 | /* get our super block */ |
248 | osb = OCFS2_SB(dir->i_sb); | 250 | osb = OCFS2_SB(dir->i_sb); |
249 | 251 | ||
@@ -632,6 +634,8 @@ static int ocfs2_link(struct dentry *old_dentry, | |||
632 | if (S_ISDIR(inode->i_mode)) | 634 | if (S_ISDIR(inode->i_mode)) |
633 | return -EPERM; | 635 | return -EPERM; |
634 | 636 | ||
637 | vfs_dq_init(dir); | ||
638 | |||
635 | err = ocfs2_inode_lock_nested(dir, &parent_fe_bh, 1, OI_LS_PARENT); | 639 | err = ocfs2_inode_lock_nested(dir, &parent_fe_bh, 1, OI_LS_PARENT); |
636 | if (err < 0) { | 640 | if (err < 0) { |
637 | if (err != -ENOENT) | 641 | if (err != -ENOENT) |
@@ -787,6 +791,8 @@ static int ocfs2_unlink(struct inode *dir, | |||
787 | mlog_entry("(0x%p, 0x%p, '%.*s')\n", dir, dentry, | 791 | mlog_entry("(0x%p, 0x%p, '%.*s')\n", dir, dentry, |
788 | dentry->d_name.len, dentry->d_name.name); | 792 | dentry->d_name.len, dentry->d_name.name); |
789 | 793 | ||
794 | vfs_dq_init(dir); | ||
795 | |||
790 | BUG_ON(dentry->d_parent->d_inode != dir); | 796 | BUG_ON(dentry->d_parent->d_inode != dir); |
791 | 797 | ||
792 | mlog(0, "ino = %llu\n", (unsigned long long)OCFS2_I(inode)->ip_blkno); | 798 | mlog(0, "ino = %llu\n", (unsigned long long)OCFS2_I(inode)->ip_blkno); |
@@ -1047,6 +1053,9 @@ static int ocfs2_rename(struct inode *old_dir, | |||
1047 | old_dentry->d_name.len, old_dentry->d_name.name, | 1053 | old_dentry->d_name.len, old_dentry->d_name.name, |
1048 | new_dentry->d_name.len, new_dentry->d_name.name); | 1054 | new_dentry->d_name.len, new_dentry->d_name.name); |
1049 | 1055 | ||
1056 | vfs_dq_init(old_dir); | ||
1057 | vfs_dq_init(new_dir); | ||
1058 | |||
1050 | osb = OCFS2_SB(old_dir->i_sb); | 1059 | osb = OCFS2_SB(old_dir->i_sb); |
1051 | 1060 | ||
1052 | if (new_inode) { | 1061 | if (new_inode) { |
@@ -1595,6 +1604,8 @@ static int ocfs2_symlink(struct inode *dir, | |||
1595 | mlog_entry("(0x%p, 0x%p, symname='%s' actual='%.*s')\n", dir, | 1604 | mlog_entry("(0x%p, 0x%p, symname='%s' actual='%.*s')\n", dir, |
1596 | dentry, symname, dentry->d_name.len, dentry->d_name.name); | 1605 | dentry, symname, dentry->d_name.len, dentry->d_name.name); |
1597 | 1606 | ||
1607 | vfs_dq_init(dir); | ||
1608 | |||
1598 | sb = dir->i_sb; | 1609 | sb = dir->i_sb; |
1599 | osb = OCFS2_SB(sb); | 1610 | osb = OCFS2_SB(sb); |
1600 | 1611 | ||
@@ -8,7 +8,6 @@ | |||
8 | #include <linux/mm.h> | 8 | #include <linux/mm.h> |
9 | #include <linux/file.h> | 9 | #include <linux/file.h> |
10 | #include <linux/fdtable.h> | 10 | #include <linux/fdtable.h> |
11 | #include <linux/quotaops.h> | ||
12 | #include <linux/fsnotify.h> | 11 | #include <linux/fsnotify.h> |
13 | #include <linux/module.h> | 12 | #include <linux/module.h> |
14 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
@@ -278,10 +277,8 @@ static long do_sys_truncate(const char __user *pathname, loff_t length) | |||
278 | error = locks_verify_truncate(inode, NULL, length); | 277 | error = locks_verify_truncate(inode, NULL, length); |
279 | if (!error) | 278 | if (!error) |
280 | error = security_path_truncate(&path, length, 0); | 279 | error = security_path_truncate(&path, length, 0); |
281 | if (!error) { | 280 | if (!error) |
282 | vfs_dq_init(inode); | ||
283 | error = do_truncate(path.dentry, length, 0, NULL); | 281 | error = do_truncate(path.dentry, length, 0, NULL); |
284 | } | ||
285 | 282 | ||
286 | put_write_and_out: | 283 | put_write_and_out: |
287 | put_write_access(inode); | 284 | put_write_access(inode); |
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index cd83c5b871ba..6244bca45c9d 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -1821,6 +1821,20 @@ const struct dquot_operations dquot_operations = { | |||
1821 | }; | 1821 | }; |
1822 | 1822 | ||
1823 | /* | 1823 | /* |
1824 | * Generic helper for ->open on filesystems supporting disk quotas. | ||
1825 | */ | ||
1826 | int dquot_file_open(struct inode *inode, struct file *file) | ||
1827 | { | ||
1828 | int error; | ||
1829 | |||
1830 | error = generic_file_open(inode, file); | ||
1831 | if (!error && (file->f_mode & FMODE_WRITE)) | ||
1832 | vfs_dq_init(inode); | ||
1833 | return error; | ||
1834 | } | ||
1835 | EXPORT_SYMBOL(dquot_file_open); | ||
1836 | |||
1837 | /* | ||
1824 | * Turn quota off on a device. type == -1 ==> quotaoff for all types (umount) | 1838 | * Turn quota off on a device. type == -1 ==> quotaoff for all types (umount) |
1825 | */ | 1839 | */ |
1826 | int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags) | 1840 | int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags) |
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index da2dba082e2d..1d9c12714c5c 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -289,7 +289,7 @@ const struct file_operations reiserfs_file_operations = { | |||
289 | .compat_ioctl = reiserfs_compat_ioctl, | 289 | .compat_ioctl = reiserfs_compat_ioctl, |
290 | #endif | 290 | #endif |
291 | .mmap = reiserfs_file_mmap, | 291 | .mmap = reiserfs_file_mmap, |
292 | .open = generic_file_open, | 292 | .open = dquot_file_open, |
293 | .release = reiserfs_file_release, | 293 | .release = reiserfs_file_release, |
294 | .fsync = reiserfs_sync_file, | 294 | .fsync = reiserfs_sync_file, |
295 | .aio_read = generic_file_aio_read, | 295 | .aio_read = generic_file_aio_read, |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index f07c3b69247d..06995cb48e39 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -34,6 +34,9 @@ void reiserfs_delete_inode(struct inode *inode) | |||
34 | int depth; | 34 | int depth; |
35 | int err; | 35 | int err; |
36 | 36 | ||
37 | if (!is_bad_inode(inode)) | ||
38 | vfs_dq_init(inode); | ||
39 | |||
37 | truncate_inode_pages(&inode->i_data, 0); | 40 | truncate_inode_pages(&inode->i_data, 0); |
38 | 41 | ||
39 | depth = reiserfs_write_lock_once(inode->i_sb); | 42 | depth = reiserfs_write_lock_once(inode->i_sb); |
@@ -3073,6 +3076,8 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
3073 | 3076 | ||
3074 | depth = reiserfs_write_lock_once(inode->i_sb); | 3077 | depth = reiserfs_write_lock_once(inode->i_sb); |
3075 | if (attr->ia_valid & ATTR_SIZE) { | 3078 | if (attr->ia_valid & ATTR_SIZE) { |
3079 | vfs_dq_init(inode); | ||
3080 | |||
3076 | /* version 2 items will be caught by the s_maxbytes check | 3081 | /* version 2 items will be caught by the s_maxbytes check |
3077 | ** done for us in vmtruncate | 3082 | ** done for us in vmtruncate |
3078 | */ | 3083 | */ |
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c index 9dea84e8a79a..c55e1b9fee5f 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c | |||
@@ -594,6 +594,8 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
594 | struct reiserfs_transaction_handle th; | 594 | struct reiserfs_transaction_handle th; |
595 | struct reiserfs_security_handle security; | 595 | struct reiserfs_security_handle security; |
596 | 596 | ||
597 | vfs_dq_init(dir); | ||
598 | |||
597 | if (!(inode = new_inode(dir->i_sb))) { | 599 | if (!(inode = new_inode(dir->i_sb))) { |
598 | return -ENOMEM; | 600 | return -ENOMEM; |
599 | } | 601 | } |
@@ -666,6 +668,8 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, int mode, | |||
666 | if (!new_valid_dev(rdev)) | 668 | if (!new_valid_dev(rdev)) |
667 | return -EINVAL; | 669 | return -EINVAL; |
668 | 670 | ||
671 | vfs_dq_init(dir); | ||
672 | |||
669 | if (!(inode = new_inode(dir->i_sb))) { | 673 | if (!(inode = new_inode(dir->i_sb))) { |
670 | return -ENOMEM; | 674 | return -ENOMEM; |
671 | } | 675 | } |
@@ -739,6 +743,8 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
739 | 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + | 743 | 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + |
740 | REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); | 744 | REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); |
741 | 745 | ||
746 | vfs_dq_init(dir); | ||
747 | |||
742 | #ifdef DISPLACE_NEW_PACKING_LOCALITIES | 748 | #ifdef DISPLACE_NEW_PACKING_LOCALITIES |
743 | /* set flag that new packing locality created and new blocks for the content * of that directory are not displaced yet */ | 749 | /* set flag that new packing locality created and new blocks for the content * of that directory are not displaced yet */ |
744 | REISERFS_I(dir)->new_packing_locality = 1; | 750 | REISERFS_I(dir)->new_packing_locality = 1; |
@@ -842,6 +848,8 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
842 | JOURNAL_PER_BALANCE_CNT * 2 + 2 + | 848 | JOURNAL_PER_BALANCE_CNT * 2 + 2 + |
843 | 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); | 849 | 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); |
844 | 850 | ||
851 | vfs_dq_init(dir); | ||
852 | |||
845 | reiserfs_write_lock(dir->i_sb); | 853 | reiserfs_write_lock(dir->i_sb); |
846 | retval = journal_begin(&th, dir->i_sb, jbegin_count); | 854 | retval = journal_begin(&th, dir->i_sb, jbegin_count); |
847 | if (retval) | 855 | if (retval) |
@@ -923,6 +931,8 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry) | |||
923 | unsigned long savelink; | 931 | unsigned long savelink; |
924 | int depth; | 932 | int depth; |
925 | 933 | ||
934 | vfs_dq_init(dir); | ||
935 | |||
926 | inode = dentry->d_inode; | 936 | inode = dentry->d_inode; |
927 | 937 | ||
928 | /* in this transaction we can be doing at max two balancings and update | 938 | /* in this transaction we can be doing at max two balancings and update |
@@ -1024,6 +1034,8 @@ static int reiserfs_symlink(struct inode *parent_dir, | |||
1024 | 2 * (REISERFS_QUOTA_INIT_BLOCKS(parent_dir->i_sb) + | 1034 | 2 * (REISERFS_QUOTA_INIT_BLOCKS(parent_dir->i_sb) + |
1025 | REISERFS_QUOTA_TRANS_BLOCKS(parent_dir->i_sb)); | 1035 | REISERFS_QUOTA_TRANS_BLOCKS(parent_dir->i_sb)); |
1026 | 1036 | ||
1037 | vfs_dq_init(parent_dir); | ||
1038 | |||
1027 | if (!(inode = new_inode(parent_dir->i_sb))) { | 1039 | if (!(inode = new_inode(parent_dir->i_sb))) { |
1028 | return -ENOMEM; | 1040 | return -ENOMEM; |
1029 | } | 1041 | } |
@@ -1111,6 +1123,8 @@ static int reiserfs_link(struct dentry *old_dentry, struct inode *dir, | |||
1111 | JOURNAL_PER_BALANCE_CNT * 3 + | 1123 | JOURNAL_PER_BALANCE_CNT * 3 + |
1112 | 2 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); | 1124 | 2 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); |
1113 | 1125 | ||
1126 | vfs_dq_init(dir); | ||
1127 | |||
1114 | reiserfs_write_lock(dir->i_sb); | 1128 | reiserfs_write_lock(dir->i_sb); |
1115 | if (inode->i_nlink >= REISERFS_LINK_MAX) { | 1129 | if (inode->i_nlink >= REISERFS_LINK_MAX) { |
1116 | //FIXME: sd_nlink is 32 bit for new files | 1130 | //FIXME: sd_nlink is 32 bit for new files |
@@ -1235,6 +1249,9 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1235 | JOURNAL_PER_BALANCE_CNT * 3 + 5 + | 1249 | JOURNAL_PER_BALANCE_CNT * 3 + 5 + |
1236 | 4 * REISERFS_QUOTA_TRANS_BLOCKS(old_dir->i_sb); | 1250 | 4 * REISERFS_QUOTA_TRANS_BLOCKS(old_dir->i_sb); |
1237 | 1251 | ||
1252 | vfs_dq_init(old_dir); | ||
1253 | vfs_dq_init(new_dir); | ||
1254 | |||
1238 | old_inode = old_dentry->d_inode; | 1255 | old_inode = old_dentry->d_inode; |
1239 | new_dentry_inode = new_dentry->d_inode; | 1256 | new_dentry_inode = new_dentry->d_inode; |
1240 | 1257 | ||
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index 81f09fab8ae4..37d034ca7d99 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -61,7 +61,6 @@ | |||
61 | static int xattr_create(struct inode *dir, struct dentry *dentry, int mode) | 61 | static int xattr_create(struct inode *dir, struct dentry *dentry, int mode) |
62 | { | 62 | { |
63 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); | 63 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); |
64 | vfs_dq_init(dir); | ||
65 | return dir->i_op->create(dir, dentry, mode, NULL); | 64 | return dir->i_op->create(dir, dentry, mode, NULL); |
66 | } | 65 | } |
67 | #endif | 66 | #endif |
@@ -69,7 +68,6 @@ static int xattr_create(struct inode *dir, struct dentry *dentry, int mode) | |||
69 | static int xattr_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 68 | static int xattr_mkdir(struct inode *dir, struct dentry *dentry, int mode) |
70 | { | 69 | { |
71 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); | 70 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); |
72 | vfs_dq_init(dir); | ||
73 | return dir->i_op->mkdir(dir, dentry, mode); | 71 | return dir->i_op->mkdir(dir, dentry, mode); |
74 | } | 72 | } |
75 | 73 | ||
@@ -81,7 +79,6 @@ static int xattr_unlink(struct inode *dir, struct dentry *dentry) | |||
81 | { | 79 | { |
82 | int error; | 80 | int error; |
83 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); | 81 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); |
84 | vfs_dq_init(dir); | ||
85 | 82 | ||
86 | reiserfs_mutex_lock_nested_safe(&dentry->d_inode->i_mutex, | 83 | reiserfs_mutex_lock_nested_safe(&dentry->d_inode->i_mutex, |
87 | I_MUTEX_CHILD, dir->i_sb); | 84 | I_MUTEX_CHILD, dir->i_sb); |
@@ -97,7 +94,6 @@ static int xattr_rmdir(struct inode *dir, struct dentry *dentry) | |||
97 | { | 94 | { |
98 | int error; | 95 | int error; |
99 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); | 96 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); |
100 | vfs_dq_init(dir); | ||
101 | 97 | ||
102 | reiserfs_mutex_lock_nested_safe(&dentry->d_inode->i_mutex, | 98 | reiserfs_mutex_lock_nested_safe(&dentry->d_inode->i_mutex, |
103 | I_MUTEX_CHILD, dir->i_sb); | 99 | I_MUTEX_CHILD, dir->i_sb); |
diff --git a/fs/udf/file.c b/fs/udf/file.c index 2df7fcb677b3..013fa44d9a5e 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
@@ -208,7 +208,7 @@ const struct file_operations udf_file_operations = { | |||
208 | .read = do_sync_read, | 208 | .read = do_sync_read, |
209 | .aio_read = generic_file_aio_read, | 209 | .aio_read = generic_file_aio_read, |
210 | .ioctl = udf_ioctl, | 210 | .ioctl = udf_ioctl, |
211 | .open = generic_file_open, | 211 | .open = dquot_file_open, |
212 | .mmap = generic_file_mmap, | 212 | .mmap = generic_file_mmap, |
213 | .write = do_sync_write, | 213 | .write = do_sync_write, |
214 | .aio_write = udf_file_aio_write, | 214 | .aio_write = udf_file_aio_write, |
@@ -227,6 +227,9 @@ static int udf_setattr(struct dentry *dentry, struct iattr *iattr) | |||
227 | if (error) | 227 | if (error) |
228 | return error; | 228 | return error; |
229 | 229 | ||
230 | if (iattr->ia_valid & ATTR_SIZE) | ||
231 | vfs_dq_init(inode); | ||
232 | |||
230 | if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || | 233 | if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || |
231 | (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { | 234 | (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { |
232 | error = dquot_transfer(inode, iattr); | 235 | error = dquot_transfer(inode, iattr); |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 1199e8e21ee2..f19520268404 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/pagemap.h> | 36 | #include <linux/pagemap.h> |
37 | #include <linux/buffer_head.h> | 37 | #include <linux/buffer_head.h> |
38 | #include <linux/writeback.h> | 38 | #include <linux/writeback.h> |
39 | #include <linux/quotaops.h> | ||
39 | #include <linux/slab.h> | 40 | #include <linux/slab.h> |
40 | #include <linux/crc-itu-t.h> | 41 | #include <linux/crc-itu-t.h> |
41 | 42 | ||
@@ -70,6 +71,9 @@ static int udf_get_block(struct inode *, sector_t, struct buffer_head *, int); | |||
70 | 71 | ||
71 | void udf_delete_inode(struct inode *inode) | 72 | void udf_delete_inode(struct inode *inode) |
72 | { | 73 | { |
74 | if (!is_bad_inode(inode)) | ||
75 | vfs_dq_init(inode); | ||
76 | |||
73 | truncate_inode_pages(&inode->i_data, 0); | 77 | truncate_inode_pages(&inode->i_data, 0); |
74 | 78 | ||
75 | if (is_bad_inode(inode)) | 79 | if (is_bad_inode(inode)) |
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index cd2115060fdc..e360c3fc4ae4 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -563,6 +563,8 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode, | |||
563 | int err; | 563 | int err; |
564 | struct udf_inode_info *iinfo; | 564 | struct udf_inode_info *iinfo; |
565 | 565 | ||
566 | vfs_dq_init(dir); | ||
567 | |||
566 | lock_kernel(); | 568 | lock_kernel(); |
567 | inode = udf_new_inode(dir, mode, &err); | 569 | inode = udf_new_inode(dir, mode, &err); |
568 | if (!inode) { | 570 | if (!inode) { |
@@ -616,6 +618,8 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, int mode, | |||
616 | if (!old_valid_dev(rdev)) | 618 | if (!old_valid_dev(rdev)) |
617 | return -EINVAL; | 619 | return -EINVAL; |
618 | 620 | ||
621 | vfs_dq_init(dir); | ||
622 | |||
619 | lock_kernel(); | 623 | lock_kernel(); |
620 | err = -EIO; | 624 | err = -EIO; |
621 | inode = udf_new_inode(dir, mode, &err); | 625 | inode = udf_new_inode(dir, mode, &err); |
@@ -662,6 +666,8 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
662 | struct udf_inode_info *dinfo = UDF_I(dir); | 666 | struct udf_inode_info *dinfo = UDF_I(dir); |
663 | struct udf_inode_info *iinfo; | 667 | struct udf_inode_info *iinfo; |
664 | 668 | ||
669 | vfs_dq_init(dir); | ||
670 | |||
665 | lock_kernel(); | 671 | lock_kernel(); |
666 | err = -EMLINK; | 672 | err = -EMLINK; |
667 | if (dir->i_nlink >= (256 << sizeof(dir->i_nlink)) - 1) | 673 | if (dir->i_nlink >= (256 << sizeof(dir->i_nlink)) - 1) |
@@ -799,6 +805,8 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry) | |||
799 | struct fileIdentDesc *fi, cfi; | 805 | struct fileIdentDesc *fi, cfi; |
800 | struct kernel_lb_addr tloc; | 806 | struct kernel_lb_addr tloc; |
801 | 807 | ||
808 | vfs_dq_init(dir); | ||
809 | |||
802 | retval = -ENOENT; | 810 | retval = -ENOENT; |
803 | lock_kernel(); | 811 | lock_kernel(); |
804 | fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi); | 812 | fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi); |
@@ -845,6 +853,8 @@ static int udf_unlink(struct inode *dir, struct dentry *dentry) | |||
845 | struct fileIdentDesc cfi; | 853 | struct fileIdentDesc cfi; |
846 | struct kernel_lb_addr tloc; | 854 | struct kernel_lb_addr tloc; |
847 | 855 | ||
856 | vfs_dq_init(dir); | ||
857 | |||
848 | retval = -ENOENT; | 858 | retval = -ENOENT; |
849 | lock_kernel(); | 859 | lock_kernel(); |
850 | fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi); | 860 | fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi); |
@@ -899,6 +909,8 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
899 | struct buffer_head *bh; | 909 | struct buffer_head *bh; |
900 | struct udf_inode_info *iinfo; | 910 | struct udf_inode_info *iinfo; |
901 | 911 | ||
912 | vfs_dq_init(dir); | ||
913 | |||
902 | lock_kernel(); | 914 | lock_kernel(); |
903 | inode = udf_new_inode(dir, S_IFLNK, &err); | 915 | inode = udf_new_inode(dir, S_IFLNK, &err); |
904 | if (!inode) | 916 | if (!inode) |
@@ -1069,6 +1081,8 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir, | |||
1069 | int err; | 1081 | int err; |
1070 | struct buffer_head *bh; | 1082 | struct buffer_head *bh; |
1071 | 1083 | ||
1084 | vfs_dq_init(dir); | ||
1085 | |||
1072 | lock_kernel(); | 1086 | lock_kernel(); |
1073 | if (inode->i_nlink >= (256 << sizeof(inode->i_nlink)) - 1) { | 1087 | if (inode->i_nlink >= (256 << sizeof(inode->i_nlink)) - 1) { |
1074 | unlock_kernel(); | 1088 | unlock_kernel(); |
@@ -1131,6 +1145,9 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1131 | struct kernel_lb_addr tloc; | 1145 | struct kernel_lb_addr tloc; |
1132 | struct udf_inode_info *old_iinfo = UDF_I(old_inode); | 1146 | struct udf_inode_info *old_iinfo = UDF_I(old_inode); |
1133 | 1147 | ||
1148 | vfs_dq_init(old_dir); | ||
1149 | vfs_dq_init(new_dir); | ||
1150 | |||
1134 | lock_kernel(); | 1151 | lock_kernel(); |
1135 | ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi); | 1152 | ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi); |
1136 | if (ofi) { | 1153 | if (ofi) { |
diff --git a/fs/ufs/file.c b/fs/ufs/file.c index 73655c61240a..d84762f3028e 100644 --- a/fs/ufs/file.c +++ b/fs/ufs/file.c | |||
@@ -40,7 +40,7 @@ const struct file_operations ufs_file_operations = { | |||
40 | .write = do_sync_write, | 40 | .write = do_sync_write, |
41 | .aio_write = generic_file_aio_write, | 41 | .aio_write = generic_file_aio_write, |
42 | .mmap = generic_file_mmap, | 42 | .mmap = generic_file_mmap, |
43 | .open = generic_file_open, | 43 | .open = dquot_file_open, |
44 | .fsync = simple_fsync, | 44 | .fsync = simple_fsync, |
45 | .splice_read = generic_file_splice_read, | 45 | .splice_read = generic_file_splice_read, |
46 | }; | 46 | }; |
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index 7cf33379fd46..fff8edab382f 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/mm.h> | 36 | #include <linux/mm.h> |
37 | #include <linux/smp_lock.h> | 37 | #include <linux/smp_lock.h> |
38 | #include <linux/buffer_head.h> | 38 | #include <linux/buffer_head.h> |
39 | #include <linux/quotaops.h> | ||
39 | 40 | ||
40 | #include "ufs_fs.h" | 41 | #include "ufs_fs.h" |
41 | #include "ufs.h" | 42 | #include "ufs.h" |
@@ -908,6 +909,9 @@ void ufs_delete_inode (struct inode * inode) | |||
908 | { | 909 | { |
909 | loff_t old_i_size; | 910 | loff_t old_i_size; |
910 | 911 | ||
912 | if (!is_bad_inode(inode)) | ||
913 | vfs_dq_init(inode); | ||
914 | |||
911 | truncate_inode_pages(&inode->i_data, 0); | 915 | truncate_inode_pages(&inode->i_data, 0); |
912 | if (is_bad_inode(inode)) | 916 | if (is_bad_inode(inode)) |
913 | goto no_delete; | 917 | goto no_delete; |
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c index 4c26d9e8bc94..c33cb90c516d 100644 --- a/fs/ufs/namei.c +++ b/fs/ufs/namei.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/time.h> | 30 | #include <linux/time.h> |
31 | #include <linux/fs.h> | 31 | #include <linux/fs.h> |
32 | #include <linux/smp_lock.h> | 32 | #include <linux/smp_lock.h> |
33 | #include <linux/quotaops.h> | ||
33 | 34 | ||
34 | #include "ufs_fs.h" | 35 | #include "ufs_fs.h" |
35 | #include "ufs.h" | 36 | #include "ufs.h" |
@@ -84,6 +85,9 @@ static int ufs_create (struct inode * dir, struct dentry * dentry, int mode, | |||
84 | int err; | 85 | int err; |
85 | 86 | ||
86 | UFSD("BEGIN\n"); | 87 | UFSD("BEGIN\n"); |
88 | |||
89 | vfs_dq_init(dir); | ||
90 | |||
87 | inode = ufs_new_inode(dir, mode); | 91 | inode = ufs_new_inode(dir, mode); |
88 | err = PTR_ERR(inode); | 92 | err = PTR_ERR(inode); |
89 | 93 | ||
@@ -107,6 +111,9 @@ static int ufs_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t | |||
107 | 111 | ||
108 | if (!old_valid_dev(rdev)) | 112 | if (!old_valid_dev(rdev)) |
109 | return -EINVAL; | 113 | return -EINVAL; |
114 | |||
115 | vfs_dq_init(dir); | ||
116 | |||
110 | inode = ufs_new_inode(dir, mode); | 117 | inode = ufs_new_inode(dir, mode); |
111 | err = PTR_ERR(inode); | 118 | err = PTR_ERR(inode); |
112 | if (!IS_ERR(inode)) { | 119 | if (!IS_ERR(inode)) { |
@@ -131,6 +138,8 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry, | |||
131 | if (l > sb->s_blocksize) | 138 | if (l > sb->s_blocksize) |
132 | goto out_notlocked; | 139 | goto out_notlocked; |
133 | 140 | ||
141 | vfs_dq_init(dir); | ||
142 | |||
134 | lock_kernel(); | 143 | lock_kernel(); |
135 | inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO); | 144 | inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO); |
136 | err = PTR_ERR(inode); | 145 | err = PTR_ERR(inode); |
@@ -176,6 +185,8 @@ static int ufs_link (struct dentry * old_dentry, struct inode * dir, | |||
176 | return -EMLINK; | 185 | return -EMLINK; |
177 | } | 186 | } |
178 | 187 | ||
188 | vfs_dq_init(dir); | ||
189 | |||
179 | inode->i_ctime = CURRENT_TIME_SEC; | 190 | inode->i_ctime = CURRENT_TIME_SEC; |
180 | inode_inc_link_count(inode); | 191 | inode_inc_link_count(inode); |
181 | atomic_inc(&inode->i_count); | 192 | atomic_inc(&inode->i_count); |
@@ -193,6 +204,8 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, int mode) | |||
193 | if (dir->i_nlink >= UFS_LINK_MAX) | 204 | if (dir->i_nlink >= UFS_LINK_MAX) |
194 | goto out; | 205 | goto out; |
195 | 206 | ||
207 | vfs_dq_init(dir); | ||
208 | |||
196 | lock_kernel(); | 209 | lock_kernel(); |
197 | inode_inc_link_count(dir); | 210 | inode_inc_link_count(dir); |
198 | 211 | ||
@@ -237,6 +250,8 @@ static int ufs_unlink(struct inode *dir, struct dentry *dentry) | |||
237 | struct page *page; | 250 | struct page *page; |
238 | int err = -ENOENT; | 251 | int err = -ENOENT; |
239 | 252 | ||
253 | vfs_dq_init(dir); | ||
254 | |||
240 | de = ufs_find_entry(dir, &dentry->d_name, &page); | 255 | de = ufs_find_entry(dir, &dentry->d_name, &page); |
241 | if (!de) | 256 | if (!de) |
242 | goto out; | 257 | goto out; |
@@ -281,6 +296,9 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
281 | struct ufs_dir_entry *old_de; | 296 | struct ufs_dir_entry *old_de; |
282 | int err = -ENOENT; | 297 | int err = -ENOENT; |
283 | 298 | ||
299 | vfs_dq_init(old_dir); | ||
300 | vfs_dq_init(new_dir); | ||
301 | |||
284 | old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page); | 302 | old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page); |
285 | if (!old_de) | 303 | if (!old_de) |
286 | goto out; | 304 | goto out; |
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c index 87bbab685901..e5ef8a3ec230 100644 --- a/fs/ufs/truncate.c +++ b/fs/ufs/truncate.c | |||
@@ -527,6 +527,9 @@ static int ufs_setattr(struct dentry *dentry, struct iattr *attr) | |||
527 | if (ia_valid & ATTR_SIZE && | 527 | if (ia_valid & ATTR_SIZE && |
528 | attr->ia_size != i_size_read(inode)) { | 528 | attr->ia_size != i_size_read(inode)) { |
529 | loff_t old_i_size = inode->i_size; | 529 | loff_t old_i_size = inode->i_size; |
530 | |||
531 | vfs_dq_init(inode); | ||
532 | |||
530 | error = vmtruncate(inode, attr->ia_size); | 533 | error = vmtruncate(inode, attr->ia_size); |
531 | if (error) | 534 | if (error) |
532 | return error; | 535 | return error; |
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index a5ebd1abccd8..93ac788345e2 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
@@ -48,6 +48,8 @@ int dquot_release(struct dquot *dquot); | |||
48 | int dquot_commit_info(struct super_block *sb, int type); | 48 | int dquot_commit_info(struct super_block *sb, int type); |
49 | int dquot_mark_dquot_dirty(struct dquot *dquot); | 49 | int dquot_mark_dquot_dirty(struct dquot *dquot); |
50 | 50 | ||
51 | int dquot_file_open(struct inode *inode, struct file *file); | ||
52 | |||
51 | int vfs_quota_on(struct super_block *sb, int type, int format_id, | 53 | int vfs_quota_on(struct super_block *sb, int type, int format_id, |
52 | char *path, int remount); | 54 | char *path, int remount); |
53 | int vfs_quota_enable(struct inode *inode, int type, int format_id, | 55 | int vfs_quota_enable(struct inode *inode, int type, int format_id, |
@@ -342,4 +344,6 @@ static inline void dquot_release_reservation_block(struct inode *inode, | |||
342 | __dquot_free_space(inode, nr << inode->i_blkbits, 1); | 344 | __dquot_free_space(inode, nr << inode->i_blkbits, 1); |
343 | } | 345 | } |
344 | 346 | ||
347 | #define dquot_file_open generic_file_open | ||
348 | |||
345 | #endif /* _LINUX_QUOTAOPS_ */ | 349 | #endif /* _LINUX_QUOTAOPS_ */ |