aboutsummaryrefslogtreecommitdiffstats
path: root/fs/quota
diff options
context:
space:
mode:
Diffstat (limited to 'fs/quota')
-rw-r--r--fs/quota/dquot.c52
1 files changed, 25 insertions, 27 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 78ce4c48ad77..cd83c5b871ba 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -1358,7 +1358,7 @@ EXPORT_SYMBOL(dquot_initialize);
1358/* 1358/*
1359 * Release all quotas referenced by inode 1359 * Release all quotas referenced by inode
1360 */ 1360 */
1361int dquot_drop(struct inode *inode) 1361static void __dquot_drop(struct inode *inode)
1362{ 1362{
1363 int cnt; 1363 int cnt;
1364 struct dquot *put[MAXQUOTAS]; 1364 struct dquot *put[MAXQUOTAS];
@@ -1370,32 +1370,31 @@ int dquot_drop(struct inode *inode)
1370 } 1370 }
1371 up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); 1371 up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
1372 dqput_all(put); 1372 dqput_all(put);
1373 return 0;
1374} 1373}
1375EXPORT_SYMBOL(dquot_drop);
1376 1374
1377/* Wrapper to remove references to quota structures from inode */ 1375void dquot_drop(struct inode *inode)
1378void vfs_dq_drop(struct inode *inode) 1376{
1379{ 1377 int cnt;
1380 /* Here we can get arbitrary inode from clear_inode() so we have 1378
1381 * to be careful. OTOH we don't need locking as quota operations 1379 if (IS_NOQUOTA(inode))
1382 * are allowed to change only at mount time */ 1380 return;
1383 if (!IS_NOQUOTA(inode) && inode->i_sb && inode->i_sb->dq_op 1381
1384 && inode->i_sb->dq_op->drop) { 1382 /*
1385 int cnt; 1383 * Test before calling to rule out calls from proc and such
1386 /* Test before calling to rule out calls from proc and such 1384 * where we are not allowed to block. Note that this is
1387 * where we are not allowed to block. Note that this is 1385 * actually reliable test even without the lock - the caller
1388 * actually reliable test even without the lock - the caller 1386 * must assure that nobody can come after the DQUOT_DROP and
1389 * must assure that nobody can come after the DQUOT_DROP and 1387 * add quota pointers back anyway.
1390 * add quota pointers back anyway */ 1388 */
1391 for (cnt = 0; cnt < MAXQUOTAS; cnt++) 1389 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
1392 if (inode->i_dquot[cnt]) 1390 if (inode->i_dquot[cnt])
1393 break; 1391 break;
1394 if (cnt < MAXQUOTAS) 1392 }
1395 inode->i_sb->dq_op->drop(inode); 1393
1396 } 1394 if (cnt < MAXQUOTAS)
1397} 1395 __dquot_drop(inode);
1398EXPORT_SYMBOL(vfs_dq_drop); 1396}
1397EXPORT_SYMBOL(dquot_drop);
1399 1398
1400/* 1399/*
1401 * inode_reserved_space is managed internally by quota, and protected by 1400 * inode_reserved_space is managed internally by quota, and protected by
@@ -1812,7 +1811,6 @@ EXPORT_SYMBOL(dquot_commit_info);
1812 */ 1811 */
1813const struct dquot_operations dquot_operations = { 1812const struct dquot_operations dquot_operations = {
1814 .initialize = dquot_initialize, 1813 .initialize = dquot_initialize,
1815 .drop = dquot_drop,
1816 .write_dquot = dquot_commit, 1814 .write_dquot = dquot_commit,
1817 .acquire_dquot = dquot_acquire, 1815 .acquire_dquot = dquot_acquire,
1818 .release_dquot = dquot_release, 1816 .release_dquot = dquot_release,
@@ -2029,7 +2027,7 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
2029 * When S_NOQUOTA is set, remove dquot references as no more 2027 * When S_NOQUOTA is set, remove dquot references as no more
2030 * references can be added 2028 * references can be added
2031 */ 2029 */
2032 sb->dq_op->drop(inode); 2030 __dquot_drop(inode);
2033 } 2031 }
2034 2032
2035 error = -EIO; 2033 error = -EIO;