aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/acl.c81
-rw-r--r--fs/ocfs2/acl.h2
-rw-r--r--fs/ocfs2/cluster/tcp.c1
-rw-r--r--fs/ocfs2/dir.c4
-rw-r--r--fs/ocfs2/dlm/dlmdebug.c1
-rw-r--r--fs/ocfs2/dlmglue.c2
-rw-r--r--fs/ocfs2/file.c4
-rw-r--r--fs/ocfs2/inode.c4
-rw-r--r--fs/ocfs2/move_extents.c1
-rw-r--r--fs/ocfs2/namei.c20
-rw-r--r--fs/ocfs2/super.h14
-rw-r--r--fs/ocfs2/xattr.c38
12 files changed, 77 insertions, 95 deletions
diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
index 1cee970eb55a..a7219075b4de 100644
--- a/fs/ocfs2/acl.c
+++ b/fs/ocfs2/acl.c
@@ -247,7 +247,7 @@ static int ocfs2_set_acl(handle_t *handle,
247 case ACL_TYPE_ACCESS: 247 case ACL_TYPE_ACCESS:
248 name_index = OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS; 248 name_index = OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS;
249 if (acl) { 249 if (acl) {
250 mode_t mode = inode->i_mode; 250 umode_t mode = inode->i_mode;
251 ret = posix_acl_equiv_mode(acl, &mode); 251 ret = posix_acl_equiv_mode(acl, &mode);
252 if (ret < 0) 252 if (ret < 0)
253 return ret; 253 return ret;
@@ -290,47 +290,32 @@ static int ocfs2_set_acl(handle_t *handle,
290 return ret; 290 return ret;
291} 291}
292 292
293int ocfs2_check_acl(struct inode *inode, int mask) 293struct posix_acl *ocfs2_iop_get_acl(struct inode *inode, int type)
294{ 294{
295 struct ocfs2_super *osb; 295 struct ocfs2_super *osb;
296 struct buffer_head *di_bh = NULL; 296 struct buffer_head *di_bh = NULL;
297 struct posix_acl *acl; 297 struct posix_acl *acl;
298 int ret = -EAGAIN; 298 int ret = -EAGAIN;
299 299
300 if (mask & MAY_NOT_BLOCK)
301 return -ECHILD;
302
303 osb = OCFS2_SB(inode->i_sb); 300 osb = OCFS2_SB(inode->i_sb);
304 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) 301 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
305 return ret; 302 return NULL;
306 303
307 ret = ocfs2_read_inode_block(inode, &di_bh); 304 ret = ocfs2_read_inode_block(inode, &di_bh);
308 if (ret < 0) { 305 if (ret < 0)
309 mlog_errno(ret); 306 return ERR_PTR(ret);
310 return ret;
311 }
312 307
313 acl = ocfs2_get_acl_nolock(inode, ACL_TYPE_ACCESS, di_bh); 308 acl = ocfs2_get_acl_nolock(inode, type, di_bh);
314 309
315 brelse(di_bh); 310 brelse(di_bh);
316 311
317 if (IS_ERR(acl)) { 312 return acl;
318 mlog_errno(PTR_ERR(acl));
319 return PTR_ERR(acl);
320 }
321 if (acl) {
322 ret = posix_acl_permission(inode, acl, mask);
323 posix_acl_release(acl);
324 return ret;
325 }
326
327 return -EAGAIN;
328} 313}
329 314
330int ocfs2_acl_chmod(struct inode *inode) 315int ocfs2_acl_chmod(struct inode *inode)
331{ 316{
332 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 317 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
333 struct posix_acl *acl, *clone; 318 struct posix_acl *acl;
334 int ret; 319 int ret;
335 320
336 if (S_ISLNK(inode->i_mode)) 321 if (S_ISLNK(inode->i_mode))
@@ -342,15 +327,12 @@ int ocfs2_acl_chmod(struct inode *inode)
342 acl = ocfs2_get_acl(inode, ACL_TYPE_ACCESS); 327 acl = ocfs2_get_acl(inode, ACL_TYPE_ACCESS);
343 if (IS_ERR(acl) || !acl) 328 if (IS_ERR(acl) || !acl)
344 return PTR_ERR(acl); 329 return PTR_ERR(acl);
345 clone = posix_acl_clone(acl, GFP_KERNEL); 330 ret = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
331 if (ret)
332 return ret;
333 ret = ocfs2_set_acl(NULL, inode, NULL, ACL_TYPE_ACCESS,
334 acl, NULL, NULL);
346 posix_acl_release(acl); 335 posix_acl_release(acl);
347 if (!clone)
348 return -ENOMEM;
349 ret = posix_acl_chmod_masq(clone, inode->i_mode);
350 if (!ret)
351 ret = ocfs2_set_acl(NULL, inode, NULL, ACL_TYPE_ACCESS,
352 clone, NULL, NULL);
353 posix_acl_release(clone);
354 return ret; 336 return ret;
355} 337}
356 338
@@ -369,7 +351,7 @@ int ocfs2_init_acl(handle_t *handle,
369 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 351 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
370 struct posix_acl *acl = NULL; 352 struct posix_acl *acl = NULL;
371 int ret = 0, ret2; 353 int ret = 0, ret2;
372 mode_t mode; 354 umode_t mode;
373 355
374 if (!S_ISLNK(inode->i_mode)) { 356 if (!S_ISLNK(inode->i_mode)) {
375 if (osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) { 357 if (osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) {
@@ -388,8 +370,6 @@ int ocfs2_init_acl(handle_t *handle,
388 } 370 }
389 } 371 }
390 if ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) && acl) { 372 if ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) && acl) {
391 struct posix_acl *clone;
392
393 if (S_ISDIR(inode->i_mode)) { 373 if (S_ISDIR(inode->i_mode)) {
394 ret = ocfs2_set_acl(handle, inode, di_bh, 374 ret = ocfs2_set_acl(handle, inode, di_bh,
395 ACL_TYPE_DEFAULT, acl, 375 ACL_TYPE_DEFAULT, acl,
@@ -397,27 +377,22 @@ int ocfs2_init_acl(handle_t *handle,
397 if (ret) 377 if (ret)
398 goto cleanup; 378 goto cleanup;
399 } 379 }
400 clone = posix_acl_clone(acl, GFP_NOFS);
401 ret = -ENOMEM;
402 if (!clone)
403 goto cleanup;
404
405 mode = inode->i_mode; 380 mode = inode->i_mode;
406 ret = posix_acl_create_masq(clone, &mode); 381 ret = posix_acl_create(&acl, GFP_NOFS, &mode);
407 if (ret >= 0) { 382 if (ret < 0)
408 ret2 = ocfs2_acl_set_mode(inode, di_bh, handle, mode); 383 return ret;
409 if (ret2) { 384
410 mlog_errno(ret2); 385 ret2 = ocfs2_acl_set_mode(inode, di_bh, handle, mode);
411 ret = ret2; 386 if (ret2) {
412 goto cleanup; 387 mlog_errno(ret2);
413 } 388 ret = ret2;
414 if (ret > 0) { 389 goto cleanup;
415 ret = ocfs2_set_acl(handle, inode, 390 }
416 di_bh, ACL_TYPE_ACCESS, 391 if (ret > 0) {
417 clone, meta_ac, data_ac); 392 ret = ocfs2_set_acl(handle, inode,
418 } 393 di_bh, ACL_TYPE_ACCESS,
394 acl, meta_ac, data_ac);
419 } 395 }
420 posix_acl_release(clone);
421 } 396 }
422cleanup: 397cleanup:
423 posix_acl_release(acl); 398 posix_acl_release(acl);
diff --git a/fs/ocfs2/acl.h b/fs/ocfs2/acl.h
index 5c5d31f05853..071fbd380f2f 100644
--- a/fs/ocfs2/acl.h
+++ b/fs/ocfs2/acl.h
@@ -26,7 +26,7 @@ struct ocfs2_acl_entry {
26 __le32 e_id; 26 __le32 e_id;
27}; 27};
28 28
29extern int ocfs2_check_acl(struct inode *, int); 29struct posix_acl *ocfs2_iop_get_acl(struct inode *inode, int type);
30extern int ocfs2_acl_chmod(struct inode *); 30extern int ocfs2_acl_chmod(struct inode *);
31extern int ocfs2_init_acl(handle_t *, struct inode *, struct inode *, 31extern int ocfs2_init_acl(handle_t *, struct inode *, struct inode *,
32 struct buffer_head *, struct buffer_head *, 32 struct buffer_head *, struct buffer_head *,
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index ae13d5ca7908..044e7b58d31c 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -59,6 +59,7 @@
59#include <linux/idr.h> 59#include <linux/idr.h>
60#include <linux/kref.h> 60#include <linux/kref.h>
61#include <linux/net.h> 61#include <linux/net.h>
62#include <linux/export.h>
62#include <net/tcp.h> 63#include <net/tcp.h>
63 64
64#include <asm/uaccess.h> 65#include <asm/uaccess.h>
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index 3302088e1f04..8fe4e2892ab9 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -2291,7 +2291,7 @@ static int ocfs2_fill_new_dir_id(struct ocfs2_super *osb,
2291 ocfs2_journal_dirty(handle, di_bh); 2291 ocfs2_journal_dirty(handle, di_bh);
2292 2292
2293 i_size_write(inode, size); 2293 i_size_write(inode, size);
2294 inode->i_nlink = 2; 2294 set_nlink(inode, 2);
2295 inode->i_blocks = ocfs2_inode_sector_count(inode); 2295 inode->i_blocks = ocfs2_inode_sector_count(inode);
2296 2296
2297 ret = ocfs2_mark_inode_dirty(handle, inode, di_bh); 2297 ret = ocfs2_mark_inode_dirty(handle, inode, di_bh);
@@ -2353,7 +2353,7 @@ static int ocfs2_fill_new_dir_el(struct ocfs2_super *osb,
2353 ocfs2_journal_dirty(handle, new_bh); 2353 ocfs2_journal_dirty(handle, new_bh);
2354 2354
2355 i_size_write(inode, inode->i_sb->s_blocksize); 2355 i_size_write(inode, inode->i_sb->s_blocksize);
2356 inode->i_nlink = 2; 2356 set_nlink(inode, 2);
2357 inode->i_blocks = ocfs2_inode_sector_count(inode); 2357 inode->i_blocks = ocfs2_inode_sector_count(inode);
2358 status = ocfs2_mark_inode_dirty(handle, inode, fe_bh); 2358 status = ocfs2_mark_inode_dirty(handle, inode, fe_bh);
2359 if (status < 0) { 2359 if (status < 0) {
diff --git a/fs/ocfs2/dlm/dlmdebug.c b/fs/ocfs2/dlm/dlmdebug.c
index 56f82cb912e3..0e28e242226d 100644
--- a/fs/ocfs2/dlm/dlmdebug.c
+++ b/fs/ocfs2/dlm/dlmdebug.c
@@ -30,6 +30,7 @@
30#include <linux/sysctl.h> 30#include <linux/sysctl.h>
31#include <linux/spinlock.h> 31#include <linux/spinlock.h>
32#include <linux/debugfs.h> 32#include <linux/debugfs.h>
33#include <linux/export.h>
33 34
34#include "cluster/heartbeat.h" 35#include "cluster/heartbeat.h"
35#include "cluster/nodemanager.h" 36#include "cluster/nodemanager.h"
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index da103f555a62..81a4cd22f80b 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -2098,7 +2098,7 @@ static void ocfs2_refresh_inode_from_lvb(struct inode *inode)
2098 inode->i_uid = be32_to_cpu(lvb->lvb_iuid); 2098 inode->i_uid = be32_to_cpu(lvb->lvb_iuid);
2099 inode->i_gid = be32_to_cpu(lvb->lvb_igid); 2099 inode->i_gid = be32_to_cpu(lvb->lvb_igid);
2100 inode->i_mode = be16_to_cpu(lvb->lvb_imode); 2100 inode->i_mode = be16_to_cpu(lvb->lvb_imode);
2101 inode->i_nlink = be16_to_cpu(lvb->lvb_inlink); 2101 set_nlink(inode, be16_to_cpu(lvb->lvb_inlink));
2102 ocfs2_unpack_timespec(&inode->i_atime, 2102 ocfs2_unpack_timespec(&inode->i_atime,
2103 be64_to_cpu(lvb->lvb_iatime_packed)); 2103 be64_to_cpu(lvb->lvb_iatime_packed));
2104 ocfs2_unpack_timespec(&inode->i_mtime, 2104 ocfs2_unpack_timespec(&inode->i_mtime,
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 09e3de57cdee..6e396683c3d4 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2692,14 +2692,14 @@ const struct inode_operations ocfs2_file_iops = {
2692 .listxattr = ocfs2_listxattr, 2692 .listxattr = ocfs2_listxattr,
2693 .removexattr = generic_removexattr, 2693 .removexattr = generic_removexattr,
2694 .fiemap = ocfs2_fiemap, 2694 .fiemap = ocfs2_fiemap,
2695 .check_acl = ocfs2_check_acl, 2695 .get_acl = ocfs2_iop_get_acl,
2696}; 2696};
2697 2697
2698const struct inode_operations ocfs2_special_file_iops = { 2698const struct inode_operations ocfs2_special_file_iops = {
2699 .setattr = ocfs2_setattr, 2699 .setattr = ocfs2_setattr,
2700 .getattr = ocfs2_getattr, 2700 .getattr = ocfs2_getattr,
2701 .permission = ocfs2_permission, 2701 .permission = ocfs2_permission,
2702 .check_acl = ocfs2_check_acl, 2702 .get_acl = ocfs2_iop_get_acl,
2703}; 2703};
2704 2704
2705/* 2705/*
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index c4bf6ac4a0bb..17454a904d7b 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -291,7 +291,7 @@ void ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
291 (unsigned long long)OCFS2_I(inode)->ip_blkno, 291 (unsigned long long)OCFS2_I(inode)->ip_blkno,
292 (unsigned long long)le64_to_cpu(fe->i_blkno)); 292 (unsigned long long)le64_to_cpu(fe->i_blkno));
293 293
294 inode->i_nlink = ocfs2_read_links_count(fe); 294 set_nlink(inode, ocfs2_read_links_count(fe));
295 295
296 trace_ocfs2_populate_inode(OCFS2_I(inode)->ip_blkno, 296 trace_ocfs2_populate_inode(OCFS2_I(inode)->ip_blkno,
297 le32_to_cpu(fe->i_flags)); 297 le32_to_cpu(fe->i_flags));
@@ -1290,7 +1290,7 @@ void ocfs2_refresh_inode(struct inode *inode,
1290 OCFS2_I(inode)->ip_dyn_features = le16_to_cpu(fe->i_dyn_features); 1290 OCFS2_I(inode)->ip_dyn_features = le16_to_cpu(fe->i_dyn_features);
1291 ocfs2_set_inode_flags(inode); 1291 ocfs2_set_inode_flags(inode);
1292 i_size_write(inode, le64_to_cpu(fe->i_size)); 1292 i_size_write(inode, le64_to_cpu(fe->i_size));
1293 inode->i_nlink = ocfs2_read_links_count(fe); 1293 set_nlink(inode, ocfs2_read_links_count(fe));
1294 inode->i_uid = le32_to_cpu(fe->i_uid); 1294 inode->i_uid = le32_to_cpu(fe->i_uid);
1295 inode->i_gid = le32_to_cpu(fe->i_gid); 1295 inode->i_gid = le32_to_cpu(fe->i_gid);
1296 inode->i_mode = le16_to_cpu(fe->i_mode); 1296 inode->i_mode = le16_to_cpu(fe->i_mode);
diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c
index d3433d60dbb9..184c76b8c293 100644
--- a/fs/ocfs2/move_extents.c
+++ b/fs/ocfs2/move_extents.c
@@ -36,7 +36,6 @@
36#include "dir.h" 36#include "dir.h"
37#include "buffer_head_io.h" 37#include "buffer_head_io.h"
38#include "sysfile.h" 38#include "sysfile.h"
39#include "suballoc.h"
40#include "refcounttree.h" 39#include "refcounttree.h"
41#include "move_extents.h" 40#include "move_extents.h"
42 41
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 33889dc52dd7..a8b2bfea574e 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -199,9 +199,7 @@ static struct inode *ocfs2_get_init_inode(struct inode *dir, int mode)
199 * these are used by the support functions here and in 199 * these are used by the support functions here and in
200 * callers. */ 200 * callers. */
201 if (S_ISDIR(mode)) 201 if (S_ISDIR(mode))
202 inode->i_nlink = 2; 202 set_nlink(inode, 2);
203 else
204 inode->i_nlink = 1;
205 inode_init_owner(inode, dir, mode); 203 inode_init_owner(inode, dir, mode);
206 dquot_initialize(inode); 204 dquot_initialize(inode);
207 return inode; 205 return inode;
@@ -1379,7 +1377,7 @@ static int ocfs2_rename(struct inode *old_dir,
1379 } 1377 }
1380 1378
1381 if (new_inode) { 1379 if (new_inode) {
1382 new_inode->i_nlink--; 1380 drop_nlink(new_inode);
1383 new_inode->i_ctime = CURRENT_TIME; 1381 new_inode->i_ctime = CURRENT_TIME;
1384 } 1382 }
1385 old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME; 1383 old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME;
@@ -1387,9 +1385,9 @@ static int ocfs2_rename(struct inode *old_dir,
1387 if (update_dot_dot) { 1385 if (update_dot_dot) {
1388 status = ocfs2_update_entry(old_inode, handle, 1386 status = ocfs2_update_entry(old_inode, handle,
1389 &old_inode_dot_dot_res, new_dir); 1387 &old_inode_dot_dot_res, new_dir);
1390 old_dir->i_nlink--; 1388 drop_nlink(old_dir);
1391 if (new_inode) { 1389 if (new_inode) {
1392 new_inode->i_nlink--; 1390 drop_nlink(new_inode);
1393 } else { 1391 } else {
1394 inc_nlink(new_dir); 1392 inc_nlink(new_dir);
1395 mark_inode_dirty(new_dir); 1393 mark_inode_dirty(new_dir);
@@ -2018,7 +2016,7 @@ static int ocfs2_orphan_add(struct ocfs2_super *osb,
2018 orphan_fe = (struct ocfs2_dinode *) orphan_dir_bh->b_data; 2016 orphan_fe = (struct ocfs2_dinode *) orphan_dir_bh->b_data;
2019 if (S_ISDIR(inode->i_mode)) 2017 if (S_ISDIR(inode->i_mode))
2020 ocfs2_add_links_count(orphan_fe, 1); 2018 ocfs2_add_links_count(orphan_fe, 1);
2021 orphan_dir_inode->i_nlink = ocfs2_read_links_count(orphan_fe); 2019 set_nlink(orphan_dir_inode, ocfs2_read_links_count(orphan_fe));
2022 ocfs2_journal_dirty(handle, orphan_dir_bh); 2020 ocfs2_journal_dirty(handle, orphan_dir_bh);
2023 2021
2024 status = __ocfs2_add_entry(handle, orphan_dir_inode, name, 2022 status = __ocfs2_add_entry(handle, orphan_dir_inode, name,
@@ -2116,7 +2114,7 @@ int ocfs2_orphan_del(struct ocfs2_super *osb,
2116 orphan_fe = (struct ocfs2_dinode *) orphan_dir_bh->b_data; 2114 orphan_fe = (struct ocfs2_dinode *) orphan_dir_bh->b_data;
2117 if (S_ISDIR(inode->i_mode)) 2115 if (S_ISDIR(inode->i_mode))
2118 ocfs2_add_links_count(orphan_fe, -1); 2116 ocfs2_add_links_count(orphan_fe, -1);
2119 orphan_dir_inode->i_nlink = ocfs2_read_links_count(orphan_fe); 2117 set_nlink(orphan_dir_inode, ocfs2_read_links_count(orphan_fe));
2120 ocfs2_journal_dirty(handle, orphan_dir_bh); 2118 ocfs2_journal_dirty(handle, orphan_dir_bh);
2121 2119
2122leave: 2120leave:
@@ -2282,7 +2280,7 @@ int ocfs2_create_inode_in_orphan(struct inode *dir,
2282 goto leave; 2280 goto leave;
2283 } 2281 }
2284 2282
2285 inode->i_nlink = 0; 2283 clear_nlink(inode);
2286 /* do the real work now. */ 2284 /* do the real work now. */
2287 status = __ocfs2_mknod_locked(dir, inode, 2285 status = __ocfs2_mknod_locked(dir, inode,
2288 0, &new_di_bh, parent_di_bh, handle, 2286 0, &new_di_bh, parent_di_bh, handle,
@@ -2437,7 +2435,7 @@ int ocfs2_mv_orphaned_inode_to_new(struct inode *dir,
2437 di = (struct ocfs2_dinode *)di_bh->b_data; 2435 di = (struct ocfs2_dinode *)di_bh->b_data;
2438 le32_add_cpu(&di->i_flags, -OCFS2_ORPHANED_FL); 2436 le32_add_cpu(&di->i_flags, -OCFS2_ORPHANED_FL);
2439 di->i_orphaned_slot = 0; 2437 di->i_orphaned_slot = 0;
2440 inode->i_nlink = 1; 2438 set_nlink(inode, 1);
2441 ocfs2_set_links_count(di, inode->i_nlink); 2439 ocfs2_set_links_count(di, inode->i_nlink);
2442 ocfs2_journal_dirty(handle, di_bh); 2440 ocfs2_journal_dirty(handle, di_bh);
2443 2441
@@ -2498,5 +2496,5 @@ const struct inode_operations ocfs2_dir_iops = {
2498 .listxattr = ocfs2_listxattr, 2496 .listxattr = ocfs2_listxattr,
2499 .removexattr = generic_removexattr, 2497 .removexattr = generic_removexattr,
2500 .fiemap = ocfs2_fiemap, 2498 .fiemap = ocfs2_fiemap,
2501 .check_acl = ocfs2_check_acl, 2499 .get_acl = ocfs2_iop_get_acl,
2502}; 2500};
diff --git a/fs/ocfs2/super.h b/fs/ocfs2/super.h
index 40c7de084c10..74ff74cf78fe 100644
--- a/fs/ocfs2/super.h
+++ b/fs/ocfs2/super.h
@@ -31,17 +31,15 @@ extern struct workqueue_struct *ocfs2_wq;
31int ocfs2_publish_get_mount_state(struct ocfs2_super *osb, 31int ocfs2_publish_get_mount_state(struct ocfs2_super *osb,
32 int node_num); 32 int node_num);
33 33
34void __ocfs2_error(struct super_block *sb, 34__printf(3, 4)
35 const char *function, 35void __ocfs2_error(struct super_block *sb, const char *function,
36 const char *fmt, ...) 36 const char *fmt, ...);
37 __attribute__ ((format (printf, 3, 4)));
38 37
39#define ocfs2_error(sb, fmt, args...) __ocfs2_error(sb, __PRETTY_FUNCTION__, fmt, ##args) 38#define ocfs2_error(sb, fmt, args...) __ocfs2_error(sb, __PRETTY_FUNCTION__, fmt, ##args)
40 39
41void __ocfs2_abort(struct super_block *sb, 40__printf(3, 4)
42 const char *function, 41void __ocfs2_abort(struct super_block *sb, const char *function,
43 const char *fmt, ...) 42 const char *fmt, ...);
44 __attribute__ ((format (printf, 3, 4)));
45 43
46#define ocfs2_abort(sb, fmt, args...) __ocfs2_abort(sb, __PRETTY_FUNCTION__, fmt, ##args) 44#define ocfs2_abort(sb, fmt, args...) __ocfs2_abort(sb, __PRETTY_FUNCTION__, fmt, ##args)
47 45
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 93d6c80b3922..aa9e8777b09a 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -7187,20 +7187,9 @@ int ocfs2_init_security_and_acl(struct inode *dir,
7187{ 7187{
7188 int ret = 0; 7188 int ret = 0;
7189 struct buffer_head *dir_bh = NULL; 7189 struct buffer_head *dir_bh = NULL;
7190 struct ocfs2_security_xattr_info si = {
7191 .enable = 1,
7192 };
7193 7190
7194 ret = ocfs2_init_security_get(inode, dir, qstr, &si); 7191 ret = ocfs2_init_security_get(inode, dir, qstr, NULL);
7195 if (!ret) { 7192 if (!ret) {
7196 ret = ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_SECURITY,
7197 si.name, si.value, si.value_len,
7198 XATTR_CREATE);
7199 if (ret) {
7200 mlog_errno(ret);
7201 goto leave;
7202 }
7203 } else if (ret != -EOPNOTSUPP) {
7204 mlog_errno(ret); 7193 mlog_errno(ret);
7205 goto leave; 7194 goto leave;
7206 } 7195 }
@@ -7257,6 +7246,22 @@ static int ocfs2_xattr_security_set(struct dentry *dentry, const char *name,
7257 name, value, size, flags); 7246 name, value, size, flags);
7258} 7247}
7259 7248
7249int ocfs2_initxattrs(struct inode *inode, const struct xattr *xattr_array,
7250 void *fs_info)
7251{
7252 const struct xattr *xattr;
7253 int err = 0;
7254
7255 for (xattr = xattr_array; xattr->name != NULL; xattr++) {
7256 err = ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_SECURITY,
7257 xattr->name, xattr->value,
7258 xattr->value_len, XATTR_CREATE);
7259 if (err)
7260 break;
7261 }
7262 return err;
7263}
7264
7260int ocfs2_init_security_get(struct inode *inode, 7265int ocfs2_init_security_get(struct inode *inode,
7261 struct inode *dir, 7266 struct inode *dir,
7262 const struct qstr *qstr, 7267 const struct qstr *qstr,
@@ -7265,8 +7270,13 @@ int ocfs2_init_security_get(struct inode *inode,
7265 /* check whether ocfs2 support feature xattr */ 7270 /* check whether ocfs2 support feature xattr */
7266 if (!ocfs2_supports_xattr(OCFS2_SB(dir->i_sb))) 7271 if (!ocfs2_supports_xattr(OCFS2_SB(dir->i_sb)))
7267 return -EOPNOTSUPP; 7272 return -EOPNOTSUPP;
7268 return security_inode_init_security(inode, dir, qstr, &si->name, 7273 if (si)
7269 &si->value, &si->value_len); 7274 return security_old_inode_init_security(inode, dir, qstr,
7275 &si->name, &si->value,
7276 &si->value_len);
7277
7278 return security_inode_init_security(inode, dir, qstr,
7279 &ocfs2_initxattrs, NULL);
7270} 7280}
7271 7281
7272int ocfs2_init_security_set(handle_t *handle, 7282int ocfs2_init_security_set(handle_t *handle,