diff options
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 3d8ba8fec191..abf509a88915 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -1931,9 +1931,9 @@ xfs_iunlink( | |||
1931 | */ | 1931 | */ |
1932 | error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, agdaddr, | 1932 | error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, agdaddr, |
1933 | XFS_FSS_TO_BB(mp, 1), 0, &agibp); | 1933 | XFS_FSS_TO_BB(mp, 1), 0, &agibp); |
1934 | if (error) { | 1934 | if (error) |
1935 | return error; | 1935 | return error; |
1936 | } | 1936 | |
1937 | /* | 1937 | /* |
1938 | * Validate the magic number of the agi block. | 1938 | * Validate the magic number of the agi block. |
1939 | */ | 1939 | */ |
@@ -1957,6 +1957,24 @@ xfs_iunlink( | |||
1957 | ASSERT(agi->agi_unlinked[bucket_index]); | 1957 | ASSERT(agi->agi_unlinked[bucket_index]); |
1958 | ASSERT(be32_to_cpu(agi->agi_unlinked[bucket_index]) != agino); | 1958 | ASSERT(be32_to_cpu(agi->agi_unlinked[bucket_index]) != agino); |
1959 | 1959 | ||
1960 | error = xfs_itobp(mp, tp, ip, &dip, &ibp, 0, 0); | ||
1961 | if (error) | ||
1962 | return error; | ||
1963 | |||
1964 | /* | ||
1965 | * Clear the on-disk di_nlink. This is to prevent xfs_bulkstat | ||
1966 | * from picking up this inode when it is reclaimed (its incore state | ||
1967 | * initialzed but not flushed to disk yet). The in-core di_nlink is | ||
1968 | * already cleared in xfs_droplink() and a corresponding transaction | ||
1969 | * logged. The hack here just synchronizes the in-core to on-disk | ||
1970 | * di_nlink value in advance before the actual inode sync to disk. | ||
1971 | * This is OK because the inode is already unlinked and would never | ||
1972 | * change its di_nlink again for this inode generation. | ||
1973 | * This is a temporary hack that would require a proper fix | ||
1974 | * in the future. | ||
1975 | */ | ||
1976 | dip->di_core.di_nlink = 0; | ||
1977 | |||
1960 | if (be32_to_cpu(agi->agi_unlinked[bucket_index]) != NULLAGINO) { | 1978 | if (be32_to_cpu(agi->agi_unlinked[bucket_index]) != NULLAGINO) { |
1961 | /* | 1979 | /* |
1962 | * There is already another inode in the bucket we need | 1980 | * There is already another inode in the bucket we need |
@@ -1964,10 +1982,6 @@ xfs_iunlink( | |||
1964 | * Here we put the head pointer into our next pointer, | 1982 | * Here we put the head pointer into our next pointer, |
1965 | * and then we fall through to point the head at us. | 1983 | * and then we fall through to point the head at us. |
1966 | */ | 1984 | */ |
1967 | error = xfs_itobp(mp, tp, ip, &dip, &ibp, 0, 0); | ||
1968 | if (error) { | ||
1969 | return error; | ||
1970 | } | ||
1971 | ASSERT(be32_to_cpu(dip->di_next_unlinked) == NULLAGINO); | 1985 | ASSERT(be32_to_cpu(dip->di_next_unlinked) == NULLAGINO); |
1972 | /* both on-disk, don't endian flip twice */ | 1986 | /* both on-disk, don't endian flip twice */ |
1973 | dip->di_next_unlinked = agi->agi_unlinked[bucket_index]; | 1987 | dip->di_next_unlinked = agi->agi_unlinked[bucket_index]; |