acl.c (5ee0fbd50fdf1c1329de8bee35ea9d7c6a81a2e0) | acl.c (c25a1e0671fbca7b2c0d0757d533bd2650d6dc0c) |
---|---|
1/* -*- mode: c; c-basic-offset: 8; -*- 2 * vim: noexpandtab sw=8 ts=8 sts=0: 3 * 4 * acl.c 5 * 6 * Copyright (C) 2004, 2008 Oracle. All rights reserved. 7 * 8 * CREDITS: --- 332 unchanged lines hidden (view full) --- 341 ret = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); 342 if (ret) 343 return ret; 344 ret = ocfs2_set_acl(NULL, inode, NULL, ACL_TYPE_ACCESS, 345 acl, NULL, NULL); 346 posix_acl_release(acl); 347 return ret; 348} | 1/* -*- mode: c; c-basic-offset: 8; -*- 2 * vim: noexpandtab sw=8 ts=8 sts=0: 3 * 4 * acl.c 5 * 6 * Copyright (C) 2004, 2008 Oracle. All rights reserved. 7 * 8 * CREDITS: --- 332 unchanged lines hidden (view full) --- 341 ret = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); 342 if (ret) 343 return ret; 344 ret = ocfs2_set_acl(NULL, inode, NULL, ACL_TYPE_ACCESS, 345 acl, NULL, NULL); 346 posix_acl_release(acl); 347 return ret; 348} |
349 350/* 351 * Initialize the ACLs of a new inode. If parent directory has default ACL, 352 * then clone to new inode. Called from ocfs2_mknod. 353 */ 354int ocfs2_init_acl(handle_t *handle, 355 struct inode *inode, 356 struct inode *dir, 357 struct buffer_head *di_bh, 358 struct buffer_head *dir_bh, 359 struct ocfs2_alloc_context *meta_ac, 360 struct ocfs2_alloc_context *data_ac) 361{ 362 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 363 struct posix_acl *acl = NULL; 364 int ret = 0, ret2; 365 umode_t mode; 366 367 if (!S_ISLNK(inode->i_mode)) { 368 if (osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) { 369 acl = ocfs2_get_acl_nolock(dir, ACL_TYPE_DEFAULT, 370 dir_bh); 371 if (IS_ERR(acl)) 372 return PTR_ERR(acl); 373 } 374 if (!acl) { 375 mode = inode->i_mode & ~current_umask(); 376 ret = ocfs2_acl_set_mode(inode, di_bh, handle, mode); 377 if (ret) { 378 mlog_errno(ret); 379 goto cleanup; 380 } 381 } 382 } 383 if ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) && acl) { 384 if (S_ISDIR(inode->i_mode)) { 385 ret = ocfs2_set_acl(handle, inode, di_bh, 386 ACL_TYPE_DEFAULT, acl, 387 meta_ac, data_ac); 388 if (ret) 389 goto cleanup; 390 } 391 mode = inode->i_mode; 392 ret = __posix_acl_create(&acl, GFP_NOFS, &mode); 393 if (ret < 0) 394 return ret; 395 396 ret2 = ocfs2_acl_set_mode(inode, di_bh, handle, mode); 397 if (ret2) { 398 mlog_errno(ret2); 399 ret = ret2; 400 goto cleanup; 401 } 402 if (ret > 0) { 403 ret = ocfs2_set_acl(handle, inode, 404 di_bh, ACL_TYPE_ACCESS, 405 acl, meta_ac, data_ac); 406 } 407 } 408cleanup: 409 posix_acl_release(acl); 410 return ret; 411} |
|