aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_vnodeops.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r--fs/xfs/xfs_vnodeops.c33
1 files changed, 11 insertions, 22 deletions
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)