aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c23
-rw-r--r--fs/xfs/xfs_acl.c4
-rw-r--r--fs/xfs/xfs_acl.h6
-rw-r--r--fs/xfs/xfs_vnodeops.c33
-rw-r--r--fs/xfs/xfs_vnodeops.h10
5 files changed, 29 insertions, 47 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 59ba1dc65fa6..9c4d99709705 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -271,7 +271,6 @@ xfs_vn_mknod(
271 dev_t rdev) 271 dev_t rdev)
272{ 272{
273 struct inode *ip; 273 struct inode *ip;
274 bhv_vattr_t vattr = { 0 };
275 bhv_vnode_t *vp = NULL, *dvp = vn_from_inode(dir); 274 bhv_vnode_t *vp = NULL, *dvp = vn_from_inode(dir);
276 xfs_acl_t *default_acl = NULL; 275 xfs_acl_t *default_acl = NULL;
277 attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS; 276 attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS;
@@ -297,19 +296,14 @@ xfs_vn_mknod(
297 if (IS_POSIXACL(dir) && !default_acl && xfs_has_fs_struct(current)) 296 if (IS_POSIXACL(dir) && !default_acl && xfs_has_fs_struct(current))
298 mode &= ~current->fs->umask; 297 mode &= ~current->fs->umask;
299 298
300 vattr.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
301 vattr.va_mode = mode;
302
303 switch (mode & S_IFMT) { 299 switch (mode & S_IFMT) {
304 case S_IFCHR: case S_IFBLK: case S_IFIFO: case S_IFSOCK: 300 case S_IFCHR: case S_IFBLK: case S_IFIFO: case S_IFSOCK:
305 vattr.va_rdev = sysv_encode_dev(rdev); 301 rdev = sysv_encode_dev(rdev);
306 vattr.va_mask |= XFS_AT_RDEV;
307 /*FALLTHROUGH*/
308 case S_IFREG: 302 case S_IFREG:
309 error = xfs_create(XFS_I(dir), dentry, &vattr, &vp, NULL); 303 error = xfs_create(XFS_I(dir), dentry, mode, rdev, &vp, NULL);
310 break; 304 break;
311 case S_IFDIR: 305 case S_IFDIR:
312 error = xfs_mkdir(XFS_I(dir), dentry, &vattr, &vp, NULL); 306 error = xfs_mkdir(XFS_I(dir), dentry, mode, &vp, NULL);
313 break; 307 break;
314 default: 308 default:
315 error = EINVAL; 309 error = EINVAL;
@@ -324,7 +318,7 @@ xfs_vn_mknod(
324 318
325 if (unlikely(default_acl)) { 319 if (unlikely(default_acl)) {
326 if (!error) { 320 if (!error) {
327 error = _ACL_INHERIT(vp, &vattr, default_acl); 321 error = _ACL_INHERIT(vp, mode, default_acl);
328 if (!error) 322 if (!error)
329 xfs_iflags_set(XFS_I(vp), XFS_IMODIFIED); 323 xfs_iflags_set(XFS_I(vp), XFS_IMODIFIED);
330 else 324 else
@@ -441,18 +435,17 @@ xfs_vn_symlink(
441 const char *symname) 435 const char *symname)
442{ 436{
443 struct inode *ip; 437 struct inode *ip;
444 bhv_vattr_t va = { 0 };
445 bhv_vnode_t *cvp; /* used to lookup symlink to put in dentry */ 438 bhv_vnode_t *cvp; /* used to lookup symlink to put in dentry */
446 int error; 439 int error;
440 mode_t mode;
447 441
448 cvp = NULL; 442 cvp = NULL;
449 443
450 va.va_mode = S_IFLNK | 444 mode = S_IFLNK |
451 (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO); 445 (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO);
452 va.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
453 446
454 error = xfs_symlink(XFS_I(dir), dentry, &va, 447 error = xfs_symlink(XFS_I(dir), dentry, (char *)symname, mode,
455 (char *)symname, &cvp, NULL); 448 &cvp, NULL);
456 if (likely(!error && cvp)) { 449 if (likely(!error && cvp)) {
457 error = xfs_init_security(cvp, dir); 450 error = xfs_init_security(cvp, dir);
458 if (likely(!error)) { 451 if (likely(!error)) {
diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c
index 1b440f37371c..5bfb66f33caf 100644
--- a/fs/xfs/xfs_acl.c
+++ b/fs/xfs/xfs_acl.c
@@ -704,7 +704,7 @@ xfs_acl_vtoacl(
704int 704int
705xfs_acl_inherit( 705xfs_acl_inherit(
706 bhv_vnode_t *vp, 706 bhv_vnode_t *vp,
707 bhv_vattr_t *vap, 707 mode_t mode,
708 xfs_acl_t *pdaclp) 708 xfs_acl_t *pdaclp)
709{ 709{
710 xfs_acl_t *cacl; 710 xfs_acl_t *cacl;
@@ -732,7 +732,7 @@ xfs_acl_inherit(
732 return ENOMEM; 732 return ENOMEM;
733 733
734 memcpy(cacl, pdaclp, sizeof(xfs_acl_t)); 734 memcpy(cacl, pdaclp, sizeof(xfs_acl_t));
735 xfs_acl_filter_mode(vap->va_mode, cacl); 735 xfs_acl_filter_mode(mode, cacl);
736 xfs_acl_setmode(vp, cacl, &basicperms); 736 xfs_acl_setmode(vp, cacl, &basicperms);
737 737
738 /* 738 /*
diff --git a/fs/xfs/xfs_acl.h b/fs/xfs/xfs_acl.h
index ab290daff6a8..34b7d3391299 100644
--- a/fs/xfs/xfs_acl.h
+++ b/fs/xfs/xfs_acl.h
@@ -57,7 +57,7 @@ extern struct kmem_zone *xfs_acl_zone;
57 (zone) = kmem_zone_init(sizeof(xfs_acl_t), (name)) 57 (zone) = kmem_zone_init(sizeof(xfs_acl_t), (name))
58#define xfs_acl_zone_destroy(zone) kmem_zone_destroy(zone) 58#define xfs_acl_zone_destroy(zone) kmem_zone_destroy(zone)
59 59
60extern int xfs_acl_inherit(bhv_vnode_t *, struct bhv_vattr *, xfs_acl_t *); 60extern int xfs_acl_inherit(bhv_vnode_t *, mode_t mode, xfs_acl_t *);
61extern int xfs_acl_iaccess(struct xfs_inode *, mode_t, cred_t *); 61extern int xfs_acl_iaccess(struct xfs_inode *, mode_t, cred_t *);
62extern int xfs_acl_vtoacl(bhv_vnode_t *, xfs_acl_t *, xfs_acl_t *); 62extern int xfs_acl_vtoacl(bhv_vnode_t *, xfs_acl_t *, xfs_acl_t *);
63extern int xfs_acl_vhasacl_access(bhv_vnode_t *); 63extern int xfs_acl_vhasacl_access(bhv_vnode_t *);
@@ -70,7 +70,7 @@ extern int xfs_acl_vremove(bhv_vnode_t *, int);
70#define _ACL_TYPE_DEFAULT 2 70#define _ACL_TYPE_DEFAULT 2
71#define _ACL_PERM_INVALID(perm) ((perm) & ~(ACL_READ|ACL_WRITE|ACL_EXECUTE)) 71#define _ACL_PERM_INVALID(perm) ((perm) & ~(ACL_READ|ACL_WRITE|ACL_EXECUTE))
72 72
73#define _ACL_INHERIT(c,v,d) (xfs_acl_inherit(c,v,d)) 73#define _ACL_INHERIT(c,m,d) (xfs_acl_inherit(c,m,d))
74#define _ACL_GET_ACCESS(pv,pa) (xfs_acl_vtoacl(pv,pa,NULL) == 0) 74#define _ACL_GET_ACCESS(pv,pa) (xfs_acl_vtoacl(pv,pa,NULL) == 0)
75#define _ACL_GET_DEFAULT(pv,pd) (xfs_acl_vtoacl(pv,NULL,pd) == 0) 75#define _ACL_GET_DEFAULT(pv,pd) (xfs_acl_vtoacl(pv,NULL,pd) == 0)
76#define _ACL_ACCESS_EXISTS xfs_acl_vhasacl_access 76#define _ACL_ACCESS_EXISTS xfs_acl_vhasacl_access
@@ -90,7 +90,7 @@ extern int xfs_acl_vremove(bhv_vnode_t *, int);
90#define xfs_acl_vhasacl_default(v) (0) 90#define xfs_acl_vhasacl_default(v) (0)
91#define _ACL_ALLOC(a) (1) /* successfully allocate nothing */ 91#define _ACL_ALLOC(a) (1) /* successfully allocate nothing */
92#define _ACL_FREE(a) ((void)0) 92#define _ACL_FREE(a) ((void)0)
93#define _ACL_INHERIT(c,v,d) (0) 93#define _ACL_INHERIT(c,m,d) (0)
94#define _ACL_GET_ACCESS(pv,pa) (0) 94#define _ACL_GET_ACCESS(pv,pa) (0)
95#define _ACL_GET_DEFAULT(pv,pd) (0) 95#define _ACL_GET_DEFAULT(pv,pd) (0)
96#define _ACL_ACCESS_EXISTS (NULL) 96#define _ACL_ACCESS_EXISTS (NULL)
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 83cc1cb4089a..5e3c57ca9981 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -1824,7 +1824,8 @@ int
1824xfs_create( 1824xfs_create(
1825 xfs_inode_t *dp, 1825 xfs_inode_t *dp,
1826 bhv_vname_t *dentry, 1826 bhv_vname_t *dentry,
1827 bhv_vattr_t *vap, 1827 mode_t mode,
1828 xfs_dev_t rdev,
1828 bhv_vnode_t **vpp, 1829 bhv_vnode_t **vpp,
1829 cred_t *credp) 1830 cred_t *credp)
1830{ 1831{
@@ -1834,7 +1835,6 @@ xfs_create(
1834 xfs_inode_t *ip; 1835 xfs_inode_t *ip;
1835 bhv_vnode_t *vp = NULL; 1836 bhv_vnode_t *vp = NULL;
1836 xfs_trans_t *tp; 1837 xfs_trans_t *tp;
1837 xfs_dev_t rdev;
1838 int error; 1838 int error;
1839 xfs_bmap_free_t free_list; 1839 xfs_bmap_free_t free_list;
1840 xfs_fsblock_t first_block; 1840 xfs_fsblock_t first_block;
@@ -1845,20 +1845,18 @@ xfs_create(
1845 xfs_prid_t prid; 1845 xfs_prid_t prid;
1846 struct xfs_dquot *udqp, *gdqp; 1846 struct xfs_dquot *udqp, *gdqp;
1847 uint resblks; 1847 uint resblks;
1848 int dm_di_mode;
1849 int namelen; 1848 int namelen;
1850 1849
1851 ASSERT(!*vpp); 1850 ASSERT(!*vpp);
1852 vn_trace_entry(dp, __FUNCTION__, (inst_t *)__return_address); 1851 vn_trace_entry(dp, __FUNCTION__, (inst_t *)__return_address);
1853 1852
1854 dm_di_mode = vap->va_mode;
1855 namelen = VNAMELEN(dentry); 1853 namelen = VNAMELEN(dentry);
1856 1854
1857 if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) { 1855 if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) {
1858 error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE, 1856 error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE,
1859 dir_vp, DM_RIGHT_NULL, NULL, 1857 dir_vp, DM_RIGHT_NULL, NULL,
1860 DM_RIGHT_NULL, name, NULL, 1858 DM_RIGHT_NULL, name, NULL,
1861 dm_di_mode, 0, 0); 1859 mode, 0, 0);
1862 1860
1863 if (error) 1861 if (error)
1864 return error; 1862 return error;
@@ -1873,8 +1871,6 @@ xfs_create(
1873 udqp = gdqp = NULL; 1871 udqp = gdqp = NULL;
1874 if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) 1872 if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
1875 prid = dp->i_d.di_projid; 1873 prid = dp->i_d.di_projid;
1876 else if (vap->va_mask & XFS_AT_PROJID)
1877 prid = (xfs_prid_t)vap->va_projid;
1878 else 1874 else
1879 prid = (xfs_prid_t)dfltprid; 1875 prid = (xfs_prid_t)dfltprid;
1880 1876
@@ -1926,8 +1922,7 @@ xfs_create(
1926 1922
1927 if (resblks == 0 && (error = xfs_dir_canenter(tp, dp, name, namelen))) 1923 if (resblks == 0 && (error = xfs_dir_canenter(tp, dp, name, namelen)))
1928 goto error_return; 1924 goto error_return;
1929 rdev = (vap->va_mask & XFS_AT_RDEV) ? vap->va_rdev : 0; 1925 error = xfs_dir_ialloc(&tp, dp, mode, 1,
1930 error = xfs_dir_ialloc(&tp, dp, vap->va_mode, 1,
1931 rdev, credp, prid, resblks > 0, 1926 rdev, credp, prid, resblks > 0,
1932 &ip, &committed); 1927 &ip, &committed);
1933 if (error) { 1928 if (error) {
@@ -2018,7 +2013,7 @@ std_return:
2018 dir_vp, DM_RIGHT_NULL, 2013 dir_vp, DM_RIGHT_NULL,
2019 *vpp ? vp:NULL, 2014 *vpp ? vp:NULL,
2020 DM_RIGHT_NULL, name, NULL, 2015 DM_RIGHT_NULL, name, NULL,
2021 dm_di_mode, error, 0); 2016 mode, error, 0);
2022 } 2017 }
2023 return error; 2018 return error;
2024 2019
@@ -2709,7 +2704,7 @@ int
2709xfs_mkdir( 2704xfs_mkdir(
2710 xfs_inode_t *dp, 2705 xfs_inode_t *dp,
2711 bhv_vname_t *dentry, 2706 bhv_vname_t *dentry,
2712 bhv_vattr_t *vap, 2707 mode_t mode,
2713 bhv_vnode_t **vpp, 2708 bhv_vnode_t **vpp,
2714 cred_t *credp) 2709 cred_t *credp)
2715{ 2710{
@@ -2731,19 +2726,17 @@ xfs_mkdir(
2731 xfs_prid_t prid; 2726 xfs_prid_t prid;
2732 struct xfs_dquot *udqp, *gdqp; 2727 struct xfs_dquot *udqp, *gdqp;
2733 uint resblks; 2728 uint resblks;
2734 int dm_di_mode;
2735 2729
2736 if (XFS_FORCED_SHUTDOWN(mp)) 2730 if (XFS_FORCED_SHUTDOWN(mp))
2737 return XFS_ERROR(EIO); 2731 return XFS_ERROR(EIO);
2738 2732
2739 tp = NULL; 2733 tp = NULL;
2740 dm_di_mode = vap->va_mode;
2741 2734
2742 if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) { 2735 if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) {
2743 error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE, 2736 error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE,
2744 dir_vp, DM_RIGHT_NULL, NULL, 2737 dir_vp, DM_RIGHT_NULL, NULL,
2745 DM_RIGHT_NULL, dir_name, NULL, 2738 DM_RIGHT_NULL, dir_name, NULL,
2746 dm_di_mode, 0, 0); 2739 mode, 0, 0);
2747 if (error) 2740 if (error)
2748 return error; 2741 return error;
2749 dm_event_sent = 1; 2742 dm_event_sent = 1;
@@ -2757,8 +2750,6 @@ xfs_mkdir(
2757 udqp = gdqp = NULL; 2750 udqp = gdqp = NULL;
2758 if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) 2751 if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
2759 prid = dp->i_d.di_projid; 2752 prid = dp->i_d.di_projid;
2760 else if (vap->va_mask & XFS_AT_PROJID)
2761 prid = (xfs_prid_t)vap->va_projid;
2762 else 2753 else
2763 prid = (xfs_prid_t)dfltprid; 2754 prid = (xfs_prid_t)dfltprid;
2764 2755
@@ -2811,7 +2802,7 @@ xfs_mkdir(
2811 /* 2802 /*
2812 * create the directory inode. 2803 * create the directory inode.
2813 */ 2804 */
2814 error = xfs_dir_ialloc(&tp, dp, vap->va_mode, 2, 2805 error = xfs_dir_ialloc(&tp, dp, mode, 2,
2815 0, credp, prid, resblks > 0, 2806 0, credp, prid, resblks > 0,
2816 &cdp, NULL); 2807 &cdp, NULL);
2817 if (error) { 2808 if (error) {
@@ -2905,7 +2896,7 @@ std_return:
2905 created ? XFS_ITOV(cdp):NULL, 2896 created ? XFS_ITOV(cdp):NULL,
2906 DM_RIGHT_NULL, 2897 DM_RIGHT_NULL,
2907 dir_name, NULL, 2898 dir_name, NULL,
2908 dm_di_mode, error, 0); 2899 mode, error, 0);
2909 } 2900 }
2910 return error; 2901 return error;
2911 2902
@@ -3162,8 +3153,8 @@ int
3162xfs_symlink( 3153xfs_symlink(
3163 xfs_inode_t *dp, 3154 xfs_inode_t *dp,
3164 bhv_vname_t *dentry, 3155 bhv_vname_t *dentry,
3165 bhv_vattr_t *vap,
3166 char *target_path, 3156 char *target_path,
3157 mode_t mode,
3167 bhv_vnode_t **vpp, 3158 bhv_vnode_t **vpp,
3168 cred_t *credp) 3159 cred_t *credp)
3169{ 3160{
@@ -3251,8 +3242,6 @@ xfs_symlink(
3251 udqp = gdqp = NULL; 3242 udqp = gdqp = NULL;
3252 if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) 3243 if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
3253 prid = dp->i_d.di_projid; 3244 prid = dp->i_d.di_projid;
3254 else if (vap->va_mask & XFS_AT_PROJID)
3255 prid = (xfs_prid_t)vap->va_projid;
3256 else 3245 else
3257 prid = (xfs_prid_t)dfltprid; 3246 prid = (xfs_prid_t)dfltprid;
3258 3247
@@ -3321,7 +3310,7 @@ xfs_symlink(
3321 /* 3310 /*
3322 * Allocate an inode for the symlink. 3311 * Allocate an inode for the symlink.
3323 */ 3312 */
3324 error = xfs_dir_ialloc(&tp, dp, S_IFLNK | (vap->va_mode&~S_IFMT), 3313 error = xfs_dir_ialloc(&tp, dp, S_IFLNK | (mode & ~S_IFMT),
3325 1, 0, credp, prid, resblks > 0, &ip, NULL); 3314 1, 0, credp, prid, resblks > 0, &ip, NULL);
3326 if (error) { 3315 if (error) {
3327 if (error == ENOSPC) 3316 if (error == ENOSPC)
diff --git a/fs/xfs/xfs_vnodeops.h b/fs/xfs/xfs_vnodeops.h
index 78c8841fbf94..f36e74f2f0c2 100644
--- a/fs/xfs/xfs_vnodeops.h
+++ b/fs/xfs/xfs_vnodeops.h
@@ -26,19 +26,19 @@ int xfs_release(struct xfs_inode *ip);
26int xfs_inactive(struct xfs_inode *ip); 26int xfs_inactive(struct xfs_inode *ip);
27int xfs_lookup(struct xfs_inode *dp, bhv_vname_t *dentry, 27int xfs_lookup(struct xfs_inode *dp, bhv_vname_t *dentry,
28 bhv_vnode_t **vpp); 28 bhv_vnode_t **vpp);
29int xfs_create(struct xfs_inode *dp, bhv_vname_t *dentry, 29int xfs_create(struct xfs_inode *dp, bhv_vname_t *dentry, mode_t mode,
30 struct bhv_vattr *vap, bhv_vnode_t **vpp, struct cred *credp); 30 xfs_dev_t rdev, bhv_vnode_t **vpp, struct cred *credp);
31int xfs_remove(struct xfs_inode *dp, bhv_vname_t *dentry); 31int xfs_remove(struct xfs_inode *dp, bhv_vname_t *dentry);
32int xfs_link(struct xfs_inode *tdp, bhv_vnode_t *src_vp, 32int xfs_link(struct xfs_inode *tdp, bhv_vnode_t *src_vp,
33 bhv_vname_t *dentry); 33 bhv_vname_t *dentry);
34int xfs_mkdir(struct xfs_inode *dp, bhv_vname_t *dentry, 34int xfs_mkdir(struct xfs_inode *dp, bhv_vname_t *dentry,
35 struct bhv_vattr *vap, bhv_vnode_t **vpp, struct cred *credp); 35 mode_t mode, bhv_vnode_t **vpp, struct cred *credp);
36int xfs_rmdir(struct xfs_inode *dp, bhv_vname_t *dentry); 36int xfs_rmdir(struct xfs_inode *dp, bhv_vname_t *dentry);
37int xfs_readdir(struct xfs_inode *dp, void *dirent, size_t bufsize, 37int xfs_readdir(struct xfs_inode *dp, void *dirent, size_t bufsize,
38 xfs_off_t *offset, filldir_t filldir); 38 xfs_off_t *offset, filldir_t filldir);
39int xfs_symlink(struct xfs_inode *dp, bhv_vname_t *dentry, 39int xfs_symlink(struct xfs_inode *dp, bhv_vname_t *dentry,
40 struct bhv_vattr *vap, char *target_path, 40 char *target_path, mode_t mode, bhv_vnode_t **vpp,
41 bhv_vnode_t **vpp, struct cred *credp); 41 struct cred *credp);
42int xfs_fid2(struct xfs_inode *ip, fid_t *fidp); 42int xfs_fid2(struct xfs_inode *ip, fid_t *fidp);
43int xfs_rwlock(struct xfs_inode *ip, bhv_vrwlock_t locktype); 43int xfs_rwlock(struct xfs_inode *ip, bhv_vrwlock_t locktype);
44void xfs_rwunlock(struct xfs_inode *ip, bhv_vrwlock_t locktype); 44void xfs_rwunlock(struct xfs_inode *ip, bhv_vrwlock_t locktype);