diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_super.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 71 |
1 files changed, 46 insertions, 25 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 18a4b8e11df2..1bfb0e980193 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -930,13 +930,39 @@ xfs_fs_alloc_inode( | |||
930 | */ | 930 | */ |
931 | STATIC void | 931 | STATIC void |
932 | xfs_fs_destroy_inode( | 932 | xfs_fs_destroy_inode( |
933 | struct inode *inode) | 933 | struct inode *inode) |
934 | { | 934 | { |
935 | xfs_inode_t *ip = XFS_I(inode); | 935 | struct xfs_inode *ip = XFS_I(inode); |
936 | |||
937 | xfs_itrace_entry(ip); | ||
936 | 938 | ||
937 | XFS_STATS_INC(vn_reclaim); | 939 | XFS_STATS_INC(vn_reclaim); |
938 | if (xfs_reclaim(ip)) | 940 | |
939 | panic("%s: cannot reclaim 0x%p\n", __func__, inode); | 941 | /* bad inode, get out here ASAP */ |
942 | if (is_bad_inode(inode)) | ||
943 | goto out_reclaim; | ||
944 | |||
945 | xfs_ioend_wait(ip); | ||
946 | |||
947 | ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) || ip->i_delayed_blks == 0); | ||
948 | |||
949 | /* | ||
950 | * We should never get here with one of the reclaim flags already set. | ||
951 | */ | ||
952 | ASSERT_ALWAYS(!xfs_iflags_test(ip, XFS_IRECLAIMABLE)); | ||
953 | ASSERT_ALWAYS(!xfs_iflags_test(ip, XFS_IRECLAIM)); | ||
954 | |||
955 | /* | ||
956 | * If we have nothing to flush with this inode then complete the | ||
957 | * teardown now, otherwise delay the flush operation. | ||
958 | */ | ||
959 | if (!xfs_inode_clean(ip)) { | ||
960 | xfs_inode_set_reclaim_tag(ip); | ||
961 | return; | ||
962 | } | ||
963 | |||
964 | out_reclaim: | ||
965 | xfs_ireclaim(ip); | ||
940 | } | 966 | } |
941 | 967 | ||
942 | /* | 968 | /* |
@@ -973,7 +999,6 @@ xfs_fs_inode_init_once( | |||
973 | 999 | ||
974 | mrlock_init(&ip->i_lock, MRLOCK_ALLOW_EQUAL_PRI|MRLOCK_BARRIER, | 1000 | mrlock_init(&ip->i_lock, MRLOCK_ALLOW_EQUAL_PRI|MRLOCK_BARRIER, |
975 | "xfsino", ip->i_ino); | 1001 | "xfsino", ip->i_ino); |
976 | mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", ip->i_ino); | ||
977 | } | 1002 | } |
978 | 1003 | ||
979 | /* | 1004 | /* |
@@ -1075,6 +1100,20 @@ xfs_fs_clear_inode( | |||
1075 | XFS_STATS_INC(vn_remove); | 1100 | XFS_STATS_INC(vn_remove); |
1076 | XFS_STATS_DEC(vn_active); | 1101 | XFS_STATS_DEC(vn_active); |
1077 | 1102 | ||
1103 | /* | ||
1104 | * The iolock is used by the file system to coordinate reads, | ||
1105 | * writes, and block truncates. Up to this point the lock | ||
1106 | * protected concurrent accesses by users of the inode. But | ||
1107 | * from here forward we're doing some final processing of the | ||
1108 | * inode because we're done with it, and although we reuse the | ||
1109 | * iolock for protection it is really a distinct lock class | ||
1110 | * (in the lockdep sense) from before. To keep lockdep happy | ||
1111 | * (and basically indicate what we are doing), we explicitly | ||
1112 | * re-init the iolock here. | ||
1113 | */ | ||
1114 | ASSERT(!rwsem_is_locked(&ip->i_iolock.mr_lock)); | ||
1115 | mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", ip->i_ino); | ||
1116 | |||
1078 | xfs_inactive(ip); | 1117 | xfs_inactive(ip); |
1079 | } | 1118 | } |
1080 | 1119 | ||
@@ -1092,8 +1131,6 @@ xfs_fs_put_super( | |||
1092 | struct super_block *sb) | 1131 | struct super_block *sb) |
1093 | { | 1132 | { |
1094 | struct xfs_mount *mp = XFS_M(sb); | 1133 | struct xfs_mount *mp = XFS_M(sb); |
1095 | struct xfs_inode *rip = mp->m_rootip; | ||
1096 | int unmount_event_flags = 0; | ||
1097 | 1134 | ||
1098 | xfs_syncd_stop(mp); | 1135 | xfs_syncd_stop(mp); |
1099 | 1136 | ||
@@ -1109,20 +1146,7 @@ xfs_fs_put_super( | |||
1109 | xfs_sync_attr(mp, 0); | 1146 | xfs_sync_attr(mp, 0); |
1110 | } | 1147 | } |
1111 | 1148 | ||
1112 | #ifdef HAVE_DMAPI | 1149 | XFS_SEND_PREUNMOUNT(mp); |
1113 | if (mp->m_flags & XFS_MOUNT_DMAPI) { | ||
1114 | unmount_event_flags = | ||
1115 | (mp->m_dmevmask & (1 << DM_EVENT_UNMOUNT)) ? | ||
1116 | 0 : DM_FLAGS_UNWANTED; | ||
1117 | /* | ||
1118 | * Ignore error from dmapi here, first unmount is not allowed | ||
1119 | * to fail anyway, and second we wouldn't want to fail a | ||
1120 | * unmount because of dmapi. | ||
1121 | */ | ||
1122 | XFS_SEND_PREUNMOUNT(mp, rip, DM_RIGHT_NULL, rip, DM_RIGHT_NULL, | ||
1123 | NULL, NULL, 0, 0, unmount_event_flags); | ||
1124 | } | ||
1125 | #endif | ||
1126 | 1150 | ||
1127 | /* | 1151 | /* |
1128 | * Blow away any referenced inode in the filestreams cache. | 1152 | * Blow away any referenced inode in the filestreams cache. |
@@ -1133,10 +1157,7 @@ xfs_fs_put_super( | |||
1133 | 1157 | ||
1134 | XFS_bflush(mp->m_ddev_targp); | 1158 | XFS_bflush(mp->m_ddev_targp); |
1135 | 1159 | ||
1136 | if (mp->m_flags & XFS_MOUNT_DMAPI) { | 1160 | XFS_SEND_UNMOUNT(mp); |
1137 | XFS_SEND_UNMOUNT(mp, rip, DM_RIGHT_NULL, 0, 0, | ||
1138 | unmount_event_flags); | ||
1139 | } | ||
1140 | 1161 | ||
1141 | xfs_unmountfs(mp); | 1162 | xfs_unmountfs(mp); |
1142 | xfs_freesb(mp); | 1163 | xfs_freesb(mp); |