aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/reiserfs/super.c57
1 files changed, 54 insertions, 3 deletions
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index f536e12c4b1d..685f1e056998 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -570,12 +570,28 @@ static void reiserfs_kill_sb(struct super_block *s)
570 kill_block_super(s); 570 kill_block_super(s);
571} 571}
572 572
573#ifdef CONFIG_QUOTA
574static int reiserfs_quota_off(struct super_block *sb, int type);
575
576static void reiserfs_quota_off_umount(struct super_block *s)
577{
578 int type;
579
580 for (type = 0; type < REISERFS_MAXQUOTAS; type++)
581 reiserfs_quota_off(s, type);
582}
583#else
584static inline void reiserfs_quota_off_umount(struct super_block *s)
585{
586}
587#endif
588
573static void reiserfs_put_super(struct super_block *s) 589static void reiserfs_put_super(struct super_block *s)
574{ 590{
575 struct reiserfs_transaction_handle th; 591 struct reiserfs_transaction_handle th;
576 th.t_trans_id = 0; 592 th.t_trans_id = 0;
577 593
578 dquot_disable(s, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); 594 reiserfs_quota_off_umount(s);
579 595
580 reiserfs_write_lock(s); 596 reiserfs_write_lock(s);
581 597
@@ -840,7 +856,7 @@ static const struct dquot_operations reiserfs_quota_operations = {
840 856
841static const struct quotactl_ops reiserfs_qctl_operations = { 857static const struct quotactl_ops reiserfs_qctl_operations = {
842 .quota_on = reiserfs_quota_on, 858 .quota_on = reiserfs_quota_on,
843 .quota_off = dquot_quota_off, 859 .quota_off = reiserfs_quota_off,
844 .quota_sync = dquot_quota_sync, 860 .quota_sync = dquot_quota_sync,
845 .get_state = dquot_get_state, 861 .get_state = dquot_get_state,
846 .set_info = dquot_set_dqinfo, 862 .set_info = dquot_set_dqinfo,
@@ -2428,12 +2444,47 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
2428 goto out; 2444 goto out;
2429 } 2445 }
2430 reiserfs_write_unlock(sb); 2446 reiserfs_write_unlock(sb);
2431 return dquot_quota_on(sb, type, format_id, path); 2447 err = dquot_quota_on(sb, type, format_id, path);
2448 if (!err) {
2449 inode_lock(inode);
2450 REISERFS_I(inode)->i_attrs |= REISERFS_IMMUTABLE_FL |
2451 REISERFS_NOATIME_FL;
2452 inode_set_flags(inode, S_IMMUTABLE | S_NOATIME,
2453 S_IMMUTABLE | S_NOATIME);
2454 inode_unlock(inode);
2455 mark_inode_dirty(inode);
2456 }
2457 return err;
2432out: 2458out:
2433 reiserfs_write_unlock(sb); 2459 reiserfs_write_unlock(sb);
2434 return err; 2460 return err;
2435} 2461}
2436 2462
2463static int reiserfs_quota_off(struct super_block *sb, int type)
2464{
2465 int err;
2466 struct inode *inode = sb_dqopt(sb)->files[type];
2467
2468 if (!inode || !igrab(inode))
2469 goto out;
2470
2471 err = dquot_quota_off(sb, type);
2472 if (err)
2473 goto out_put;
2474
2475 inode_lock(inode);
2476 REISERFS_I(inode)->i_attrs &= ~(REISERFS_IMMUTABLE_FL |
2477 REISERFS_NOATIME_FL);
2478 inode_set_flags(inode, 0, S_IMMUTABLE | S_NOATIME);
2479 inode_unlock(inode);
2480 mark_inode_dirty(inode);
2481out_put:
2482 iput(inode);
2483 return err;
2484out:
2485 return dquot_quota_off(sb, type);
2486}
2487
2437/* 2488/*
2438 * Read data from quotafile - avoid pagecache and such because we cannot afford 2489 * Read data from quotafile - avoid pagecache and such because we cannot afford
2439 * acquiring the locks... As quota files are never truncated and quota code 2490 * acquiring the locks... As quota files are never truncated and quota code