diff options
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/xattr.c | 18 |
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 | */ |
2618 | int ocfs2_xattr_set_handle(handle_t *handle, | 2616 | int 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, | |||
2672 | cleanup: | 2683 | cleanup: |
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 | } |