diff options
Diffstat (limited to 'fs/ocfs2/xattr.c')
-rw-r--r-- | fs/ocfs2/xattr.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 81ecf9c0bf0a..194fb22ef79d 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
@@ -7185,20 +7185,9 @@ int ocfs2_init_security_and_acl(struct inode *dir, | |||
7185 | { | 7185 | { |
7186 | int ret = 0; | 7186 | int ret = 0; |
7187 | struct buffer_head *dir_bh = NULL; | 7187 | struct buffer_head *dir_bh = NULL; |
7188 | struct ocfs2_security_xattr_info si = { | ||
7189 | .enable = 1, | ||
7190 | }; | ||
7191 | 7188 | ||
7192 | ret = ocfs2_init_security_get(inode, dir, qstr, &si); | 7189 | ret = ocfs2_init_security_get(inode, dir, qstr, NULL); |
7193 | if (!ret) { | 7190 | if (!ret) { |
7194 | ret = ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_SECURITY, | ||
7195 | si.name, si.value, si.value_len, | ||
7196 | XATTR_CREATE); | ||
7197 | if (ret) { | ||
7198 | mlog_errno(ret); | ||
7199 | goto leave; | ||
7200 | } | ||
7201 | } else if (ret != -EOPNOTSUPP) { | ||
7202 | mlog_errno(ret); | 7191 | mlog_errno(ret); |
7203 | goto leave; | 7192 | goto leave; |
7204 | } | 7193 | } |
@@ -7255,6 +7244,22 @@ static int ocfs2_xattr_security_set(struct dentry *dentry, const char *name, | |||
7255 | name, value, size, flags); | 7244 | name, value, size, flags); |
7256 | } | 7245 | } |
7257 | 7246 | ||
7247 | int ocfs2_initxattrs(struct inode *inode, const struct xattr *xattr_array, | ||
7248 | void *fs_info) | ||
7249 | { | ||
7250 | const struct xattr *xattr; | ||
7251 | int err = 0; | ||
7252 | |||
7253 | for (xattr = xattr_array; xattr->name != NULL; xattr++) { | ||
7254 | err = ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_SECURITY, | ||
7255 | xattr->name, xattr->value, | ||
7256 | xattr->value_len, XATTR_CREATE); | ||
7257 | if (err) | ||
7258 | break; | ||
7259 | } | ||
7260 | return err; | ||
7261 | } | ||
7262 | |||
7258 | int ocfs2_init_security_get(struct inode *inode, | 7263 | int ocfs2_init_security_get(struct inode *inode, |
7259 | struct inode *dir, | 7264 | struct inode *dir, |
7260 | const struct qstr *qstr, | 7265 | const struct qstr *qstr, |
@@ -7263,8 +7268,13 @@ int ocfs2_init_security_get(struct inode *inode, | |||
7263 | /* check whether ocfs2 support feature xattr */ | 7268 | /* check whether ocfs2 support feature xattr */ |
7264 | if (!ocfs2_supports_xattr(OCFS2_SB(dir->i_sb))) | 7269 | if (!ocfs2_supports_xattr(OCFS2_SB(dir->i_sb))) |
7265 | return -EOPNOTSUPP; | 7270 | return -EOPNOTSUPP; |
7266 | return security_inode_init_security(inode, dir, qstr, &si->name, | 7271 | if (si) |
7267 | &si->value, &si->value_len); | 7272 | return security_old_inode_init_security(inode, dir, qstr, |
7273 | &si->name, &si->value, | ||
7274 | &si->value_len); | ||
7275 | |||
7276 | return security_inode_init_security(inode, dir, qstr, | ||
7277 | &ocfs2_initxattrs, NULL); | ||
7268 | } | 7278 | } |
7269 | 7279 | ||
7270 | int ocfs2_init_security_set(handle_t *handle, | 7280 | int ocfs2_init_security_set(handle_t *handle, |