Commit 008aafaf authored by Tiger Yang's avatar Tiger Yang Committed by Mark Fasheh

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: default avatarTiger Yang <tiger.yang@oracle.com>
Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
parent 0e445b6f
...@@ -2611,9 +2611,7 @@ static int __ocfs2_xattr_set_handle(struct inode *inode, ...@@ -2611,9 +2611,7 @@ static int __ocfs2_xattr_set_handle(struct inode *inode,
/* /*
* This function only called duing creating inode * This function only called duing creating inode
* for init security/acl xattrs of the new inode. * for init security/acl xattrs of the new inode.
* The xattrs could be put into ibody or extent block, * All transanction credits have been reserved in mknod.
* xattr bucket would not be use in this case.
* transanction credits also be reserved in here.
*/ */
int ocfs2_xattr_set_handle(handle_t *handle, int ocfs2_xattr_set_handle(handle_t *handle,
struct inode *inode, struct inode *inode,
...@@ -2653,6 +2651,19 @@ int ocfs2_xattr_set_handle(handle_t *handle, ...@@ -2653,6 +2651,19 @@ int ocfs2_xattr_set_handle(handle_t *handle,
if (!ocfs2_supports_xattr(OCFS2_SB(inode->i_sb))) if (!ocfs2_supports_xattr(OCFS2_SB(inode->i_sb)))
return -EOPNOTSUPP; return -EOPNOTSUPP;
/*
* In extreme situation, may need xattr bucket when
* block size is too small. And we have already reserved
* the credits for bucket in mknod.
*/
if (inode->i_sb->s_blocksize == OCFS2_MIN_BLOCKSIZE) {
xbs.bucket = ocfs2_xattr_bucket_new(inode);
if (!xbs.bucket) {
mlog_errno(-ENOMEM);
return -ENOMEM;
}
}
xis.inode_bh = xbs.inode_bh = di_bh; xis.inode_bh = xbs.inode_bh = di_bh;
di = (struct ocfs2_dinode *)di_bh->b_data; di = (struct ocfs2_dinode *)di_bh->b_data;
...@@ -2672,6 +2683,7 @@ int ocfs2_xattr_set_handle(handle_t *handle, ...@@ -2672,6 +2683,7 @@ int ocfs2_xattr_set_handle(handle_t *handle,
cleanup: cleanup:
up_write(&OCFS2_I(inode)->ip_xattr_sem); up_write(&OCFS2_I(inode)->ip_xattr_sem);
brelse(xbs.xattr_bh); brelse(xbs.xattr_bh);
ocfs2_xattr_bucket_free(xbs.bucket);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment