diff options
Diffstat (limited to 'fs/quota/dquot.c')
-rw-r--r-- | fs/quota/dquot.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index a2a622e079f0..d3c032f5fa0a 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -76,7 +76,7 @@ | |||
76 | #include <linux/buffer_head.h> | 76 | #include <linux/buffer_head.h> |
77 | #include <linux/capability.h> | 77 | #include <linux/capability.h> |
78 | #include <linux/quotaops.h> | 78 | #include <linux/quotaops.h> |
79 | #include <linux/writeback.h> /* for inode_lock, oddly enough.. */ | 79 | #include "../internal.h" /* ugh */ |
80 | 80 | ||
81 | #include <asm/uaccess.h> | 81 | #include <asm/uaccess.h> |
82 | 82 | ||
@@ -442,7 +442,7 @@ EXPORT_SYMBOL(dquot_acquire); | |||
442 | */ | 442 | */ |
443 | int dquot_commit(struct dquot *dquot) | 443 | int dquot_commit(struct dquot *dquot) |
444 | { | 444 | { |
445 | int ret = 0, ret2 = 0; | 445 | int ret = 0; |
446 | struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); | 446 | struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); |
447 | 447 | ||
448 | mutex_lock(&dqopt->dqio_mutex); | 448 | mutex_lock(&dqopt->dqio_mutex); |
@@ -454,15 +454,10 @@ int dquot_commit(struct dquot *dquot) | |||
454 | spin_unlock(&dq_list_lock); | 454 | spin_unlock(&dq_list_lock); |
455 | /* Inactive dquot can be only if there was error during read/init | 455 | /* Inactive dquot can be only if there was error during read/init |
456 | * => we have better not writing it */ | 456 | * => we have better not writing it */ |
457 | if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) { | 457 | if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) |
458 | ret = dqopt->ops[dquot->dq_type]->commit_dqblk(dquot); | 458 | ret = dqopt->ops[dquot->dq_type]->commit_dqblk(dquot); |
459 | if (info_dirty(&dqopt->info[dquot->dq_type])) { | 459 | else |
460 | ret2 = dqopt->ops[dquot->dq_type]->write_file_info( | 460 | ret = -EIO; |
461 | dquot->dq_sb, dquot->dq_type); | ||
462 | } | ||
463 | if (ret >= 0) | ||
464 | ret = ret2; | ||
465 | } | ||
466 | out_sem: | 461 | out_sem: |
467 | mutex_unlock(&dqopt->dqio_mutex); | 462 | mutex_unlock(&dqopt->dqio_mutex); |
468 | return ret; | 463 | return ret; |
@@ -900,33 +895,38 @@ static void add_dquot_ref(struct super_block *sb, int type) | |||
900 | int reserved = 0; | 895 | int reserved = 0; |
901 | #endif | 896 | #endif |
902 | 897 | ||
903 | spin_lock(&inode_lock); | 898 | spin_lock(&inode_sb_list_lock); |
904 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { | 899 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { |
905 | if (inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) | 900 | spin_lock(&inode->i_lock); |
901 | if ((inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) || | ||
902 | !atomic_read(&inode->i_writecount) || | ||
903 | !dqinit_needed(inode, type)) { | ||
904 | spin_unlock(&inode->i_lock); | ||
906 | continue; | 905 | continue; |
906 | } | ||
907 | #ifdef CONFIG_QUOTA_DEBUG | 907 | #ifdef CONFIG_QUOTA_DEBUG |
908 | if (unlikely(inode_get_rsv_space(inode) > 0)) | 908 | if (unlikely(inode_get_rsv_space(inode) > 0)) |
909 | reserved = 1; | 909 | reserved = 1; |
910 | #endif | 910 | #endif |
911 | if (!atomic_read(&inode->i_writecount)) | ||
912 | continue; | ||
913 | if (!dqinit_needed(inode, type)) | ||
914 | continue; | ||
915 | |||
916 | __iget(inode); | 911 | __iget(inode); |
917 | spin_unlock(&inode_lock); | 912 | spin_unlock(&inode->i_lock); |
913 | spin_unlock(&inode_sb_list_lock); | ||
918 | 914 | ||
919 | iput(old_inode); | 915 | iput(old_inode); |
920 | __dquot_initialize(inode, type); | 916 | __dquot_initialize(inode, type); |
921 | /* We hold a reference to 'inode' so it couldn't have been | 917 | |
922 | * removed from s_inodes list while we dropped the inode_lock. | 918 | /* |
923 | * We cannot iput the inode now as we can be holding the last | 919 | * We hold a reference to 'inode' so it couldn't have been |
924 | * reference and we cannot iput it under inode_lock. So we | 920 | * removed from s_inodes list while we dropped the |
925 | * keep the reference and iput it later. */ | 921 | * inode_sb_list_lock We cannot iput the inode now as we can be |
922 | * holding the last reference and we cannot iput it under | ||
923 | * inode_sb_list_lock. So we keep the reference and iput it | ||
924 | * later. | ||
925 | */ | ||
926 | old_inode = inode; | 926 | old_inode = inode; |
927 | spin_lock(&inode_lock); | 927 | spin_lock(&inode_sb_list_lock); |
928 | } | 928 | } |
929 | spin_unlock(&inode_lock); | 929 | spin_unlock(&inode_sb_list_lock); |
930 | iput(old_inode); | 930 | iput(old_inode); |
931 | 931 | ||
932 | #ifdef CONFIG_QUOTA_DEBUG | 932 | #ifdef CONFIG_QUOTA_DEBUG |
@@ -951,7 +951,7 @@ static inline int dqput_blocks(struct dquot *dquot) | |||
951 | 951 | ||
952 | /* | 952 | /* |
953 | * Remove references to dquots from inode and add dquot to list for freeing | 953 | * Remove references to dquots from inode and add dquot to list for freeing |
954 | * if we have the last referece to dquot | 954 | * if we have the last reference to dquot |
955 | * We can't race with anybody because we hold dqptr_sem for writing... | 955 | * We can't race with anybody because we hold dqptr_sem for writing... |
956 | */ | 956 | */ |
957 | static int remove_inode_dquot_ref(struct inode *inode, int type, | 957 | static int remove_inode_dquot_ref(struct inode *inode, int type, |
@@ -1007,7 +1007,7 @@ static void remove_dquot_ref(struct super_block *sb, int type, | |||
1007 | struct inode *inode; | 1007 | struct inode *inode; |
1008 | int reserved = 0; | 1008 | int reserved = 0; |
1009 | 1009 | ||
1010 | spin_lock(&inode_lock); | 1010 | spin_lock(&inode_sb_list_lock); |
1011 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { | 1011 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { |
1012 | /* | 1012 | /* |
1013 | * We have to scan also I_NEW inodes because they can already | 1013 | * We have to scan also I_NEW inodes because they can already |
@@ -1021,7 +1021,7 @@ static void remove_dquot_ref(struct super_block *sb, int type, | |||
1021 | remove_inode_dquot_ref(inode, type, tofree_head); | 1021 | remove_inode_dquot_ref(inode, type, tofree_head); |
1022 | } | 1022 | } |
1023 | } | 1023 | } |
1024 | spin_unlock(&inode_lock); | 1024 | spin_unlock(&inode_sb_list_lock); |
1025 | #ifdef CONFIG_QUOTA_DEBUG | 1025 | #ifdef CONFIG_QUOTA_DEBUG |
1026 | if (reserved) { | 1026 | if (reserved) { |
1027 | printk(KERN_WARNING "VFS (%s): Writes happened after quota" | 1027 | printk(KERN_WARNING "VFS (%s): Writes happened after quota" |