diff options
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 23cfa5837728..061e2ffdd1de 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -2366,10 +2366,15 @@ xfs_remove( | |||
2366 | 2366 | ||
2367 | namelen = VNAMELEN(dentry); | 2367 | namelen = VNAMELEN(dentry); |
2368 | 2368 | ||
2369 | if (!xfs_get_dir_entry(dentry, &ip)) { | ||
2370 | dm_di_mode = ip->i_d.di_mode; | ||
2371 | IRELE(ip); | ||
2372 | } | ||
2373 | |||
2369 | if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_REMOVE)) { | 2374 | if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_REMOVE)) { |
2370 | error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, dir_vp, | 2375 | error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, dir_vp, |
2371 | DM_RIGHT_NULL, NULL, DM_RIGHT_NULL, | 2376 | DM_RIGHT_NULL, NULL, DM_RIGHT_NULL, |
2372 | name, NULL, 0, 0, 0); | 2377 | name, NULL, dm_di_mode, 0, 0); |
2373 | if (error) | 2378 | if (error) |
2374 | return error; | 2379 | return error; |
2375 | } | 2380 | } |
@@ -2995,7 +3000,7 @@ xfs_rmdir( | |||
2995 | int cancel_flags; | 3000 | int cancel_flags; |
2996 | int committed; | 3001 | int committed; |
2997 | bhv_vnode_t *dir_vp; | 3002 | bhv_vnode_t *dir_vp; |
2998 | int dm_di_mode = 0; | 3003 | int dm_di_mode = S_IFDIR; |
2999 | int last_cdp_link; | 3004 | int last_cdp_link; |
3000 | int namelen; | 3005 | int namelen; |
3001 | uint resblks; | 3006 | uint resblks; |
@@ -3010,11 +3015,16 @@ xfs_rmdir( | |||
3010 | return XFS_ERROR(EIO); | 3015 | return XFS_ERROR(EIO); |
3011 | namelen = VNAMELEN(dentry); | 3016 | namelen = VNAMELEN(dentry); |
3012 | 3017 | ||
3018 | if (!xfs_get_dir_entry(dentry, &cdp)) { | ||
3019 | dm_di_mode = cdp->i_d.di_mode; | ||
3020 | IRELE(cdp); | ||
3021 | } | ||
3022 | |||
3013 | if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_REMOVE)) { | 3023 | if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_REMOVE)) { |
3014 | error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, | 3024 | error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, |
3015 | dir_vp, DM_RIGHT_NULL, | 3025 | dir_vp, DM_RIGHT_NULL, |
3016 | NULL, DM_RIGHT_NULL, | 3026 | NULL, DM_RIGHT_NULL, |
3017 | name, NULL, 0, 0, 0); | 3027 | name, NULL, dm_di_mode, 0, 0); |
3018 | if (error) | 3028 | if (error) |
3019 | return XFS_ERROR(error); | 3029 | return XFS_ERROR(error); |
3020 | } | 3030 | } |
@@ -3834,7 +3844,9 @@ xfs_reclaim( | |||
3834 | XFS_MOUNT_ILOCK(mp); | 3844 | XFS_MOUNT_ILOCK(mp); |
3835 | vn_bhv_remove(VN_BHV_HEAD(vp), XFS_ITOBHV(ip)); | 3845 | vn_bhv_remove(VN_BHV_HEAD(vp), XFS_ITOBHV(ip)); |
3836 | list_add_tail(&ip->i_reclaim, &mp->m_del_inodes); | 3846 | list_add_tail(&ip->i_reclaim, &mp->m_del_inodes); |
3847 | spin_lock(&ip->i_flags_lock); | ||
3837 | ip->i_flags |= XFS_IRECLAIMABLE; | 3848 | ip->i_flags |= XFS_IRECLAIMABLE; |
3849 | spin_unlock(&ip->i_flags_lock); | ||
3838 | XFS_MOUNT_IUNLOCK(mp); | 3850 | XFS_MOUNT_IUNLOCK(mp); |
3839 | } | 3851 | } |
3840 | return 0; | 3852 | return 0; |
@@ -3859,8 +3871,10 @@ xfs_finish_reclaim( | |||
3859 | * us. | 3871 | * us. |
3860 | */ | 3872 | */ |
3861 | write_lock(&ih->ih_lock); | 3873 | write_lock(&ih->ih_lock); |
3874 | spin_lock(&ip->i_flags_lock); | ||
3862 | if ((ip->i_flags & XFS_IRECLAIM) || | 3875 | if ((ip->i_flags & XFS_IRECLAIM) || |
3863 | (!(ip->i_flags & XFS_IRECLAIMABLE) && vp == NULL)) { | 3876 | (!(ip->i_flags & XFS_IRECLAIMABLE) && vp == NULL)) { |
3877 | spin_unlock(&ip->i_flags_lock); | ||
3864 | write_unlock(&ih->ih_lock); | 3878 | write_unlock(&ih->ih_lock); |
3865 | if (locked) { | 3879 | if (locked) { |
3866 | xfs_ifunlock(ip); | 3880 | xfs_ifunlock(ip); |
@@ -3869,6 +3883,7 @@ xfs_finish_reclaim( | |||
3869 | return 1; | 3883 | return 1; |
3870 | } | 3884 | } |
3871 | ip->i_flags |= XFS_IRECLAIM; | 3885 | ip->i_flags |= XFS_IRECLAIM; |
3886 | spin_unlock(&ip->i_flags_lock); | ||
3872 | write_unlock(&ih->ih_lock); | 3887 | write_unlock(&ih->ih_lock); |
3873 | 3888 | ||
3874 | /* | 3889 | /* |
@@ -4272,7 +4287,7 @@ xfs_free_file_space( | |||
4272 | xfs_mount_t *mp; | 4287 | xfs_mount_t *mp; |
4273 | int nimap; | 4288 | int nimap; |
4274 | uint resblks; | 4289 | uint resblks; |
4275 | int rounding; | 4290 | uint rounding; |
4276 | int rt; | 4291 | int rt; |
4277 | xfs_fileoff_t startoffset_fsb; | 4292 | xfs_fileoff_t startoffset_fsb; |
4278 | xfs_trans_t *tp; | 4293 | xfs_trans_t *tp; |
@@ -4313,8 +4328,7 @@ xfs_free_file_space( | |||
4313 | vn_iowait(vp); /* wait for the completion of any pending DIOs */ | 4328 | vn_iowait(vp); /* wait for the completion of any pending DIOs */ |
4314 | } | 4329 | } |
4315 | 4330 | ||
4316 | rounding = MAX((__uint8_t)(1 << mp->m_sb.sb_blocklog), | 4331 | rounding = max_t(uint, 1 << mp->m_sb.sb_blocklog, NBPP); |
4317 | (__uint8_t)NBPP); | ||
4318 | ilen = len + (offset & (rounding - 1)); | 4332 | ilen = len + (offset & (rounding - 1)); |
4319 | ioffset = offset & ~(rounding - 1); | 4333 | ioffset = offset & ~(rounding - 1); |
4320 | if (ilen & (rounding - 1)) | 4334 | if (ilen & (rounding - 1)) |