diff options
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 51 |
1 files changed, 9 insertions, 42 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 5390d124ad35..4765e7c4b75d 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -2270,41 +2270,30 @@ xfs_remove( | |||
2270 | bhv_vnode_t *dir_vp = XFS_ITOV(dp); | 2270 | bhv_vnode_t *dir_vp = XFS_ITOV(dp); |
2271 | char *name = VNAME(dentry); | 2271 | char *name = VNAME(dentry); |
2272 | xfs_mount_t *mp = dp->i_mount; | 2272 | xfs_mount_t *mp = dp->i_mount; |
2273 | xfs_inode_t *ip; | 2273 | xfs_inode_t *ip = VNAME_TO_INODE(dentry); |
2274 | int namelen = VNAMELEN(dentry); | ||
2274 | xfs_trans_t *tp = NULL; | 2275 | xfs_trans_t *tp = NULL; |
2275 | int error = 0; | 2276 | int error = 0; |
2276 | xfs_bmap_free_t free_list; | 2277 | xfs_bmap_free_t free_list; |
2277 | xfs_fsblock_t first_block; | 2278 | xfs_fsblock_t first_block; |
2278 | int cancel_flags; | 2279 | int cancel_flags; |
2279 | int committed; | 2280 | int committed; |
2280 | int dm_di_mode = 0; | ||
2281 | int link_zero; | 2281 | int link_zero; |
2282 | uint resblks; | 2282 | uint resblks; |
2283 | int namelen; | ||
2284 | 2283 | ||
2285 | xfs_itrace_entry(dp); | 2284 | xfs_itrace_entry(dp); |
2286 | 2285 | ||
2287 | if (XFS_FORCED_SHUTDOWN(mp)) | 2286 | if (XFS_FORCED_SHUTDOWN(mp)) |
2288 | return XFS_ERROR(EIO); | 2287 | return XFS_ERROR(EIO); |
2289 | 2288 | ||
2290 | namelen = VNAMELEN(dentry); | ||
2291 | |||
2292 | if (!xfs_get_dir_entry(dentry, &ip)) { | ||
2293 | dm_di_mode = ip->i_d.di_mode; | ||
2294 | IRELE(ip); | ||
2295 | } | ||
2296 | |||
2297 | if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) { | 2289 | if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) { |
2298 | error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, dir_vp, | 2290 | error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, dir_vp, |
2299 | DM_RIGHT_NULL, NULL, DM_RIGHT_NULL, | 2291 | DM_RIGHT_NULL, NULL, DM_RIGHT_NULL, |
2300 | name, NULL, dm_di_mode, 0, 0); | 2292 | name, NULL, ip->i_d.di_mode, 0, 0); |
2301 | if (error) | 2293 | if (error) |
2302 | return error; | 2294 | return error; |
2303 | } | 2295 | } |
2304 | 2296 | ||
2305 | /* From this point on, return through std_return */ | ||
2306 | ip = NULL; | ||
2307 | |||
2308 | /* | 2297 | /* |
2309 | * We need to get a reference to ip before we get our log | 2298 | * We need to get a reference to ip before we get our log |
2310 | * reservation. The reason for this is that we cannot call | 2299 | * reservation. The reason for this is that we cannot call |
@@ -2317,13 +2306,7 @@ xfs_remove( | |||
2317 | * when we call xfs_iget. Instead we get an unlocked reference | 2306 | * when we call xfs_iget. Instead we get an unlocked reference |
2318 | * to the inode before getting our log reservation. | 2307 | * to the inode before getting our log reservation. |
2319 | */ | 2308 | */ |
2320 | error = xfs_get_dir_entry(dentry, &ip); | 2309 | IHOLD(ip); |
2321 | if (error) { | ||
2322 | REMOVE_DEBUG_TRACE(__LINE__); | ||
2323 | goto std_return; | ||
2324 | } | ||
2325 | |||
2326 | dm_di_mode = ip->i_d.di_mode; | ||
2327 | 2310 | ||
2328 | xfs_itrace_entry(ip); | 2311 | xfs_itrace_entry(ip); |
2329 | xfs_itrace_ref(ip); | 2312 | xfs_itrace_ref(ip); |
@@ -2459,7 +2442,7 @@ xfs_remove( | |||
2459 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE, | 2442 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE, |
2460 | dir_vp, DM_RIGHT_NULL, | 2443 | dir_vp, DM_RIGHT_NULL, |
2461 | NULL, DM_RIGHT_NULL, | 2444 | NULL, DM_RIGHT_NULL, |
2462 | name, NULL, dm_di_mode, error, 0); | 2445 | name, NULL, ip->i_d.di_mode, error, 0); |
2463 | } | 2446 | } |
2464 | return error; | 2447 | return error; |
2465 | 2448 | ||
@@ -2868,14 +2851,13 @@ xfs_rmdir( | |||
2868 | char *name = VNAME(dentry); | 2851 | char *name = VNAME(dentry); |
2869 | int namelen = VNAMELEN(dentry); | 2852 | int namelen = VNAMELEN(dentry); |
2870 | xfs_mount_t *mp = dp->i_mount; | 2853 | xfs_mount_t *mp = dp->i_mount; |
2871 | xfs_inode_t *cdp; /* child directory */ | 2854 | xfs_inode_t *cdp = VNAME_TO_INODE(dentry); |
2872 | xfs_trans_t *tp; | 2855 | xfs_trans_t *tp; |
2873 | int error; | 2856 | int error; |
2874 | xfs_bmap_free_t free_list; | 2857 | xfs_bmap_free_t free_list; |
2875 | xfs_fsblock_t first_block; | 2858 | xfs_fsblock_t first_block; |
2876 | int cancel_flags; | 2859 | int cancel_flags; |
2877 | int committed; | 2860 | int committed; |
2878 | int dm_di_mode = S_IFDIR; | ||
2879 | int last_cdp_link; | 2861 | int last_cdp_link; |
2880 | uint resblks; | 2862 | uint resblks; |
2881 | 2863 | ||
@@ -2884,24 +2866,15 @@ xfs_rmdir( | |||
2884 | if (XFS_FORCED_SHUTDOWN(mp)) | 2866 | if (XFS_FORCED_SHUTDOWN(mp)) |
2885 | return XFS_ERROR(EIO); | 2867 | return XFS_ERROR(EIO); |
2886 | 2868 | ||
2887 | if (!xfs_get_dir_entry(dentry, &cdp)) { | ||
2888 | dm_di_mode = cdp->i_d.di_mode; | ||
2889 | IRELE(cdp); | ||
2890 | } | ||
2891 | |||
2892 | if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) { | 2869 | if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) { |
2893 | error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, | 2870 | error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, |
2894 | dir_vp, DM_RIGHT_NULL, | 2871 | dir_vp, DM_RIGHT_NULL, |
2895 | NULL, DM_RIGHT_NULL, | 2872 | NULL, DM_RIGHT_NULL, |
2896 | name, NULL, dm_di_mode, 0, 0); | 2873 | name, NULL, cdp->i_d.di_mode, 0, 0); |
2897 | if (error) | 2874 | if (error) |
2898 | return XFS_ERROR(error); | 2875 | return XFS_ERROR(error); |
2899 | } | 2876 | } |
2900 | 2877 | ||
2901 | /* Return through std_return after this point. */ | ||
2902 | |||
2903 | cdp = NULL; | ||
2904 | |||
2905 | /* | 2878 | /* |
2906 | * We need to get a reference to cdp before we get our log | 2879 | * We need to get a reference to cdp before we get our log |
2907 | * reservation. The reason for this is that we cannot call | 2880 | * reservation. The reason for this is that we cannot call |
@@ -2914,13 +2887,7 @@ xfs_rmdir( | |||
2914 | * when we call xfs_iget. Instead we get an unlocked reference | 2887 | * when we call xfs_iget. Instead we get an unlocked reference |
2915 | * to the inode before getting our log reservation. | 2888 | * to the inode before getting our log reservation. |
2916 | */ | 2889 | */ |
2917 | error = xfs_get_dir_entry(dentry, &cdp); | 2890 | IHOLD(cdp); |
2918 | if (error) { | ||
2919 | REMOVE_DEBUG_TRACE(__LINE__); | ||
2920 | goto std_return; | ||
2921 | } | ||
2922 | mp = dp->i_mount; | ||
2923 | dm_di_mode = cdp->i_d.di_mode; | ||
2924 | 2891 | ||
2925 | /* | 2892 | /* |
2926 | * Get the dquots for the inodes. | 2893 | * Get the dquots for the inodes. |
@@ -3077,7 +3044,7 @@ xfs_rmdir( | |||
3077 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE, | 3044 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE, |
3078 | dir_vp, DM_RIGHT_NULL, | 3045 | dir_vp, DM_RIGHT_NULL, |
3079 | NULL, DM_RIGHT_NULL, | 3046 | NULL, DM_RIGHT_NULL, |
3080 | name, NULL, dm_di_mode, | 3047 | name, NULL, cdp->i_d.di_mode, |
3081 | error, 0); | 3048 | error, 0); |
3082 | } | 3049 | } |
3083 | return error; | 3050 | return error; |