aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_attr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_attr.c')
-rw-r--r--fs/xfs/xfs_attr.c29
1 files changed, 3 insertions, 26 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c
index 5484eeb460c8..1a11c2b51701 100644
--- a/fs/xfs/xfs_attr.c
+++ b/fs/xfs/xfs_attr.c
@@ -117,11 +117,6 @@ xfs_attr_fetch(xfs_inode_t *ip, const char *name, int namelen,
117 ip->i_d.di_anextents == 0)) 117 ip->i_d.di_anextents == 0))
118 return(ENOATTR); 118 return(ENOATTR);
119 119
120 if (!(flags & (ATTR_KERNACCESS|ATTR_SECURE))) {
121 if ((error = xfs_iaccess(ip, S_IRUSR, cred)))
122 return(XFS_ERROR(error));
123 }
124
125 /* 120 /*
126 * Fill in the arg structure for this request. 121 * Fill in the arg structure for this request.
127 */ 122 */
@@ -425,7 +420,7 @@ xfs_attr_set(bhv_desc_t *bdp, const char *name, char *value, int valuelen, int f
425 struct cred *cred) 420 struct cred *cred)
426{ 421{
427 xfs_inode_t *dp; 422 xfs_inode_t *dp;
428 int namelen, error; 423 int namelen;
429 424
430 namelen = strlen(name); 425 namelen = strlen(name);
431 if (namelen >= MAXNAMELEN) 426 if (namelen >= MAXNAMELEN)
@@ -437,14 +432,6 @@ xfs_attr_set(bhv_desc_t *bdp, const char *name, char *value, int valuelen, int f
437 if (XFS_FORCED_SHUTDOWN(dp->i_mount)) 432 if (XFS_FORCED_SHUTDOWN(dp->i_mount))
438 return (EIO); 433 return (EIO);
439 434
440 xfs_ilock(dp, XFS_ILOCK_SHARED);
441 if (!(flags & ATTR_SECURE) &&
442 (error = xfs_iaccess(dp, S_IWUSR, cred))) {
443 xfs_iunlock(dp, XFS_ILOCK_SHARED);
444 return(XFS_ERROR(error));
445 }
446 xfs_iunlock(dp, XFS_ILOCK_SHARED);
447
448 return xfs_attr_set_int(dp, name, namelen, value, valuelen, flags); 435 return xfs_attr_set_int(dp, name, namelen, value, valuelen, flags);
449} 436}
450 437
@@ -579,7 +566,7 @@ int
579xfs_attr_remove(bhv_desc_t *bdp, const char *name, int flags, struct cred *cred) 566xfs_attr_remove(bhv_desc_t *bdp, const char *name, int flags, struct cred *cred)
580{ 567{
581 xfs_inode_t *dp; 568 xfs_inode_t *dp;
582 int namelen, error; 569 int namelen;
583 570
584 namelen = strlen(name); 571 namelen = strlen(name);
585 if (namelen >= MAXNAMELEN) 572 if (namelen >= MAXNAMELEN)
@@ -592,11 +579,7 @@ xfs_attr_remove(bhv_desc_t *bdp, const char *name, int flags, struct cred *cred)
592 return (EIO); 579 return (EIO);
593 580
594 xfs_ilock(dp, XFS_ILOCK_SHARED); 581 xfs_ilock(dp, XFS_ILOCK_SHARED);
595 if (!(flags & ATTR_SECURE) && 582 if (XFS_IFORK_Q(dp) == 0 ||
596 (error = xfs_iaccess(dp, S_IWUSR, cred))) {
597 xfs_iunlock(dp, XFS_ILOCK_SHARED);
598 return(XFS_ERROR(error));
599 } else if (XFS_IFORK_Q(dp) == 0 ||
600 (dp->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS && 583 (dp->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS &&
601 dp->i_d.di_anextents == 0)) { 584 dp->i_d.di_anextents == 0)) {
602 xfs_iunlock(dp, XFS_ILOCK_SHARED); 585 xfs_iunlock(dp, XFS_ILOCK_SHARED);
@@ -668,12 +651,6 @@ xfs_attr_list(bhv_desc_t *bdp, char *buffer, int bufsize, int flags,
668 return (EIO); 651 return (EIO);
669 652
670 xfs_ilock(dp, XFS_ILOCK_SHARED); 653 xfs_ilock(dp, XFS_ILOCK_SHARED);
671 if (!(flags & ATTR_SECURE) &&
672 (error = xfs_iaccess(dp, S_IRUSR, cred))) {
673 xfs_iunlock(dp, XFS_ILOCK_SHARED);
674 return(XFS_ERROR(error));
675 }
676
677 /* 654 /*
678 * Decide on what work routines to call based on the inode size. 655 * Decide on what work routines to call based on the inode size.
679 */ 656 */