aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/namei.c
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2009-03-30 14:02:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-30 15:16:38 -0400
commit0ab2621ebd9a28bf7a524ecd50d492a10579dfcc (patch)
tree62dda6de2fed116aff363190f95a58d56c690e3e /fs/reiserfs/namei.c
parent48b32a3553a54740d236b79a90f20147a25875e3 (diff)
reiserfs: journaled xattrs
Deadlocks are possible in the xattr code between the journal lock and the xattr sems. This patch implements journalling for xattr operations. The benefit is twofold: * It gets rid of the deadlock possibility by always ensuring that xattr write operations are initiated inside a transaction. * It corrects the problem where xattr backing files aren't considered any differently than normal files, despite the fact they are metadata. I discussed the added journal load with Chris Mason, and we decided that since xattrs (versus other journal activity) is fairly rare, the introduction of larger transactions to support journaled xattrs wouldn't be too big a deal. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/reiserfs/namei.c')
-rw-r--r--fs/reiserfs/namei.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index ddf1bcd41c87..d9c1c8bd2950 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -598,15 +598,13 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, int mode,
598 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + 598 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
599 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); 599 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
600 struct reiserfs_transaction_handle th; 600 struct reiserfs_transaction_handle th;
601 int locked;
602 601
603 if (!(inode = new_inode(dir->i_sb))) { 602 if (!(inode = new_inode(dir->i_sb))) {
604 return -ENOMEM; 603 return -ENOMEM;
605 } 604 }
606 new_inode_init(inode, dir, mode); 605 new_inode_init(inode, dir, mode);
607 606
608 locked = reiserfs_cache_default_acl(dir); 607 jbegin_count += reiserfs_cache_default_acl(dir);
609
610 reiserfs_write_lock(dir->i_sb); 608 reiserfs_write_lock(dir->i_sb);
611 609
612 retval = journal_begin(&th, dir->i_sb, jbegin_count); 610 retval = journal_begin(&th, dir->i_sb, jbegin_count);
@@ -662,7 +660,6 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
662 JOURNAL_PER_BALANCE_CNT * 3 + 660 JOURNAL_PER_BALANCE_CNT * 3 +
663 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + 661 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
664 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); 662 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
665 int locked;
666 663
667 if (!new_valid_dev(rdev)) 664 if (!new_valid_dev(rdev))
668 return -EINVAL; 665 return -EINVAL;
@@ -672,8 +669,7 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
672 } 669 }
673 new_inode_init(inode, dir, mode); 670 new_inode_init(inode, dir, mode);
674 671
675 locked = reiserfs_cache_default_acl(dir); 672 jbegin_count += reiserfs_cache_default_acl(dir);
676
677 reiserfs_write_lock(dir->i_sb); 673 reiserfs_write_lock(dir->i_sb);
678 674
679 retval = journal_begin(&th, dir->i_sb, jbegin_count); 675 retval = journal_begin(&th, dir->i_sb, jbegin_count);
@@ -732,7 +728,6 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
732 JOURNAL_PER_BALANCE_CNT * 3 + 728 JOURNAL_PER_BALANCE_CNT * 3 +
733 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + 729 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
734 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); 730 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
735 int locked;
736 731
737#ifdef DISPLACE_NEW_PACKING_LOCALITIES 732#ifdef DISPLACE_NEW_PACKING_LOCALITIES
738 /* set flag that new packing locality created and new blocks for the content * of that directory are not displaced yet */ 733 /* set flag that new packing locality created and new blocks for the content * of that directory are not displaced yet */
@@ -744,8 +739,7 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
744 } 739 }
745 new_inode_init(inode, dir, mode); 740 new_inode_init(inode, dir, mode);
746 741
747 locked = reiserfs_cache_default_acl(dir); 742 jbegin_count += reiserfs_cache_default_acl(dir);
748
749 reiserfs_write_lock(dir->i_sb); 743 reiserfs_write_lock(dir->i_sb);
750 744
751 retval = journal_begin(&th, dir->i_sb, jbegin_count); 745 retval = journal_begin(&th, dir->i_sb, jbegin_count);
@@ -1034,8 +1028,6 @@ static int reiserfs_symlink(struct inode *parent_dir,
1034 memcpy(name, symname, strlen(symname)); 1028 memcpy(name, symname, strlen(symname));
1035 padd_item(name, item_len, strlen(symname)); 1029 padd_item(name, item_len, strlen(symname));
1036 1030
1037 /* We would inherit the default ACL here, but symlinks don't get ACLs */
1038
1039 retval = journal_begin(&th, parent_dir->i_sb, jbegin_count); 1031 retval = journal_begin(&th, parent_dir->i_sb, jbegin_count);
1040 if (retval) { 1032 if (retval) {
1041 drop_new_inode(inode); 1033 drop_new_inode(inode);