diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-07 15:57:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-07 15:57:07 -0400 |
commit | 90e0c225968f0878e090c7ff3f88323973476cee (patch) | |
tree | 30fff5a5cb18b08d40e4d496489be6ce714a6cde /fs/quota | |
parent | 938a73b959cf77aadc41bded3bf416b618aa20b3 (diff) | |
parent | 5f11e6a44059f728dddd8d0dbe5b4368ea93575b (diff) |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6:
ext3: Fix dirtying of journalled buffers in data=journal mode
ext3: default to ordered mode
quota: Use mark_inode_dirty_sync instead of mark_inode_dirty
quota: Change quota error message to print out disk and function name
MAINTAINERS: Update entries of ext2 and ext3
MAINTAINERS: Update address of Andreas Dilger
ext3: Avoid filesystem corruption after a crash under heavy delete load
ext3: remove vestiges of nobh support
ext3: Fix set but unused variables
quota: clean up quota active checks
quota: Clean up the namespace in dqblk_xfs.h
quota: check quota reservation on remove_dquot_ref
Diffstat (limited to 'fs/quota')
-rw-r--r-- | fs/quota/dquot.c | 79 | ||||
-rw-r--r-- | fs/quota/quota_tree.c | 85 | ||||
-rw-r--r-- | fs/quota/quota_tree.h | 6 | ||||
-rw-r--r-- | fs/quota/quota_v1.c | 3 | ||||
-rw-r--r-- | fs/quota/quota_v2.c | 11 |
5 files changed, 104 insertions, 80 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 437d2ca2de97..ef72b1699429 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -132,6 +132,22 @@ static __cacheline_aligned_in_smp DEFINE_SPINLOCK(dq_state_lock); | |||
132 | __cacheline_aligned_in_smp DEFINE_SPINLOCK(dq_data_lock); | 132 | __cacheline_aligned_in_smp DEFINE_SPINLOCK(dq_data_lock); |
133 | EXPORT_SYMBOL(dq_data_lock); | 133 | EXPORT_SYMBOL(dq_data_lock); |
134 | 134 | ||
135 | void __quota_error(struct super_block *sb, const char *func, | ||
136 | const char *fmt, ...) | ||
137 | { | ||
138 | va_list args; | ||
139 | |||
140 | if (printk_ratelimit()) { | ||
141 | va_start(args, fmt); | ||
142 | printk(KERN_ERR "Quota error (device %s): %s: ", | ||
143 | sb->s_id, func); | ||
144 | vprintk(fmt, args); | ||
145 | printk("\n"); | ||
146 | va_end(args); | ||
147 | } | ||
148 | } | ||
149 | EXPORT_SYMBOL(__quota_error); | ||
150 | |||
135 | #if defined(CONFIG_QUOTA_DEBUG) || defined(CONFIG_PRINT_QUOTA_WARNING) | 151 | #if defined(CONFIG_QUOTA_DEBUG) || defined(CONFIG_PRINT_QUOTA_WARNING) |
136 | static char *quotatypes[] = INITQFNAMES; | 152 | static char *quotatypes[] = INITQFNAMES; |
137 | #endif | 153 | #endif |
@@ -705,11 +721,8 @@ void dqput(struct dquot *dquot) | |||
705 | return; | 721 | return; |
706 | #ifdef CONFIG_QUOTA_DEBUG | 722 | #ifdef CONFIG_QUOTA_DEBUG |
707 | if (!atomic_read(&dquot->dq_count)) { | 723 | if (!atomic_read(&dquot->dq_count)) { |
708 | printk("VFS: dqput: trying to free free dquot\n"); | 724 | quota_error(dquot->dq_sb, "trying to free free dquot of %s %d", |
709 | printk("VFS: device %s, dquot of %s %d\n", | 725 | quotatypes[dquot->dq_type], dquot->dq_id); |
710 | dquot->dq_sb->s_id, | ||
711 | quotatypes[dquot->dq_type], | ||
712 | dquot->dq_id); | ||
713 | BUG(); | 726 | BUG(); |
714 | } | 727 | } |
715 | #endif | 728 | #endif |
@@ -732,9 +745,9 @@ we_slept: | |||
732 | /* Commit dquot before releasing */ | 745 | /* Commit dquot before releasing */ |
733 | ret = dquot->dq_sb->dq_op->write_dquot(dquot); | 746 | ret = dquot->dq_sb->dq_op->write_dquot(dquot); |
734 | if (ret < 0) { | 747 | if (ret < 0) { |
735 | printk(KERN_ERR "VFS: cannot write quota structure on " | 748 | quota_error(dquot->dq_sb, "Can't write quota structure" |
736 | "device %s (error %d). Quota may get out of " | 749 | " (error %d). Quota may get out of sync!", |
737 | "sync!\n", dquot->dq_sb->s_id, ret); | 750 | ret); |
738 | /* | 751 | /* |
739 | * We clear dirty bit anyway, so that we avoid | 752 | * We clear dirty bit anyway, so that we avoid |
740 | * infinite loop here | 753 | * infinite loop here |
@@ -914,9 +927,9 @@ static void add_dquot_ref(struct super_block *sb, int type) | |||
914 | 927 | ||
915 | #ifdef CONFIG_QUOTA_DEBUG | 928 | #ifdef CONFIG_QUOTA_DEBUG |
916 | if (reserved) { | 929 | if (reserved) { |
917 | printk(KERN_WARNING "VFS (%s): Writes happened before quota" | 930 | quota_error(sb, "Writes happened before quota was turned on " |
918 | " was turned on thus quota information is probably " | 931 | "thus quota information is probably inconsistent. " |
919 | "inconsistent. Please run quotacheck(8).\n", sb->s_id); | 932 | "Please run quotacheck(8)"); |
920 | } | 933 | } |
921 | #endif | 934 | #endif |
922 | } | 935 | } |
@@ -947,7 +960,9 @@ static int remove_inode_dquot_ref(struct inode *inode, int type, | |||
947 | if (dqput_blocks(dquot)) { | 960 | if (dqput_blocks(dquot)) { |
948 | #ifdef CONFIG_QUOTA_DEBUG | 961 | #ifdef CONFIG_QUOTA_DEBUG |
949 | if (atomic_read(&dquot->dq_count) != 1) | 962 | if (atomic_read(&dquot->dq_count) != 1) |
950 | printk(KERN_WARNING "VFS: Adding dquot with dq_count %d to dispose list.\n", atomic_read(&dquot->dq_count)); | 963 | quota_error(inode->i_sb, "Adding dquot with " |
964 | "dq_count %d to dispose list", | ||
965 | atomic_read(&dquot->dq_count)); | ||
951 | #endif | 966 | #endif |
952 | spin_lock(&dq_list_lock); | 967 | spin_lock(&dq_list_lock); |
953 | /* As dquot must have currently users it can't be on | 968 | /* As dquot must have currently users it can't be on |
@@ -986,6 +1001,7 @@ static void remove_dquot_ref(struct super_block *sb, int type, | |||
986 | struct list_head *tofree_head) | 1001 | struct list_head *tofree_head) |
987 | { | 1002 | { |
988 | struct inode *inode; | 1003 | struct inode *inode; |
1004 | int reserved = 0; | ||
989 | 1005 | ||
990 | spin_lock(&inode_lock); | 1006 | spin_lock(&inode_lock); |
991 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { | 1007 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { |
@@ -995,10 +1011,20 @@ static void remove_dquot_ref(struct super_block *sb, int type, | |||
995 | * only quota pointers and these have separate locking | 1011 | * only quota pointers and these have separate locking |
996 | * (dqptr_sem). | 1012 | * (dqptr_sem). |
997 | */ | 1013 | */ |
998 | if (!IS_NOQUOTA(inode)) | 1014 | if (!IS_NOQUOTA(inode)) { |
1015 | if (unlikely(inode_get_rsv_space(inode) > 0)) | ||
1016 | reserved = 1; | ||
999 | remove_inode_dquot_ref(inode, type, tofree_head); | 1017 | remove_inode_dquot_ref(inode, type, tofree_head); |
1018 | } | ||
1000 | } | 1019 | } |
1001 | spin_unlock(&inode_lock); | 1020 | spin_unlock(&inode_lock); |
1021 | #ifdef CONFIG_QUOTA_DEBUG | ||
1022 | if (reserved) { | ||
1023 | printk(KERN_WARNING "VFS (%s): Writes happened after quota" | ||
1024 | " was disabled thus quota information is probably " | ||
1025 | "inconsistent. Please run quotacheck(8).\n", sb->s_id); | ||
1026 | } | ||
1027 | #endif | ||
1002 | } | 1028 | } |
1003 | 1029 | ||
1004 | /* Gather all references from inodes and drop them */ | 1030 | /* Gather all references from inodes and drop them */ |
@@ -1304,6 +1330,15 @@ static int info_bdq_free(struct dquot *dquot, qsize_t space) | |||
1304 | return QUOTA_NL_NOWARN; | 1330 | return QUOTA_NL_NOWARN; |
1305 | } | 1331 | } |
1306 | 1332 | ||
1333 | static int dquot_active(const struct inode *inode) | ||
1334 | { | ||
1335 | struct super_block *sb = inode->i_sb; | ||
1336 | |||
1337 | if (IS_NOQUOTA(inode)) | ||
1338 | return 0; | ||
1339 | return sb_any_quota_loaded(sb) & ~sb_any_quota_suspended(sb); | ||
1340 | } | ||
1341 | |||
1307 | /* | 1342 | /* |
1308 | * Initialize quota pointers in inode | 1343 | * Initialize quota pointers in inode |
1309 | * | 1344 | * |
@@ -1323,7 +1358,7 @@ static void __dquot_initialize(struct inode *inode, int type) | |||
1323 | 1358 | ||
1324 | /* First test before acquiring mutex - solves deadlocks when we | 1359 | /* First test before acquiring mutex - solves deadlocks when we |
1325 | * re-enter the quota code and are already holding the mutex */ | 1360 | * re-enter the quota code and are already holding the mutex */ |
1326 | if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) | 1361 | if (!dquot_active(inode)) |
1327 | return; | 1362 | return; |
1328 | 1363 | ||
1329 | /* First get references to structures we might need. */ | 1364 | /* First get references to structures we might need. */ |
@@ -1507,7 +1542,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags) | |||
1507 | * First test before acquiring mutex - solves deadlocks when we | 1542 | * First test before acquiring mutex - solves deadlocks when we |
1508 | * re-enter the quota code and are already holding the mutex | 1543 | * re-enter the quota code and are already holding the mutex |
1509 | */ | 1544 | */ |
1510 | if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) { | 1545 | if (!dquot_active(inode)) { |
1511 | inode_incr_space(inode, number, reserve); | 1546 | inode_incr_space(inode, number, reserve); |
1512 | goto out; | 1547 | goto out; |
1513 | } | 1548 | } |
@@ -1559,7 +1594,7 @@ int dquot_alloc_inode(const struct inode *inode) | |||
1559 | 1594 | ||
1560 | /* First test before acquiring mutex - solves deadlocks when we | 1595 | /* First test before acquiring mutex - solves deadlocks when we |
1561 | * re-enter the quota code and are already holding the mutex */ | 1596 | * re-enter the quota code and are already holding the mutex */ |
1562 | if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) | 1597 | if (!dquot_active(inode)) |
1563 | return 0; | 1598 | return 0; |
1564 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) | 1599 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) |
1565 | warntype[cnt] = QUOTA_NL_NOWARN; | 1600 | warntype[cnt] = QUOTA_NL_NOWARN; |
@@ -1596,7 +1631,7 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number) | |||
1596 | { | 1631 | { |
1597 | int cnt; | 1632 | int cnt; |
1598 | 1633 | ||
1599 | if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) { | 1634 | if (!dquot_active(inode)) { |
1600 | inode_claim_rsv_space(inode, number); | 1635 | inode_claim_rsv_space(inode, number); |
1601 | return 0; | 1636 | return 0; |
1602 | } | 1637 | } |
@@ -1629,7 +1664,7 @@ void __dquot_free_space(struct inode *inode, qsize_t number, int flags) | |||
1629 | 1664 | ||
1630 | /* First test before acquiring mutex - solves deadlocks when we | 1665 | /* First test before acquiring mutex - solves deadlocks when we |
1631 | * re-enter the quota code and are already holding the mutex */ | 1666 | * re-enter the quota code and are already holding the mutex */ |
1632 | if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) { | 1667 | if (!dquot_active(inode)) { |
1633 | inode_decr_space(inode, number, reserve); | 1668 | inode_decr_space(inode, number, reserve); |
1634 | return; | 1669 | return; |
1635 | } | 1670 | } |
@@ -1667,7 +1702,7 @@ void dquot_free_inode(const struct inode *inode) | |||
1667 | 1702 | ||
1668 | /* First test before acquiring mutex - solves deadlocks when we | 1703 | /* First test before acquiring mutex - solves deadlocks when we |
1669 | * re-enter the quota code and are already holding the mutex */ | 1704 | * re-enter the quota code and are already holding the mutex */ |
1670 | if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) | 1705 | if (!dquot_active(inode)) |
1671 | return; | 1706 | return; |
1672 | 1707 | ||
1673 | down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); | 1708 | down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); |
@@ -1790,7 +1825,7 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr) | |||
1790 | struct super_block *sb = inode->i_sb; | 1825 | struct super_block *sb = inode->i_sb; |
1791 | int ret; | 1826 | int ret; |
1792 | 1827 | ||
1793 | if (!sb_any_quota_active(sb) || IS_NOQUOTA(inode)) | 1828 | if (!dquot_active(inode)) |
1794 | return 0; | 1829 | return 0; |
1795 | 1830 | ||
1796 | if (iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) | 1831 | if (iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) |
@@ -1957,7 +1992,7 @@ int dquot_disable(struct super_block *sb, int type, unsigned int flags) | |||
1957 | truncate_inode_pages(&toputinode[cnt]->i_data, | 1992 | truncate_inode_pages(&toputinode[cnt]->i_data, |
1958 | 0); | 1993 | 0); |
1959 | mutex_unlock(&toputinode[cnt]->i_mutex); | 1994 | mutex_unlock(&toputinode[cnt]->i_mutex); |
1960 | mark_inode_dirty(toputinode[cnt]); | 1995 | mark_inode_dirty_sync(toputinode[cnt]); |
1961 | } | 1996 | } |
1962 | mutex_unlock(&dqopt->dqonoff_mutex); | 1997 | mutex_unlock(&dqopt->dqonoff_mutex); |
1963 | } | 1998 | } |
@@ -2270,7 +2305,7 @@ static void do_get_dqblk(struct dquot *dquot, struct fs_disk_quota *di) | |||
2270 | memset(di, 0, sizeof(*di)); | 2305 | memset(di, 0, sizeof(*di)); |
2271 | di->d_version = FS_DQUOT_VERSION; | 2306 | di->d_version = FS_DQUOT_VERSION; |
2272 | di->d_flags = dquot->dq_type == USRQUOTA ? | 2307 | di->d_flags = dquot->dq_type == USRQUOTA ? |
2273 | XFS_USER_QUOTA : XFS_GROUP_QUOTA; | 2308 | FS_USER_QUOTA : FS_GROUP_QUOTA; |
2274 | di->d_id = dquot->dq_id; | 2309 | di->d_id = dquot->dq_id; |
2275 | 2310 | ||
2276 | spin_lock(&dq_data_lock); | 2311 | spin_lock(&dq_data_lock); |
diff --git a/fs/quota/quota_tree.c b/fs/quota/quota_tree.c index 24f03407eeb5..9e48874eabcc 100644 --- a/fs/quota/quota_tree.c +++ b/fs/quota/quota_tree.c | |||
@@ -65,8 +65,7 @@ static ssize_t write_blk(struct qtree_mem_dqinfo *info, uint blk, char *buf) | |||
65 | ret = sb->s_op->quota_write(sb, info->dqi_type, buf, | 65 | ret = sb->s_op->quota_write(sb, info->dqi_type, buf, |
66 | info->dqi_usable_bs, blk << info->dqi_blocksize_bits); | 66 | info->dqi_usable_bs, blk << info->dqi_blocksize_bits); |
67 | if (ret != info->dqi_usable_bs) { | 67 | if (ret != info->dqi_usable_bs) { |
68 | q_warn(KERN_WARNING "VFS: dquota write failed on " | 68 | quota_error(sb, "dquota write failed"); |
69 | "dev %s\n", sb->s_id); | ||
70 | if (ret >= 0) | 69 | if (ret >= 0) |
71 | ret = -EIO; | 70 | ret = -EIO; |
72 | } | 71 | } |
@@ -160,9 +159,8 @@ static int remove_free_dqentry(struct qtree_mem_dqinfo *info, char *buf, | |||
160 | dh->dqdh_next_free = dh->dqdh_prev_free = cpu_to_le32(0); | 159 | dh->dqdh_next_free = dh->dqdh_prev_free = cpu_to_le32(0); |
161 | /* No matter whether write succeeds block is out of list */ | 160 | /* No matter whether write succeeds block is out of list */ |
162 | if (write_blk(info, blk, buf) < 0) | 161 | if (write_blk(info, blk, buf) < 0) |
163 | q_warn(KERN_ERR | 162 | quota_error(info->dqi_sb, "Can't write block (%u) " |
164 | "VFS: Can't write block (%u) with free entries.\n", | 163 | "with free entries", blk); |
165 | blk); | ||
166 | return 0; | 164 | return 0; |
167 | out_buf: | 165 | out_buf: |
168 | kfree(tmpbuf); | 166 | kfree(tmpbuf); |
@@ -252,9 +250,8 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info, | |||
252 | if (le16_to_cpu(dh->dqdh_entries) + 1 >= qtree_dqstr_in_blk(info)) { | 250 | if (le16_to_cpu(dh->dqdh_entries) + 1 >= qtree_dqstr_in_blk(info)) { |
253 | *err = remove_free_dqentry(info, buf, blk); | 251 | *err = remove_free_dqentry(info, buf, blk); |
254 | if (*err < 0) { | 252 | if (*err < 0) { |
255 | q_warn(KERN_ERR "VFS: find_free_dqentry(): Can't " | 253 | quota_error(dquot->dq_sb, "Can't remove block (%u) " |
256 | "remove block (%u) from entry free list.\n", | 254 | "from entry free list", blk); |
257 | blk); | ||
258 | goto out_buf; | 255 | goto out_buf; |
259 | } | 256 | } |
260 | } | 257 | } |
@@ -268,16 +265,15 @@ static uint find_free_dqentry(struct qtree_mem_dqinfo *info, | |||
268 | } | 265 | } |
269 | #ifdef __QUOTA_QT_PARANOIA | 266 | #ifdef __QUOTA_QT_PARANOIA |
270 | if (i == qtree_dqstr_in_blk(info)) { | 267 | if (i == qtree_dqstr_in_blk(info)) { |
271 | printk(KERN_ERR "VFS: find_free_dqentry(): Data block full " | 268 | quota_error(dquot->dq_sb, "Data block full but it shouldn't"); |
272 | "but it shouldn't.\n"); | ||
273 | *err = -EIO; | 269 | *err = -EIO; |
274 | goto out_buf; | 270 | goto out_buf; |
275 | } | 271 | } |
276 | #endif | 272 | #endif |
277 | *err = write_blk(info, blk, buf); | 273 | *err = write_blk(info, blk, buf); |
278 | if (*err < 0) { | 274 | if (*err < 0) { |
279 | q_warn(KERN_ERR "VFS: find_free_dqentry(): Can't write quota " | 275 | quota_error(dquot->dq_sb, "Can't write quota data block %u", |
280 | "data block %u.\n", blk); | 276 | blk); |
281 | goto out_buf; | 277 | goto out_buf; |
282 | } | 278 | } |
283 | dquot->dq_off = (blk << info->dqi_blocksize_bits) + | 279 | dquot->dq_off = (blk << info->dqi_blocksize_bits) + |
@@ -311,8 +307,8 @@ static int do_insert_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, | |||
311 | } else { | 307 | } else { |
312 | ret = read_blk(info, *treeblk, buf); | 308 | ret = read_blk(info, *treeblk, buf); |
313 | if (ret < 0) { | 309 | if (ret < 0) { |
314 | q_warn(KERN_ERR "VFS: Can't read tree quota block " | 310 | quota_error(dquot->dq_sb, "Can't read tree quota " |
315 | "%u.\n", *treeblk); | 311 | "block %u", *treeblk); |
316 | goto out_buf; | 312 | goto out_buf; |
317 | } | 313 | } |
318 | } | 314 | } |
@@ -323,9 +319,9 @@ static int do_insert_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, | |||
323 | if (depth == info->dqi_qtree_depth - 1) { | 319 | if (depth == info->dqi_qtree_depth - 1) { |
324 | #ifdef __QUOTA_QT_PARANOIA | 320 | #ifdef __QUOTA_QT_PARANOIA |
325 | if (newblk) { | 321 | if (newblk) { |
326 | printk(KERN_ERR "VFS: Inserting already present quota " | 322 | quota_error(dquot->dq_sb, "Inserting already present " |
327 | "entry (block %u).\n", | 323 | "quota entry (block %u)", |
328 | le32_to_cpu(ref[get_index(info, | 324 | le32_to_cpu(ref[get_index(info, |
329 | dquot->dq_id, depth)])); | 325 | dquot->dq_id, depth)])); |
330 | ret = -EIO; | 326 | ret = -EIO; |
331 | goto out_buf; | 327 | goto out_buf; |
@@ -373,8 +369,8 @@ int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) | |||
373 | if (!dquot->dq_off) { | 369 | if (!dquot->dq_off) { |
374 | ret = dq_insert_tree(info, dquot); | 370 | ret = dq_insert_tree(info, dquot); |
375 | if (ret < 0) { | 371 | if (ret < 0) { |
376 | q_warn(KERN_ERR "VFS: Error %zd occurred while " | 372 | quota_error(sb, "Error %zd occurred while creating " |
377 | "creating quota.\n", ret); | 373 | "quota", ret); |
378 | kfree(ddquot); | 374 | kfree(ddquot); |
379 | return ret; | 375 | return ret; |
380 | } | 376 | } |
@@ -385,8 +381,7 @@ int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) | |||
385 | ret = sb->s_op->quota_write(sb, type, ddquot, info->dqi_entry_size, | 381 | ret = sb->s_op->quota_write(sb, type, ddquot, info->dqi_entry_size, |
386 | dquot->dq_off); | 382 | dquot->dq_off); |
387 | if (ret != info->dqi_entry_size) { | 383 | if (ret != info->dqi_entry_size) { |
388 | q_warn(KERN_WARNING "VFS: dquota write failed on dev %s\n", | 384 | quota_error(sb, "dquota write failed"); |
389 | sb->s_id); | ||
390 | if (ret >= 0) | 385 | if (ret >= 0) |
391 | ret = -ENOSPC; | 386 | ret = -ENOSPC; |
392 | } else { | 387 | } else { |
@@ -410,14 +405,15 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot, | |||
410 | if (!buf) | 405 | if (!buf) |
411 | return -ENOMEM; | 406 | return -ENOMEM; |
412 | if (dquot->dq_off >> info->dqi_blocksize_bits != blk) { | 407 | if (dquot->dq_off >> info->dqi_blocksize_bits != blk) { |
413 | q_warn(KERN_ERR "VFS: Quota structure has offset to other " | 408 | quota_error(dquot->dq_sb, "Quota structure has offset to " |
414 | "block (%u) than it should (%u).\n", blk, | 409 | "other block (%u) than it should (%u)", blk, |
415 | (uint)(dquot->dq_off >> info->dqi_blocksize_bits)); | 410 | (uint)(dquot->dq_off >> info->dqi_blocksize_bits)); |
416 | goto out_buf; | 411 | goto out_buf; |
417 | } | 412 | } |
418 | ret = read_blk(info, blk, buf); | 413 | ret = read_blk(info, blk, buf); |
419 | if (ret < 0) { | 414 | if (ret < 0) { |
420 | q_warn(KERN_ERR "VFS: Can't read quota data block %u\n", blk); | 415 | quota_error(dquot->dq_sb, "Can't read quota data block %u", |
416 | blk); | ||
421 | goto out_buf; | 417 | goto out_buf; |
422 | } | 418 | } |
423 | dh = (struct qt_disk_dqdbheader *)buf; | 419 | dh = (struct qt_disk_dqdbheader *)buf; |
@@ -427,8 +423,8 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot, | |||
427 | if (ret >= 0) | 423 | if (ret >= 0) |
428 | ret = put_free_dqblk(info, buf, blk); | 424 | ret = put_free_dqblk(info, buf, blk); |
429 | if (ret < 0) { | 425 | if (ret < 0) { |
430 | q_warn(KERN_ERR "VFS: Can't move quota data block (%u) " | 426 | quota_error(dquot->dq_sb, "Can't move quota data block " |
431 | "to free list.\n", blk); | 427 | "(%u) to free list", blk); |
432 | goto out_buf; | 428 | goto out_buf; |
433 | } | 429 | } |
434 | } else { | 430 | } else { |
@@ -440,15 +436,15 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot, | |||
440 | /* Insert will write block itself */ | 436 | /* Insert will write block itself */ |
441 | ret = insert_free_dqentry(info, buf, blk); | 437 | ret = insert_free_dqentry(info, buf, blk); |
442 | if (ret < 0) { | 438 | if (ret < 0) { |
443 | q_warn(KERN_ERR "VFS: Can't insert quota data " | 439 | quota_error(dquot->dq_sb, "Can't insert quota " |
444 | "block (%u) to free entry list.\n", blk); | 440 | "data block (%u) to free entry list", blk); |
445 | goto out_buf; | 441 | goto out_buf; |
446 | } | 442 | } |
447 | } else { | 443 | } else { |
448 | ret = write_blk(info, blk, buf); | 444 | ret = write_blk(info, blk, buf); |
449 | if (ret < 0) { | 445 | if (ret < 0) { |
450 | q_warn(KERN_ERR "VFS: Can't write quota data " | 446 | quota_error(dquot->dq_sb, "Can't write quota " |
451 | "block %u\n", blk); | 447 | "data block %u", blk); |
452 | goto out_buf; | 448 | goto out_buf; |
453 | } | 449 | } |
454 | } | 450 | } |
@@ -472,7 +468,8 @@ static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, | |||
472 | return -ENOMEM; | 468 | return -ENOMEM; |
473 | ret = read_blk(info, *blk, buf); | 469 | ret = read_blk(info, *blk, buf); |
474 | if (ret < 0) { | 470 | if (ret < 0) { |
475 | q_warn(KERN_ERR "VFS: Can't read quota data block %u\n", *blk); | 471 | quota_error(dquot->dq_sb, "Can't read quota data " |
472 | "block %u", blk); | ||
476 | goto out_buf; | 473 | goto out_buf; |
477 | } | 474 | } |
478 | newblk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]); | 475 | newblk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]); |
@@ -496,8 +493,8 @@ static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, | |||
496 | } else { | 493 | } else { |
497 | ret = write_blk(info, *blk, buf); | 494 | ret = write_blk(info, *blk, buf); |
498 | if (ret < 0) | 495 | if (ret < 0) |
499 | q_warn(KERN_ERR "VFS: Can't write quota tree " | 496 | quota_error(dquot->dq_sb, "Can't write quota " |
500 | "block %u.\n", *blk); | 497 | "tree block %u", blk); |
501 | } | 498 | } |
502 | } | 499 | } |
503 | out_buf: | 500 | out_buf: |
@@ -529,7 +526,8 @@ static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info, | |||
529 | return -ENOMEM; | 526 | return -ENOMEM; |
530 | ret = read_blk(info, blk, buf); | 527 | ret = read_blk(info, blk, buf); |
531 | if (ret < 0) { | 528 | if (ret < 0) { |
532 | q_warn(KERN_ERR "VFS: Can't read quota tree block %u.\n", blk); | 529 | quota_error(dquot->dq_sb, "Can't read quota tree " |
530 | "block %u", blk); | ||
533 | goto out_buf; | 531 | goto out_buf; |
534 | } | 532 | } |
535 | ddquot = buf + sizeof(struct qt_disk_dqdbheader); | 533 | ddquot = buf + sizeof(struct qt_disk_dqdbheader); |
@@ -539,8 +537,8 @@ static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info, | |||
539 | ddquot += info->dqi_entry_size; | 537 | ddquot += info->dqi_entry_size; |
540 | } | 538 | } |
541 | if (i == qtree_dqstr_in_blk(info)) { | 539 | if (i == qtree_dqstr_in_blk(info)) { |
542 | q_warn(KERN_ERR "VFS: Quota for id %u referenced " | 540 | quota_error(dquot->dq_sb, "Quota for id %u referenced " |
543 | "but not present.\n", dquot->dq_id); | 541 | "but not present", dquot->dq_id); |
544 | ret = -EIO; | 542 | ret = -EIO; |
545 | goto out_buf; | 543 | goto out_buf; |
546 | } else { | 544 | } else { |
@@ -564,7 +562,8 @@ static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info, | |||
564 | return -ENOMEM; | 562 | return -ENOMEM; |
565 | ret = read_blk(info, blk, buf); | 563 | ret = read_blk(info, blk, buf); |
566 | if (ret < 0) { | 564 | if (ret < 0) { |
567 | q_warn(KERN_ERR "VFS: Can't read quota tree block %u.\n", blk); | 565 | quota_error(dquot->dq_sb, "Can't read quota tree block %u", |
566 | blk); | ||
568 | goto out_buf; | 567 | goto out_buf; |
569 | } | 568 | } |
570 | ret = 0; | 569 | ret = 0; |
@@ -598,7 +597,7 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) | |||
598 | #ifdef __QUOTA_QT_PARANOIA | 597 | #ifdef __QUOTA_QT_PARANOIA |
599 | /* Invalidated quota? */ | 598 | /* Invalidated quota? */ |
600 | if (!sb_dqopt(dquot->dq_sb)->files[type]) { | 599 | if (!sb_dqopt(dquot->dq_sb)->files[type]) { |
601 | printk(KERN_ERR "VFS: Quota invalidated while reading!\n"); | 600 | quota_error(sb, "Quota invalidated while reading!"); |
602 | return -EIO; | 601 | return -EIO; |
603 | } | 602 | } |
604 | #endif | 603 | #endif |
@@ -607,8 +606,8 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) | |||
607 | offset = find_dqentry(info, dquot); | 606 | offset = find_dqentry(info, dquot); |
608 | if (offset <= 0) { /* Entry not present? */ | 607 | if (offset <= 0) { /* Entry not present? */ |
609 | if (offset < 0) | 608 | if (offset < 0) |
610 | q_warn(KERN_ERR "VFS: Can't read quota " | 609 | quota_error(sb, "Can't read quota structure " |
611 | "structure for id %u.\n", dquot->dq_id); | 610 | "for id %u", dquot->dq_id); |
612 | dquot->dq_off = 0; | 611 | dquot->dq_off = 0; |
613 | set_bit(DQ_FAKE_B, &dquot->dq_flags); | 612 | set_bit(DQ_FAKE_B, &dquot->dq_flags); |
614 | memset(&dquot->dq_dqb, 0, sizeof(struct mem_dqblk)); | 613 | memset(&dquot->dq_dqb, 0, sizeof(struct mem_dqblk)); |
@@ -625,8 +624,8 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) | |||
625 | if (ret != info->dqi_entry_size) { | 624 | if (ret != info->dqi_entry_size) { |
626 | if (ret >= 0) | 625 | if (ret >= 0) |
627 | ret = -EIO; | 626 | ret = -EIO; |
628 | q_warn(KERN_ERR "VFS: Error while reading quota " | 627 | quota_error(sb, "Error while reading quota structure for id %u", |
629 | "structure for id %u.\n", dquot->dq_id); | 628 | dquot->dq_id); |
630 | set_bit(DQ_FAKE_B, &dquot->dq_flags); | 629 | set_bit(DQ_FAKE_B, &dquot->dq_flags); |
631 | memset(&dquot->dq_dqb, 0, sizeof(struct mem_dqblk)); | 630 | memset(&dquot->dq_dqb, 0, sizeof(struct mem_dqblk)); |
632 | kfree(ddquot); | 631 | kfree(ddquot); |
diff --git a/fs/quota/quota_tree.h b/fs/quota/quota_tree.h index ccc3e71fb1d8..a1ab8db81a51 100644 --- a/fs/quota/quota_tree.h +++ b/fs/quota/quota_tree.h | |||
@@ -22,10 +22,4 @@ struct qt_disk_dqdbheader { | |||
22 | 22 | ||
23 | #define QT_TREEOFF 1 /* Offset of tree in file in blocks */ | 23 | #define QT_TREEOFF 1 /* Offset of tree in file in blocks */ |
24 | 24 | ||
25 | #define q_warn(fmt, args...) \ | ||
26 | do { \ | ||
27 | if (printk_ratelimit()) \ | ||
28 | printk(fmt, ## args); \ | ||
29 | } while(0) | ||
30 | |||
31 | #endif /* _LINUX_QUOTAIO_TREE_H */ | 25 | #endif /* _LINUX_QUOTAIO_TREE_H */ |
diff --git a/fs/quota/quota_v1.c b/fs/quota/quota_v1.c index 4af344c5852a..34b37a67bb16 100644 --- a/fs/quota/quota_v1.c +++ b/fs/quota/quota_v1.c | |||
@@ -95,8 +95,7 @@ static int v1_commit_dqblk(struct dquot *dquot) | |||
95 | (char *)&dqblk, sizeof(struct v1_disk_dqblk), | 95 | (char *)&dqblk, sizeof(struct v1_disk_dqblk), |
96 | v1_dqoff(dquot->dq_id)); | 96 | v1_dqoff(dquot->dq_id)); |
97 | if (ret != sizeof(struct v1_disk_dqblk)) { | 97 | if (ret != sizeof(struct v1_disk_dqblk)) { |
98 | printk(KERN_WARNING "VFS: dquota write failed on dev %s\n", | 98 | quota_error(dquot->dq_sb, "dquota write failed"); |
99 | dquot->dq_sb->s_id); | ||
100 | if (ret >= 0) | 99 | if (ret >= 0) |
101 | ret = -EIO; | 100 | ret = -EIO; |
102 | goto out; | 101 | goto out; |
diff --git a/fs/quota/quota_v2.c b/fs/quota/quota_v2.c index 135206af1458..65444d29406b 100644 --- a/fs/quota/quota_v2.c +++ b/fs/quota/quota_v2.c | |||
@@ -63,9 +63,8 @@ static int v2_read_header(struct super_block *sb, int type, | |||
63 | size = sb->s_op->quota_read(sb, type, (char *)dqhead, | 63 | size = sb->s_op->quota_read(sb, type, (char *)dqhead, |
64 | sizeof(struct v2_disk_dqheader), 0); | 64 | sizeof(struct v2_disk_dqheader), 0); |
65 | if (size != sizeof(struct v2_disk_dqheader)) { | 65 | if (size != sizeof(struct v2_disk_dqheader)) { |
66 | q_warn(KERN_WARNING "quota_v2: Failed header read:" | 66 | quota_error(sb, "Failed header read: expected=%zd got=%zd", |
67 | " expected=%zd got=%zd\n", | 67 | sizeof(struct v2_disk_dqheader), size); |
68 | sizeof(struct v2_disk_dqheader), size); | ||
69 | return 0; | 68 | return 0; |
70 | } | 69 | } |
71 | return 1; | 70 | return 1; |
@@ -106,8 +105,7 @@ static int v2_read_file_info(struct super_block *sb, int type) | |||
106 | size = sb->s_op->quota_read(sb, type, (char *)&dinfo, | 105 | size = sb->s_op->quota_read(sb, type, (char *)&dinfo, |
107 | sizeof(struct v2_disk_dqinfo), V2_DQINFOOFF); | 106 | sizeof(struct v2_disk_dqinfo), V2_DQINFOOFF); |
108 | if (size != sizeof(struct v2_disk_dqinfo)) { | 107 | if (size != sizeof(struct v2_disk_dqinfo)) { |
109 | q_warn(KERN_WARNING "quota_v2: Can't read info structure on device %s.\n", | 108 | quota_error(sb, "Can't read info structure"); |
110 | sb->s_id); | ||
111 | return -1; | 109 | return -1; |
112 | } | 110 | } |
113 | info->dqi_priv = kmalloc(sizeof(struct qtree_mem_dqinfo), GFP_NOFS); | 111 | info->dqi_priv = kmalloc(sizeof(struct qtree_mem_dqinfo), GFP_NOFS); |
@@ -167,8 +165,7 @@ static int v2_write_file_info(struct super_block *sb, int type) | |||
167 | size = sb->s_op->quota_write(sb, type, (char *)&dinfo, | 165 | size = sb->s_op->quota_write(sb, type, (char *)&dinfo, |
168 | sizeof(struct v2_disk_dqinfo), V2_DQINFOOFF); | 166 | sizeof(struct v2_disk_dqinfo), V2_DQINFOOFF); |
169 | if (size != sizeof(struct v2_disk_dqinfo)) { | 167 | if (size != sizeof(struct v2_disk_dqinfo)) { |
170 | q_warn(KERN_WARNING "Can't write info structure on device %s.\n", | 168 | quota_error(sb, "Can't write info structure"); |
171 | sb->s_id); | ||
172 | return -1; | 169 | return -1; |
173 | } | 170 | } |
174 | return 0; | 171 | return 0; |