aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/xattr.c
diff options
context:
space:
mode:
authorTiger Yang <tiger.yang@oracle.com>2008-12-09 03:43:08 -0500
committerMark Fasheh <mfasheh@suse.com>2009-01-05 11:40:36 -0500
commit008aafaf0b4aa0476da483e3c6e3edbe951811ff (patch)
tree2c9ac5e471a66938ed26b46220ab72ef06073112 /fs/ocfs2/xattr.c
parent0e445b6fe93c723fe8093fd04ddfeb11ae2de082 (diff)
ocfs2: alloc xattr bucket in ocfs2_xattr_set_handle
In extreme situation, may need xattr bucket for setting security entry and acl entries during mknod. This only happens when block size is too small. Signed-off-by: Tiger Yang <tiger.yang@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/xattr.c')
-rw-r--r--fs/ocfs2/xattr.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index e5be470e7504..095b0bb6e590 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -2611,9 +2611,7 @@ out:
2611/* 2611/*
2612 * This function only called duing creating inode 2612 * This function only called duing creating inode
2613 * for init security/acl xattrs of the new inode. 2613 * for init security/acl xattrs of the new inode.
2614 * The xattrs could be put into ibody or extent block, 2614 * All transanction credits have been reserved in mknod.
2615 * xattr bucket would not be use in this case.
2616 * transanction credits also be reserved in here.
2617 */ 2615 */
2618int ocfs2_xattr_set_handle(handle_t *handle, 2616int ocfs2_xattr_set_handle(handle_t *handle,
2619 struct inode *inode, 2617 struct inode *inode,
@@ -2653,6 +2651,19 @@ int ocfs2_xattr_set_handle(handle_t *handle,
2653 if (!ocfs2_supports_xattr(OCFS2_SB(inode->i_sb))) 2651 if (!ocfs2_supports_xattr(OCFS2_SB(inode->i_sb)))
2654 return -EOPNOTSUPP; 2652 return -EOPNOTSUPP;
2655 2653
2654 /*
2655 * In extreme situation, may need xattr bucket when
2656 * block size is too small. And we have already reserved
2657 * the credits for bucket in mknod.
2658 */
2659 if (inode->i_sb->s_blocksize == OCFS2_MIN_BLOCKSIZE) {
2660 xbs.bucket = ocfs2_xattr_bucket_new(inode);
2661 if (!xbs.bucket) {
2662 mlog_errno(-ENOMEM);
2663 return -ENOMEM;
2664 }
2665 }
2666
2656 xis.inode_bh = xbs.inode_bh = di_bh; 2667 xis.inode_bh = xbs.inode_bh = di_bh;
2657 di = (struct ocfs2_dinode *)di_bh->b_data; 2668 di = (struct ocfs2_dinode *)di_bh->b_data;
2658 2669
@@ -2672,6 +2683,7 @@ int ocfs2_xattr_set_handle(handle_t *handle,
2672cleanup: 2683cleanup:
2673 up_write(&OCFS2_I(inode)->ip_xattr_sem); 2684 up_write(&OCFS2_I(inode)->ip_xattr_sem);
2674 brelse(xbs.xattr_bh); 2685 brelse(xbs.xattr_bh);
2686 ocfs2_xattr_bucket_free(xbs.bucket);
2675 2687
2676 return ret; 2688 return ret;
2677} 2689}