aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@tglx.tec.linutronix.de>2005-06-26 17:20:36 -0400
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-06-26 17:20:36 -0400
commit7ca6448dbfb398bba36eda3c01bc14b86c3675be (patch)
tree82d934ebf07f22a2c64c3b6d82ec24082878b43a /fs/reiserfs
parentf1f67a9874f1a4bba1adff6d694aa52e5f52ff1a (diff)
parent7d681b23d6cc14a8c026ea6756242cb522cbbcae (diff)
Merge with rsync://fileserver/linux
Update to Linus latest
Diffstat (limited to 'fs/reiserfs')
-rw-r--r--fs/reiserfs/file.c4
-rw-r--r--fs/reiserfs/inode.c28
-rw-r--r--fs/reiserfs/journal.c2
-rw-r--r--fs/reiserfs/namei.c25
-rw-r--r--fs/reiserfs/stree.c2
-rw-r--r--fs/reiserfs/super.c102
-rw-r--r--fs/reiserfs/xattr_acl.c26
7 files changed, 116 insertions, 73 deletions
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index 2230afff1870..12e91209544e 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -201,7 +201,7 @@ static int reiserfs_allocate_blocks_for_region(
201 /* If we came here, it means we absolutely need to open a transaction, 201 /* If we came here, it means we absolutely need to open a transaction,
202 since we need to allocate some blocks */ 202 since we need to allocate some blocks */
203 reiserfs_write_lock(inode->i_sb); // Journaling stuff and we need that. 203 reiserfs_write_lock(inode->i_sb); // Journaling stuff and we need that.
204 res = journal_begin(th, inode->i_sb, JOURNAL_PER_BALANCE_CNT * 3 + 1 + 2 * REISERFS_QUOTA_TRANS_BLOCKS); // Wish I know if this number enough 204 res = journal_begin(th, inode->i_sb, JOURNAL_PER_BALANCE_CNT * 3 + 1 + 2 * REISERFS_QUOTA_TRANS_BLOCKS(inode->i_sb)); // Wish I know if this number enough
205 if (res) 205 if (res)
206 goto error_exit; 206 goto error_exit;
207 reiserfs_update_inode_transaction(inode) ; 207 reiserfs_update_inode_transaction(inode) ;
@@ -576,7 +576,7 @@ error_exit:
576 int err; 576 int err;
577 // update any changes we made to blk count 577 // update any changes we made to blk count
578 reiserfs_update_sd(th, inode); 578 reiserfs_update_sd(th, inode);
579 err = journal_end(th, inode->i_sb, JOURNAL_PER_BALANCE_CNT * 3 + 1 + 2 * REISERFS_QUOTA_TRANS_BLOCKS); 579 err = journal_end(th, inode->i_sb, JOURNAL_PER_BALANCE_CNT * 3 + 1 + 2 * REISERFS_QUOTA_TRANS_BLOCKS(inode->i_sb));
580 if (err) 580 if (err)
581 res = err; 581 res = err;
582 } 582 }
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 2711dff1b7b4..289d864fe731 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -28,7 +28,7 @@ static int reiserfs_prepare_write(struct file *f, struct page *page,
28void reiserfs_delete_inode (struct inode * inode) 28void reiserfs_delete_inode (struct inode * inode)
29{ 29{
30 /* We need blocks for transaction + (user+group) quota update (possibly delete) */ 30 /* We need blocks for transaction + (user+group) quota update (possibly delete) */
31 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 * REISERFS_QUOTA_INIT_BLOCKS; 31 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb);
32 struct reiserfs_transaction_handle th ; 32 struct reiserfs_transaction_handle th ;
33 33
34 reiserfs_write_lock(inode->i_sb); 34 reiserfs_write_lock(inode->i_sb);
@@ -254,6 +254,7 @@ static int _get_block_create_0 (struct inode * inode, long block,
254 char * p = NULL; 254 char * p = NULL;
255 int chars; 255 int chars;
256 int ret ; 256 int ret ;
257 int result ;
257 int done = 0 ; 258 int done = 0 ;
258 unsigned long offset ; 259 unsigned long offset ;
259 260
@@ -262,10 +263,13 @@ static int _get_block_create_0 (struct inode * inode, long block,
262 (loff_t)block * inode->i_sb->s_blocksize + 1, TYPE_ANY, 3); 263 (loff_t)block * inode->i_sb->s_blocksize + 1, TYPE_ANY, 3);
263 264
264research: 265research:
265 if (search_for_position_by_key (inode->i_sb, &key, &path) != POSITION_FOUND) { 266 result = search_for_position_by_key (inode->i_sb, &key, &path) ;
267 if (result != POSITION_FOUND) {
266 pathrelse (&path); 268 pathrelse (&path);
267 if (p) 269 if (p)
268 kunmap(bh_result->b_page) ; 270 kunmap(bh_result->b_page) ;
271 if (result == IO_ERROR)
272 return -EIO;
269 // We do not return -ENOENT if there is a hole but page is uptodate, because it means 273 // We do not return -ENOENT if there is a hole but page is uptodate, because it means
270 // That there is some MMAPED data associated with it that is yet to be written to disk. 274 // That there is some MMAPED data associated with it that is yet to be written to disk.
271 if ((args & GET_BLOCK_NO_HOLE) && !PageUptodate(bh_result->b_page) ) { 275 if ((args & GET_BLOCK_NO_HOLE) && !PageUptodate(bh_result->b_page) ) {
@@ -382,8 +386,9 @@ research:
382 386
383 // update key to look for the next piece 387 // update key to look for the next piece
384 set_cpu_key_k_offset (&key, cpu_key_k_offset (&key) + chars); 388 set_cpu_key_k_offset (&key, cpu_key_k_offset (&key) + chars);
385 if (search_for_position_by_key (inode->i_sb, &key, &path) != POSITION_FOUND) 389 result = search_for_position_by_key (inode->i_sb, &key, &path);
386 // we read something from tail, even if now we got IO_ERROR 390 if (result != POSITION_FOUND)
391 // i/o error most likely
387 break; 392 break;
388 bh = get_last_bh (&path); 393 bh = get_last_bh (&path);
389 ih = get_ih (&path); 394 ih = get_ih (&path);
@@ -394,6 +399,10 @@ research:
394 399
395finished: 400finished:
396 pathrelse (&path); 401 pathrelse (&path);
402
403 if (result == IO_ERROR)
404 return -EIO;
405
397 /* this buffer has valid data, but isn't valid for io. mapping it to 406 /* this buffer has valid data, but isn't valid for io. mapping it to
398 * block #0 tells the rest of reiserfs it just has a tail in it 407 * block #0 tells the rest of reiserfs it just has a tail in it
399 */ 408 */
@@ -591,7 +600,7 @@ int reiserfs_get_block (struct inode * inode, sector_t block,
591 XXX in practically impossible worst case direct2indirect() 600 XXX in practically impossible worst case direct2indirect()
592 can incur (much) more than 3 balancings. 601 can incur (much) more than 3 balancings.
593 quota update for user, group */ 602 quota update for user, group */
594 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 1 + 2 * REISERFS_QUOTA_TRANS_BLOCKS; 603 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 1 + 2 * REISERFS_QUOTA_TRANS_BLOCKS(inode->i_sb);
595 int version; 604 int version;
596 int dangle = 1; 605 int dangle = 1;
597 loff_t new_offset = (((loff_t)block) << inode->i_sb->s_blocksize_bits) + 1 ; 606 loff_t new_offset = (((loff_t)block) << inode->i_sb->s_blocksize_bits) + 1 ;
@@ -2796,12 +2805,15 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) {
2796 2805
2797 if (!error) { 2806 if (!error) {
2798 struct reiserfs_transaction_handle th; 2807 struct reiserfs_transaction_handle th;
2808 int jbegin_count = 2*(REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb)+REISERFS_QUOTA_DEL_BLOCKS(inode->i_sb))+2;
2799 2809
2800 /* (user+group)*(old+new) structure - we count quota info and , inode write (sb, inode) */ 2810 /* (user+group)*(old+new) structure - we count quota info and , inode write (sb, inode) */
2801 journal_begin(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2); 2811 error = journal_begin(&th, inode->i_sb, jbegin_count);
2812 if (error)
2813 goto out;
2802 error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0; 2814 error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0;
2803 if (error) { 2815 if (error) {
2804 journal_end(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2); 2816 journal_end(&th, inode->i_sb, jbegin_count);
2805 goto out; 2817 goto out;
2806 } 2818 }
2807 /* Update corresponding info in inode so that everything is in 2819 /* Update corresponding info in inode so that everything is in
@@ -2811,7 +2823,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) {
2811 if (attr->ia_valid & ATTR_GID) 2823 if (attr->ia_valid & ATTR_GID)
2812 inode->i_gid = attr->ia_gid; 2824 inode->i_gid = attr->ia_gid;
2813 mark_inode_dirty(inode); 2825 mark_inode_dirty(inode);
2814 journal_end(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2); 2826 error = journal_end(&th, inode->i_sb, jbegin_count);
2815 } 2827 }
2816 } 2828 }
2817 if (!error) 2829 if (!error)
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 3072cfdee959..7b87707acc36 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -2631,6 +2631,8 @@ static int do_journal_begin_r(struct reiserfs_transaction_handle *th, struct sup
2631 int retval; 2631 int retval;
2632 2632
2633 reiserfs_check_lock_depth(p_s_sb, "journal_begin") ; 2633 reiserfs_check_lock_depth(p_s_sb, "journal_begin") ;
2634 if (nblocks > journal->j_trans_max)
2635 BUG();
2634 2636
2635 PROC_INFO_INC( p_s_sb, journal.journal_being ); 2637 PROC_INFO_INC( p_s_sb, journal.journal_being );
2636 /* set here for journal_join */ 2638 /* set here for journal_join */
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index 7d4dc5f5aa8b..4a333255f27a 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -586,7 +586,7 @@ static int reiserfs_create (struct inode * dir, struct dentry *dentry, int mode,
586 int retval; 586 int retval;
587 struct inode * inode; 587 struct inode * inode;
588 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */ 588 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
589 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 * (REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_TRANS_BLOCKS); 589 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb)+REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
590 struct reiserfs_transaction_handle th ; 590 struct reiserfs_transaction_handle th ;
591 int locked; 591 int locked;
592 592
@@ -653,7 +653,7 @@ static int reiserfs_mknod (struct inode * dir, struct dentry *dentry, int mode,
653 struct inode * inode; 653 struct inode * inode;
654 struct reiserfs_transaction_handle th ; 654 struct reiserfs_transaction_handle th ;
655 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */ 655 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
656 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 2 * (REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_TRANS_BLOCKS); 656 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb)+REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
657 int locked; 657 int locked;
658 658
659 if (!new_valid_dev(rdev)) 659 if (!new_valid_dev(rdev))
@@ -727,7 +727,7 @@ static int reiserfs_mkdir (struct inode * dir, struct dentry *dentry, int mode)
727 struct inode * inode; 727 struct inode * inode;
728 struct reiserfs_transaction_handle th ; 728 struct reiserfs_transaction_handle th ;
729 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */ 729 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
730 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 2 * (REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_TRANS_BLOCKS); 730 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb)+REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
731 int locked; 731 int locked;
732 732
733#ifdef DISPLACE_NEW_PACKING_LOCALITIES 733#ifdef DISPLACE_NEW_PACKING_LOCALITIES
@@ -829,8 +829,10 @@ static int reiserfs_rmdir (struct inode * dir, struct dentry *dentry)
829 829
830 830
831 /* we will be doing 2 balancings and update 2 stat data, we change quotas 831 /* we will be doing 2 balancings and update 2 stat data, we change quotas
832 * of the owner of the directory and of the owner of the parent directory */ 832 * of the owner of the directory and of the owner of the parent directory.
833 jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 + 2 * (REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_TRANS_BLOCKS); 833 * The quota structure is possibly deleted only on last iput => outside
834 * of this transaction */
835 jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 + 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
834 836
835 reiserfs_write_lock(dir->i_sb); 837 reiserfs_write_lock(dir->i_sb);
836 retval = journal_begin(&th, dir->i_sb, jbegin_count) ; 838 retval = journal_begin(&th, dir->i_sb, jbegin_count) ;
@@ -913,9 +915,10 @@ static int reiserfs_unlink (struct inode * dir, struct dentry *dentry)
913 inode = dentry->d_inode; 915 inode = dentry->d_inode;
914 916
915 /* in this transaction we can be doing at max two balancings and update 917 /* in this transaction we can be doing at max two balancings and update
916 two stat datas, we change quotas of the owner of the directory and of 918 * two stat datas, we change quotas of the owner of the directory and of
917 the owner of the parent directory */ 919 * the owner of the parent directory. The quota structure is possibly
918 jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 + 2 * (REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_TRANS_BLOCKS); 920 * deleted only on iput => outside of this transaction */
921 jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 + 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
919 922
920 reiserfs_write_lock(dir->i_sb); 923 reiserfs_write_lock(dir->i_sb);
921 retval = journal_begin(&th, dir->i_sb, jbegin_count) ; 924 retval = journal_begin(&th, dir->i_sb, jbegin_count) ;
@@ -1000,7 +1003,7 @@ static int reiserfs_symlink (struct inode * parent_dir,
1000 struct reiserfs_transaction_handle th ; 1003 struct reiserfs_transaction_handle th ;
1001 int mode = S_IFLNK | S_IRWXUGO; 1004 int mode = S_IFLNK | S_IRWXUGO;
1002 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */ 1005 /* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
1003 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 2 * (REISERFS_QUOTA_INIT_BLOCKS+REISERFS_QUOTA_TRANS_BLOCKS); 1006 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 2 * (REISERFS_QUOTA_INIT_BLOCKS(parent_dir->i_sb)+REISERFS_QUOTA_TRANS_BLOCKS(parent_dir->i_sb));
1004 1007
1005 if (!(inode = new_inode(parent_dir->i_sb))) { 1008 if (!(inode = new_inode(parent_dir->i_sb))) {
1006 return -ENOMEM ; 1009 return -ENOMEM ;
@@ -1076,7 +1079,7 @@ static int reiserfs_link (struct dentry * old_dentry, struct inode * dir, struct
1076 struct inode *inode = old_dentry->d_inode; 1079 struct inode *inode = old_dentry->d_inode;
1077 struct reiserfs_transaction_handle th ; 1080 struct reiserfs_transaction_handle th ;
1078 /* We need blocks for transaction + update of quotas for the owners of the directory */ 1081 /* We need blocks for transaction + update of quotas for the owners of the directory */
1079 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 2 * REISERFS_QUOTA_TRANS_BLOCKS; 1082 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 2 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
1080 1083
1081 reiserfs_write_lock(dir->i_sb); 1084 reiserfs_write_lock(dir->i_sb);
1082 if (inode->i_nlink >= REISERFS_LINK_MAX) { 1085 if (inode->i_nlink >= REISERFS_LINK_MAX) {
@@ -1196,7 +1199,7 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry,
1196 pointed initially and (5) maybe block containing ".." of 1199 pointed initially and (5) maybe block containing ".." of
1197 renamed directory 1200 renamed directory
1198 quota updates: two parent directories */ 1201 quota updates: two parent directories */
1199 jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 5 + 4 * REISERFS_QUOTA_TRANS_BLOCKS; 1202 jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 5 + 4 * REISERFS_QUOTA_TRANS_BLOCKS(old_dir->i_sb);
1200 1203
1201 old_inode = old_dentry->d_inode; 1204 old_inode = old_dentry->d_inode;
1202 new_dentry_inode = new_dentry->d_inode; 1205 new_dentry_inode = new_dentry->d_inode;
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index c47f8fd31a2d..63158491e152 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -223,7 +223,7 @@ extern struct tree_balance * cur_tb;
223const struct reiserfs_key MIN_KEY = {0, 0, {{0, 0},}}; 223const struct reiserfs_key MIN_KEY = {0, 0, {{0, 0},}};
224 224
225/* Maximal possible key. It is never in the tree. */ 225/* Maximal possible key. It is never in the tree. */
226const struct reiserfs_key MAX_KEY = { 226static const struct reiserfs_key MAX_KEY = {
227 __constant_cpu_to_le32(0xffffffff), 227 __constant_cpu_to_le32(0xffffffff),
228 __constant_cpu_to_le32(0xffffffff), 228 __constant_cpu_to_le32(0xffffffff),
229 {{__constant_cpu_to_le32(0xffffffff), 229 {{__constant_cpu_to_le32(0xffffffff),
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index b35b87744983..660aefca1fd2 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -866,8 +866,9 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st
866 {"jdev", .arg_required = 'j', .values = NULL}, 866 {"jdev", .arg_required = 'j', .values = NULL},
867 {"nolargeio", .arg_required = 'w', .values = NULL}, 867 {"nolargeio", .arg_required = 'w', .values = NULL},
868 {"commit", .arg_required = 'c', .values = NULL}, 868 {"commit", .arg_required = 'c', .values = NULL},
869 {"usrquota",}, 869 {"usrquota", .setmask = 1<<REISERFS_QUOTA},
870 {"grpquota",}, 870 {"grpquota", .setmask = 1<<REISERFS_QUOTA},
871 {"noquota", .clrmask = 1<<REISERFS_QUOTA},
871 {"errors", .arg_required = 'e', .values = error_actions}, 872 {"errors", .arg_required = 'e', .values = error_actions},
872 {"usrjquota", .arg_required = 'u'|(1<<REISERFS_OPT_ALLOWEMPTY), .values = NULL}, 873 {"usrjquota", .arg_required = 'u'|(1<<REISERFS_OPT_ALLOWEMPTY), .values = NULL},
873 {"grpjquota", .arg_required = 'g'|(1<<REISERFS_OPT_ALLOWEMPTY), .values = NULL}, 874 {"grpjquota", .arg_required = 'g'|(1<<REISERFS_OPT_ALLOWEMPTY), .values = NULL},
@@ -964,6 +965,7 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st
964 return 0; 965 return 0;
965 } 966 }
966 strcpy(REISERFS_SB(s)->s_qf_names[qtype], arg); 967 strcpy(REISERFS_SB(s)->s_qf_names[qtype], arg);
968 *mount_options |= 1<<REISERFS_QUOTA;
967 } 969 }
968 else { 970 else {
969 if (REISERFS_SB(s)->s_qf_names[qtype]) { 971 if (REISERFS_SB(s)->s_qf_names[qtype]) {
@@ -995,7 +997,13 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st
995 reiserfs_warning(s, "reiserfs_parse_options: journalled quota format not specified."); 997 reiserfs_warning(s, "reiserfs_parse_options: journalled quota format not specified.");
996 return 0; 998 return 0;
997 } 999 }
1000 /* This checking is not precise wrt the quota type but for our purposes it is sufficient */
1001 if (!(*mount_options & (1<<REISERFS_QUOTA)) && sb_any_quota_enabled(s)) {
1002 reiserfs_warning(s, "reiserfs_parse_options: quota options must be present when quota is turned on.");
1003 return 0;
1004 }
998#endif 1005#endif
1006
999 return 1; 1007 return 1;
1000} 1008}
1001 1009
@@ -1105,6 +1113,7 @@ static int reiserfs_remount (struct super_block * s, int * mount_flags, char * a
1105 safe_mask |= 1 << REISERFS_ERROR_RO; 1113 safe_mask |= 1 << REISERFS_ERROR_RO;
1106 safe_mask |= 1 << REISERFS_ERROR_CONTINUE; 1114 safe_mask |= 1 << REISERFS_ERROR_CONTINUE;
1107 safe_mask |= 1 << REISERFS_ERROR_PANIC; 1115 safe_mask |= 1 << REISERFS_ERROR_PANIC;
1116 safe_mask |= 1 << REISERFS_QUOTA;
1108 1117
1109 /* Update the bitmask, taking care to keep 1118 /* Update the bitmask, taking care to keep
1110 * the bits we're not allowed to change here */ 1119 * the bits we're not allowed to change here */
@@ -1841,13 +1850,18 @@ static int reiserfs_statfs (struct super_block * s, struct kstatfs * buf)
1841static int reiserfs_dquot_initialize(struct inode *inode, int type) 1850static int reiserfs_dquot_initialize(struct inode *inode, int type)
1842{ 1851{
1843 struct reiserfs_transaction_handle th; 1852 struct reiserfs_transaction_handle th;
1844 int ret; 1853 int ret, err;
1845 1854
1846 /* We may create quota structure so we need to reserve enough blocks */ 1855 /* We may create quota structure so we need to reserve enough blocks */
1847 reiserfs_write_lock(inode->i_sb); 1856 reiserfs_write_lock(inode->i_sb);
1848 journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS); 1857 ret = journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb));
1858 if (ret)
1859 goto out;
1849 ret = dquot_initialize(inode, type); 1860 ret = dquot_initialize(inode, type);
1850 journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS); 1861 err = journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb));
1862 if (!ret && err)
1863 ret = err;
1864out:
1851 reiserfs_write_unlock(inode->i_sb); 1865 reiserfs_write_unlock(inode->i_sb);
1852 return ret; 1866 return ret;
1853} 1867}
@@ -1855,13 +1869,18 @@ static int reiserfs_dquot_initialize(struct inode *inode, int type)
1855static int reiserfs_dquot_drop(struct inode *inode) 1869static int reiserfs_dquot_drop(struct inode *inode)
1856{ 1870{
1857 struct reiserfs_transaction_handle th; 1871 struct reiserfs_transaction_handle th;
1858 int ret; 1872 int ret, err;
1859 1873
1860 /* We may delete quota structure so we need to reserve enough blocks */ 1874 /* We may delete quota structure so we need to reserve enough blocks */
1861 reiserfs_write_lock(inode->i_sb); 1875 reiserfs_write_lock(inode->i_sb);
1862 journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS); 1876 ret = journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_DEL_BLOCKS(inode->i_sb));
1877 if (ret)
1878 goto out;
1863 ret = dquot_drop(inode); 1879 ret = dquot_drop(inode);
1864 journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS); 1880 err = journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_DEL_BLOCKS(inode->i_sb));
1881 if (!ret && err)
1882 ret = err;
1883out:
1865 reiserfs_write_unlock(inode->i_sb); 1884 reiserfs_write_unlock(inode->i_sb);
1866 return ret; 1885 return ret;
1867} 1886}
@@ -1869,12 +1888,17 @@ static int reiserfs_dquot_drop(struct inode *inode)
1869static int reiserfs_write_dquot(struct dquot *dquot) 1888static int reiserfs_write_dquot(struct dquot *dquot)
1870{ 1889{
1871 struct reiserfs_transaction_handle th; 1890 struct reiserfs_transaction_handle th;
1872 int ret; 1891 int ret, err;
1873 1892
1874 reiserfs_write_lock(dquot->dq_sb); 1893 reiserfs_write_lock(dquot->dq_sb);
1875 journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS); 1894 ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS(dquot->dq_sb));
1895 if (ret)
1896 goto out;
1876 ret = dquot_commit(dquot); 1897 ret = dquot_commit(dquot);
1877 journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS); 1898 err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS(dquot->dq_sb));
1899 if (!ret && err)
1900 ret = err;
1901out:
1878 reiserfs_write_unlock(dquot->dq_sb); 1902 reiserfs_write_unlock(dquot->dq_sb);
1879 return ret; 1903 return ret;
1880} 1904}
@@ -1882,12 +1906,17 @@ static int reiserfs_write_dquot(struct dquot *dquot)
1882static int reiserfs_acquire_dquot(struct dquot *dquot) 1906static int reiserfs_acquire_dquot(struct dquot *dquot)
1883{ 1907{
1884 struct reiserfs_transaction_handle th; 1908 struct reiserfs_transaction_handle th;
1885 int ret; 1909 int ret, err;
1886 1910
1887 reiserfs_write_lock(dquot->dq_sb); 1911 reiserfs_write_lock(dquot->dq_sb);
1888 journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS); 1912 ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS(dquot->dq_sb));
1913 if (ret)
1914 goto out;
1889 ret = dquot_acquire(dquot); 1915 ret = dquot_acquire(dquot);
1890 journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS); 1916 err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS(dquot->dq_sb));
1917 if (!ret && err)
1918 ret = err;
1919out:
1891 reiserfs_write_unlock(dquot->dq_sb); 1920 reiserfs_write_unlock(dquot->dq_sb);
1892 return ret; 1921 return ret;
1893} 1922}
@@ -1895,12 +1924,17 @@ static int reiserfs_acquire_dquot(struct dquot *dquot)
1895static int reiserfs_release_dquot(struct dquot *dquot) 1924static int reiserfs_release_dquot(struct dquot *dquot)
1896{ 1925{
1897 struct reiserfs_transaction_handle th; 1926 struct reiserfs_transaction_handle th;
1898 int ret; 1927 int ret, err;
1899 1928
1900 reiserfs_write_lock(dquot->dq_sb); 1929 reiserfs_write_lock(dquot->dq_sb);
1901 journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS); 1930 ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_DEL_BLOCKS(dquot->dq_sb));
1931 if (ret)
1932 goto out;
1902 ret = dquot_release(dquot); 1933 ret = dquot_release(dquot);
1903 journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS); 1934 err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_DEL_BLOCKS(dquot->dq_sb));
1935 if (!ret && err)
1936 ret = err;
1937out:
1904 reiserfs_write_unlock(dquot->dq_sb); 1938 reiserfs_write_unlock(dquot->dq_sb);
1905 return ret; 1939 return ret;
1906} 1940}
@@ -1920,39 +1954,29 @@ static int reiserfs_mark_dquot_dirty(struct dquot *dquot)
1920static int reiserfs_write_info(struct super_block *sb, int type) 1954static int reiserfs_write_info(struct super_block *sb, int type)
1921{ 1955{
1922 struct reiserfs_transaction_handle th; 1956 struct reiserfs_transaction_handle th;
1923 int ret; 1957 int ret, err;
1924 1958
1925 /* Data block + inode block */ 1959 /* Data block + inode block */
1926 reiserfs_write_lock(sb); 1960 reiserfs_write_lock(sb);
1927 journal_begin(&th, sb, 2); 1961 ret = journal_begin(&th, sb, 2);
1962 if (ret)
1963 goto out;
1928 ret = dquot_commit_info(sb, type); 1964 ret = dquot_commit_info(sb, type);
1929 journal_end(&th, sb, 2); 1965 err = journal_end(&th, sb, 2);
1966 if (!ret && err)
1967 ret = err;
1968out:
1930 reiserfs_write_unlock(sb); 1969 reiserfs_write_unlock(sb);
1931 return ret; 1970 return ret;
1932} 1971}
1933 1972
1934/* 1973/*
1935 * Turn on quotas during mount time - we need to find 1974 * Turn on quotas during mount time - we need to find the quota file and such...
1936 * the quota file and such...
1937 */ 1975 */
1938static int reiserfs_quota_on_mount(struct super_block *sb, int type) 1976static int reiserfs_quota_on_mount(struct super_block *sb, int type)
1939{ 1977{
1940 int err; 1978 return vfs_quota_on_mount(sb, REISERFS_SB(sb)->s_qf_names[type],
1941 struct dentry *dentry; 1979 REISERFS_SB(sb)->s_jquota_fmt, type);
1942 struct qstr name = { .name = REISERFS_SB(sb)->s_qf_names[type],
1943 .hash = 0,
1944 .len = strlen(REISERFS_SB(sb)->s_qf_names[type])};
1945
1946 dentry = lookup_hash(&name, sb->s_root);
1947 if (IS_ERR(dentry))
1948 return PTR_ERR(dentry);
1949 err = vfs_quota_on_mount(type, REISERFS_SB(sb)->s_jquota_fmt, dentry);
1950 /* Now invalidate and put the dentry - quota got its own reference
1951 * to inode and dentry has at least wrong hash so we had better
1952 * throw it away */
1953 d_invalidate(dentry);
1954 dput(dentry);
1955 return err;
1956} 1980}
1957 1981
1958/* 1982/*
@@ -1963,6 +1987,8 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, ch
1963 int err; 1987 int err;
1964 struct nameidata nd; 1988 struct nameidata nd;
1965 1989
1990 if (!(REISERFS_SB(sb)->s_mount_opt & (1<<REISERFS_QUOTA)))
1991 return -EINVAL;
1966 err = path_lookup(path, LOOKUP_FOLLOW, &nd); 1992 err = path_lookup(path, LOOKUP_FOLLOW, &nd);
1967 if (err) 1993 if (err)
1968 return err; 1994 return err;
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c
index e302071903a1..c312881c5f53 100644
--- a/fs/reiserfs/xattr_acl.c
+++ b/fs/reiserfs/xattr_acl.c
@@ -4,7 +4,7 @@
4#include <linux/errno.h> 4#include <linux/errno.h>
5#include <linux/pagemap.h> 5#include <linux/pagemap.h>
6#include <linux/xattr.h> 6#include <linux/xattr.h>
7#include <linux/xattr_acl.h> 7#include <linux/posix_acl_xattr.h>
8#include <linux/reiserfs_xattr.h> 8#include <linux/reiserfs_xattr.h>
9#include <linux/reiserfs_acl.h> 9#include <linux/reiserfs_acl.h>
10#include <asm/uaccess.h> 10#include <asm/uaccess.h>
@@ -192,11 +192,11 @@ reiserfs_get_acl(struct inode *inode, int type)
192 192
193 switch (type) { 193 switch (type) {
194 case ACL_TYPE_ACCESS: 194 case ACL_TYPE_ACCESS:
195 name = XATTR_NAME_ACL_ACCESS; 195 name = POSIX_ACL_XATTR_ACCESS;
196 p_acl = &reiserfs_i->i_acl_access; 196 p_acl = &reiserfs_i->i_acl_access;
197 break; 197 break;
198 case ACL_TYPE_DEFAULT: 198 case ACL_TYPE_DEFAULT:
199 name = XATTR_NAME_ACL_DEFAULT; 199 name = POSIX_ACL_XATTR_DEFAULT;
200 p_acl = &reiserfs_i->i_acl_default; 200 p_acl = &reiserfs_i->i_acl_default;
201 break; 201 break;
202 default: 202 default:
@@ -260,7 +260,7 @@ reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
260 260
261 switch (type) { 261 switch (type) {
262 case ACL_TYPE_ACCESS: 262 case ACL_TYPE_ACCESS:
263 name = XATTR_NAME_ACL_ACCESS; 263 name = POSIX_ACL_XATTR_ACCESS;
264 p_acl = &reiserfs_i->i_acl_access; 264 p_acl = &reiserfs_i->i_acl_access;
265 if (acl) { 265 if (acl) {
266 mode_t mode = inode->i_mode; 266 mode_t mode = inode->i_mode;
@@ -275,7 +275,7 @@ reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
275 } 275 }
276 break; 276 break;
277 case ACL_TYPE_DEFAULT: 277 case ACL_TYPE_DEFAULT:
278 name = XATTR_NAME_ACL_DEFAULT; 278 name = POSIX_ACL_XATTR_DEFAULT;
279 p_acl = &reiserfs_i->i_acl_default; 279 p_acl = &reiserfs_i->i_acl_default;
280 if (!S_ISDIR (inode->i_mode)) 280 if (!S_ISDIR (inode->i_mode))
281 return acl ? -EACCES : 0; 281 return acl ? -EACCES : 0;
@@ -468,7 +468,7 @@ static int
468posix_acl_access_get(struct inode *inode, const char *name, 468posix_acl_access_get(struct inode *inode, const char *name,
469 void *buffer, size_t size) 469 void *buffer, size_t size)
470{ 470{
471 if (strlen(name) != sizeof(XATTR_NAME_ACL_ACCESS)-1) 471 if (strlen(name) != sizeof(POSIX_ACL_XATTR_ACCESS)-1)
472 return -EINVAL; 472 return -EINVAL;
473 return xattr_get_acl(inode, ACL_TYPE_ACCESS, buffer, size); 473 return xattr_get_acl(inode, ACL_TYPE_ACCESS, buffer, size);
474} 474}
@@ -477,7 +477,7 @@ static int
477posix_acl_access_set(struct inode *inode, const char *name, 477posix_acl_access_set(struct inode *inode, const char *name,
478 const void *value, size_t size, int flags) 478 const void *value, size_t size, int flags)
479{ 479{
480 if (strlen(name) != sizeof(XATTR_NAME_ACL_ACCESS)-1) 480 if (strlen(name) != sizeof(POSIX_ACL_XATTR_ACCESS)-1)
481 return -EINVAL; 481 return -EINVAL;
482 return xattr_set_acl(inode, ACL_TYPE_ACCESS, value, size); 482 return xattr_set_acl(inode, ACL_TYPE_ACCESS, value, size);
483} 483}
@@ -487,7 +487,7 @@ posix_acl_access_del (struct inode *inode, const char *name)
487{ 487{
488 struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode); 488 struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
489 struct posix_acl **acl = &reiserfs_i->i_acl_access; 489 struct posix_acl **acl = &reiserfs_i->i_acl_access;
490 if (strlen(name) != sizeof(XATTR_NAME_ACL_ACCESS)-1) 490 if (strlen(name) != sizeof(POSIX_ACL_XATTR_ACCESS)-1)
491 return -EINVAL; 491 return -EINVAL;
492 if (!IS_ERR (*acl) && *acl) { 492 if (!IS_ERR (*acl) && *acl) {
493 posix_acl_release (*acl); 493 posix_acl_release (*acl);
@@ -510,7 +510,7 @@ posix_acl_access_list (struct inode *inode, const char *name, int namelen, char
510} 510}
511 511
512struct reiserfs_xattr_handler posix_acl_access_handler = { 512struct reiserfs_xattr_handler posix_acl_access_handler = {
513 .prefix = XATTR_NAME_ACL_ACCESS, 513 .prefix = POSIX_ACL_XATTR_ACCESS,
514 .get = posix_acl_access_get, 514 .get = posix_acl_access_get,
515 .set = posix_acl_access_set, 515 .set = posix_acl_access_set,
516 .del = posix_acl_access_del, 516 .del = posix_acl_access_del,
@@ -521,7 +521,7 @@ static int
521posix_acl_default_get (struct inode *inode, const char *name, 521posix_acl_default_get (struct inode *inode, const char *name,
522 void *buffer, size_t size) 522 void *buffer, size_t size)
523{ 523{
524 if (strlen(name) != sizeof(XATTR_NAME_ACL_DEFAULT)-1) 524 if (strlen(name) != sizeof(POSIX_ACL_XATTR_DEFAULT)-1)
525 return -EINVAL; 525 return -EINVAL;
526 return xattr_get_acl(inode, ACL_TYPE_DEFAULT, buffer, size); 526 return xattr_get_acl(inode, ACL_TYPE_DEFAULT, buffer, size);
527} 527}
@@ -530,7 +530,7 @@ static int
530posix_acl_default_set(struct inode *inode, const char *name, 530posix_acl_default_set(struct inode *inode, const char *name,
531 const void *value, size_t size, int flags) 531 const void *value, size_t size, int flags)
532{ 532{
533 if (strlen(name) != sizeof(XATTR_NAME_ACL_DEFAULT)-1) 533 if (strlen(name) != sizeof(POSIX_ACL_XATTR_DEFAULT)-1)
534 return -EINVAL; 534 return -EINVAL;
535 return xattr_set_acl(inode, ACL_TYPE_DEFAULT, value, size); 535 return xattr_set_acl(inode, ACL_TYPE_DEFAULT, value, size);
536} 536}
@@ -540,7 +540,7 @@ posix_acl_default_del (struct inode *inode, const char *name)
540{ 540{
541 struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode); 541 struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
542 struct posix_acl **acl = &reiserfs_i->i_acl_default; 542 struct posix_acl **acl = &reiserfs_i->i_acl_default;
543 if (strlen(name) != sizeof(XATTR_NAME_ACL_DEFAULT)-1) 543 if (strlen(name) != sizeof(POSIX_ACL_XATTR_DEFAULT)-1)
544 return -EINVAL; 544 return -EINVAL;
545 if (!IS_ERR (*acl) && *acl) { 545 if (!IS_ERR (*acl) && *acl) {
546 posix_acl_release (*acl); 546 posix_acl_release (*acl);
@@ -563,7 +563,7 @@ posix_acl_default_list (struct inode *inode, const char *name, int namelen, char
563} 563}
564 564
565struct reiserfs_xattr_handler posix_acl_default_handler = { 565struct reiserfs_xattr_handler posix_acl_default_handler = {
566 .prefix = XATTR_NAME_ACL_DEFAULT, 566 .prefix = POSIX_ACL_XATTR_DEFAULT,
567 .get = posix_acl_default_get, 567 .get = posix_acl_default_get,
568 .set = posix_acl_default_set, 568 .set = posix_acl_default_set,
569 .del = posix_acl_default_del, 569 .del = posix_acl_default_del,