Revert "[XFS] Avoid replaying inode buffer initialisation log items if on-disk version is newer."

This reverts commit b394e43e995d08821588a22561c6a71a63b4ff27.

Lachlan McIlroy says:
It tried to fix an issue where log replay is replaying an inode cluster
initialisation transaction that should not be replayed because the inode
cluster on disk is more up to date. Since we don't log file sizes (we
rely on inode flushing to get them to disk) then we can't just replay
all the transations in the log and expect the inode to be completely
restored. We lose file size updates. Unfortunately this fix is causing
more (serious) problems than it is fixing.

SGI-PV: 969656
SGI-Modid: xfs-linux-melb:xfs-kern:29804a

Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>

authored by Tim Shimmin and committed by Linus Torvalds 564256c9 a64314e6

+3 -54
-5
fs/xfs/xfs_buf_item.h
··· 52 52 #define XFS_BLI_UDQUOT_BUF 0x4 53 53 #define XFS_BLI_PDQUOT_BUF 0x8 54 54 #define XFS_BLI_GDQUOT_BUF 0x10 55 - /* 56 - * This flag indicates that the buffer contains newly allocated 57 - * inodes. 58 - */ 59 - #define XFS_BLI_INODE_NEW_BUF 0x20 60 55 61 56 #define XFS_BLI_CHUNK 128 62 57 #define XFS_BLI_SHIFT 7
+3 -48
fs/xfs/xfs_log_recover.c
··· 1874 1874 /*ARGSUSED*/ 1875 1875 STATIC void 1876 1876 xlog_recover_do_reg_buffer( 1877 - xfs_mount_t *mp, 1878 1877 xlog_recover_item_t *item, 1879 1878 xfs_buf_t *bp, 1880 1879 xfs_buf_log_format_t *buf_f) ··· 1884 1885 unsigned int *data_map = NULL; 1885 1886 unsigned int map_size = 0; 1886 1887 int error; 1887 - int stale_buf = 1; 1888 - 1889 - /* 1890 - * Scan through the on-disk inode buffer and attempt to 1891 - * determine if it has been written to since it was logged. 1892 - * 1893 - * - If any of the magic numbers are incorrect then the buffer is stale 1894 - * - If any of the modes are non-zero then the buffer is not stale 1895 - * - If all of the modes are zero and at least one of the generation 1896 - * counts is non-zero then the buffer is stale 1897 - * 1898 - * If the end result is a stale buffer then the log buffer is replayed 1899 - * otherwise it is skipped. 1900 - * 1901 - * This heuristic is not perfect. It can be improved by scanning the 1902 - * entire inode chunk for evidence that any of the inode clusters have 1903 - * been updated. To fix this problem completely we will need a major 1904 - * architectural change to the logging system. 1905 - */ 1906 - if (buf_f->blf_flags & XFS_BLI_INODE_NEW_BUF) { 1907 - xfs_dinode_t *dip; 1908 - int inodes_per_buf; 1909 - int mode_count = 0; 1910 - int gen_count = 0; 1911 - 1912 - stale_buf = 0; 1913 - inodes_per_buf = XFS_BUF_COUNT(bp) >> mp->m_sb.sb_inodelog; 1914 - for (i = 0; i < inodes_per_buf; i++) { 1915 - dip = (xfs_dinode_t *)xfs_buf_offset(bp, 1916 - i * mp->m_sb.sb_inodesize); 1917 - if (be16_to_cpu(dip->di_core.di_magic) != 1918 - XFS_DINODE_MAGIC) { 1919 - stale_buf = 1; 1920 - break; 1921 - } 1922 - if (dip->di_core.di_mode) 1923 - mode_count++; 1924 - if (dip->di_core.di_gen) 1925 - gen_count++; 1926 - } 1927 - 1928 - if (!mode_count && gen_count) 1929 - stale_buf = 1; 1930 - } 1931 1888 1932 1889 switch (buf_f->blf_type) { 1933 1890 case XFS_LI_BUF: ··· 1917 1962 -1, 0, XFS_QMOPT_DOWARN, 1918 1963 "dquot_buf_recover"); 1919 1964 } 1920 - if (!error && stale_buf) 1965 + if (!error) 1921 1966 memcpy(xfs_buf_offset(bp, 1922 1967 (uint)bit << XFS_BLI_SHIFT), /* dest */ 1923 1968 item->ri_buf[i].i_addr, /* source */ ··· 2089 2134 if (log->l_quotaoffs_flag & type) 2090 2135 return; 2091 2136 2092 - xlog_recover_do_reg_buffer(mp, item, bp, buf_f); 2137 + xlog_recover_do_reg_buffer(item, bp, buf_f); 2093 2138 } 2094 2139 2095 2140 /* ··· 2190 2235 (XFS_BLI_UDQUOT_BUF|XFS_BLI_PDQUOT_BUF|XFS_BLI_GDQUOT_BUF)) { 2191 2236 xlog_recover_do_dquot_buffer(mp, log, item, bp, buf_f); 2192 2237 } else { 2193 - xlog_recover_do_reg_buffer(mp, item, bp, buf_f); 2238 + xlog_recover_do_reg_buffer(item, bp, buf_f); 2194 2239 } 2195 2240 if (error) 2196 2241 return XFS_ERROR(error);
-1
fs/xfs/xfs_trans_buf.c
··· 966 966 ASSERT(atomic_read(&bip->bli_refcount) > 0); 967 967 968 968 bip->bli_flags |= XFS_BLI_INODE_ALLOC_BUF; 969 - bip->bli_format.blf_flags |= XFS_BLI_INODE_NEW_BUF; 970 969 } 971 970 972 971