tree:
https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git x86/entry
head: b8797e281f77cdac3988e9a97b1c76eabbabaefa
commit: b8797e281f77cdac3988e9a97b1c76eabbabaefa [1/1] Merge branch 'linus' into
x86/entry, to resolve conflicts
config: i386-randconfig-a001-20200614 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce (this is a W=1 build):
git checkout b8797e281f77cdac3988e9a97b1c76eabbabaefa
# save the attached .config to linux build tree
make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
fs/xfs/xfs_buf_item_recover.c: In function 'xlog_recover_buf_commit_pass2':
> fs/xfs/xfs_buf_item_recover.c:933:4: warning: this 'else'
clause does not guard... [-Wmisleading-indentation]
933 | } else if
(buf_f->blf_flags &
| ^~~~
In file included from include/linux/string.h:6,
from include/linux/uuid.h:12,
from fs/xfs/xfs_linux.h:10,
from fs/xfs/xfs.h:22,
from fs/xfs/xfs_buf_item_recover.c:6:
include/linux/compiler.h:56:23: note: ...this statement, but the latter is misleadingly
indented as if it were guarded by the 'else'
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^~
--
fs/xfs/xfs_inode_item_recover.c: In function 'xlog_recover_inode_commit_pass2':
> fs/xfs/xfs_inode_item_recover.c:244:4: warning: this
'else' clause does not guard... [-Wmisleading-indentation]
244 | } else if
(unlikely(S_ISDIR(ldip->di_mode))) {
| ^~~~
In file included from include/linux/string.h:6,
from include/linux/uuid.h:12,
from fs/xfs/xfs_linux.h:10,
from fs/xfs/xfs.h:22,
from fs/xfs/xfs_inode_item_recover.c:6:
include/linux/compiler.h:56:23: note: ...this statement, but the latter is misleadingly
indented as if it were guarded by the 'else'
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^~
vim +/else +933 fs/xfs/xfs_buf_item_recover.c
1094d3f1236347 Darrick J. Wong 2020-05-01 839
1094d3f1236347 Darrick J. Wong 2020-05-01 840 /*
1094d3f1236347 Darrick J. Wong 2020-05-01 841 * This routine replays a modification
made to a buffer at runtime.
1094d3f1236347 Darrick J. Wong 2020-05-01 842 * There are actually two types of buffer,
regular and inode, which
1094d3f1236347 Darrick J. Wong 2020-05-01 843 * are handled differently. Inode buffers
are handled differently
1094d3f1236347 Darrick J. Wong 2020-05-01 844 * in that we only recover a specific set
of data from them, namely
1094d3f1236347 Darrick J. Wong 2020-05-01 845 * the inode di_next_unlinked fields.
This is because all other inode
1094d3f1236347 Darrick J. Wong 2020-05-01 846 * data is actually logged via inode
records and any data we replay
1094d3f1236347 Darrick J. Wong 2020-05-01 847 * here which overlaps that may be stale.
1094d3f1236347 Darrick J. Wong 2020-05-01 848 *
1094d3f1236347 Darrick J. Wong 2020-05-01 849 * When meta-data buffers are freed at run
time we log a buffer item
1094d3f1236347 Darrick J. Wong 2020-05-01 850 * with the XFS_BLF_CANCEL bit set to
indicate that previous copies
1094d3f1236347 Darrick J. Wong 2020-05-01 851 * of the buffer in the log should not be
replayed at recovery time.
1094d3f1236347 Darrick J. Wong 2020-05-01 852 * This is so that if the blocks covered
by the buffer are reused for
1094d3f1236347 Darrick J. Wong 2020-05-01 853 * file data before we crash we don't
end up replaying old, freed
1094d3f1236347 Darrick J. Wong 2020-05-01 854 * meta-data into a user's file.
1094d3f1236347 Darrick J. Wong 2020-05-01 855 *
1094d3f1236347 Darrick J. Wong 2020-05-01 856 * To handle the cancellation of buffer
log items, we make two passes
1094d3f1236347 Darrick J. Wong 2020-05-01 857 * over the log during recovery. During
the first we build a table of
1094d3f1236347 Darrick J. Wong 2020-05-01 858 * those buffers which have been
cancelled, and during the second we
1094d3f1236347 Darrick J. Wong 2020-05-01 859 * only replay those buffers which do not
have corresponding cancel
1094d3f1236347 Darrick J. Wong 2020-05-01 860 * records in the table. See
xlog_recover_buf_pass[1,2] above
1094d3f1236347 Darrick J. Wong 2020-05-01 861 * for more details on the implementation
of the table of cancel records.
1094d3f1236347 Darrick J. Wong 2020-05-01 862 */
1094d3f1236347 Darrick J. Wong 2020-05-01 863 STATIC int
1094d3f1236347 Darrick J. Wong 2020-05-01 864 xlog_recover_buf_commit_pass2(
1094d3f1236347 Darrick J. Wong 2020-05-01 865 struct xlog *log,
1094d3f1236347 Darrick J. Wong 2020-05-01 866 struct list_head *buffer_list,
1094d3f1236347 Darrick J. Wong 2020-05-01 867 struct xlog_recover_item *item,
1094d3f1236347 Darrick J. Wong 2020-05-01 868 xfs_lsn_t current_lsn)
1094d3f1236347 Darrick J. Wong 2020-05-01 869 {
1094d3f1236347 Darrick J. Wong 2020-05-01 870 struct xfs_buf_log_format *buf_f =
item->ri_buf[0].i_addr;
1094d3f1236347 Darrick J. Wong 2020-05-01 871 struct xfs_mount *mp = log->l_mp;
1094d3f1236347 Darrick J. Wong 2020-05-01 872 struct xfs_buf *bp;
1094d3f1236347 Darrick J. Wong 2020-05-01 873 int error;
1094d3f1236347 Darrick J. Wong 2020-05-01 874 uint buf_flags;
1094d3f1236347 Darrick J. Wong 2020-05-01 875 xfs_lsn_t lsn;
1094d3f1236347 Darrick J. Wong 2020-05-01 876
1094d3f1236347 Darrick J. Wong 2020-05-01 877 /*
1094d3f1236347 Darrick J. Wong 2020-05-01 878 * In this pass we only want to recover
all the buffers which have
1094d3f1236347 Darrick J. Wong 2020-05-01 879 * not been cancelled and are not
cancellation buffers themselves.
1094d3f1236347 Darrick J. Wong 2020-05-01 880 */
1094d3f1236347 Darrick J. Wong 2020-05-01 881 if (buf_f->blf_flags &
XFS_BLF_CANCEL) {
1094d3f1236347 Darrick J. Wong 2020-05-01 882 if (xlog_put_buffer_cancelled(log,
buf_f->blf_blkno,
1094d3f1236347 Darrick J. Wong 2020-05-01 883 buf_f->blf_len))
1094d3f1236347 Darrick J. Wong 2020-05-01 884 goto cancelled;
1094d3f1236347 Darrick J. Wong 2020-05-01 885 } else {
1094d3f1236347 Darrick J. Wong 2020-05-01 886
1094d3f1236347 Darrick J. Wong 2020-05-01 887 if (xlog_is_buffer_cancelled(log,
buf_f->blf_blkno,
1094d3f1236347 Darrick J. Wong 2020-05-01 888 buf_f->blf_len))
1094d3f1236347 Darrick J. Wong 2020-05-01 889 goto cancelled;
1094d3f1236347 Darrick J. Wong 2020-05-01 890 }
1094d3f1236347 Darrick J. Wong 2020-05-01 891
1094d3f1236347 Darrick J. Wong 2020-05-01 892 trace_xfs_log_recover_buf_recover(log,
buf_f);
1094d3f1236347 Darrick J. Wong 2020-05-01 893
1094d3f1236347 Darrick J. Wong 2020-05-01 894 buf_flags = 0;
1094d3f1236347 Darrick J. Wong 2020-05-01 895 if (buf_f->blf_flags &
XFS_BLF_INODE_BUF)
1094d3f1236347 Darrick J. Wong 2020-05-01 896 buf_flags |= XBF_UNMAPPED;
1094d3f1236347 Darrick J. Wong 2020-05-01 897
1094d3f1236347 Darrick J. Wong 2020-05-01 898 error = xfs_buf_read(mp->m_ddev_targp,
buf_f->blf_blkno, buf_f->blf_len,
1094d3f1236347 Darrick J. Wong 2020-05-01 899 buf_flags, &bp, NULL);
1094d3f1236347 Darrick J. Wong 2020-05-01 900 if (error)
1094d3f1236347 Darrick J. Wong 2020-05-01 901 return error;
1094d3f1236347 Darrick J. Wong 2020-05-01 902
1094d3f1236347 Darrick J. Wong 2020-05-01 903 /*
1094d3f1236347 Darrick J. Wong 2020-05-01 904 * Recover the buffer only if we get an
LSN from it and it's less than
1094d3f1236347 Darrick J. Wong 2020-05-01 905 * the lsn of the transaction we are
replaying.
1094d3f1236347 Darrick J. Wong 2020-05-01 906 *
1094d3f1236347 Darrick J. Wong 2020-05-01 907 * Note that we have to be extremely
careful of readahead here.
1094d3f1236347 Darrick J. Wong 2020-05-01 908 * Readahead does not attach verfiers to
the buffers so if we don't
1094d3f1236347 Darrick J. Wong 2020-05-01 909 * actually do any replay after readahead
because of the LSN we found
1094d3f1236347 Darrick J. Wong 2020-05-01 910 * in the buffer if more recent than that
current transaction then we
1094d3f1236347 Darrick J. Wong 2020-05-01 911 * need to attach the verifier directly.
Failure to do so can lead to
1094d3f1236347 Darrick J. Wong 2020-05-01 912 * future recovery actions (e.g. EFI and
unlinked list recovery) can
1094d3f1236347 Darrick J. Wong 2020-05-01 913 * operate on the buffers and they
won't get the verifier attached. This
1094d3f1236347 Darrick J. Wong 2020-05-01 914 * can lead to blocks on disk having the
correct content but a stale
1094d3f1236347 Darrick J. Wong 2020-05-01 915 * CRC.
1094d3f1236347 Darrick J. Wong 2020-05-01 916 *
1094d3f1236347 Darrick J. Wong 2020-05-01 917 * It is safe to assume these clean
buffers are currently up to date.
1094d3f1236347 Darrick J. Wong 2020-05-01 918 * If the buffer is dirtied by a later
transaction being replayed, then
1094d3f1236347 Darrick J. Wong 2020-05-01 919 * the verifier will be reset to match
whatever recover turns that
1094d3f1236347 Darrick J. Wong 2020-05-01 920 * buffer into.
1094d3f1236347 Darrick J. Wong 2020-05-01 921 */
1094d3f1236347 Darrick J. Wong 2020-05-01 922 lsn = xlog_recover_get_buf_lsn(mp, bp);
1094d3f1236347 Darrick J. Wong 2020-05-01 923 if (lsn && lsn != -1 &&
XFS_LSN_CMP(lsn, current_lsn) >= 0) {
1094d3f1236347 Darrick J. Wong 2020-05-01 924 trace_xfs_log_recover_buf_skip(log,
buf_f);
1094d3f1236347 Darrick J. Wong 2020-05-01 925 xlog_recover_validate_buf_type(mp, bp,
buf_f, NULLCOMMITLSN);
1094d3f1236347 Darrick J. Wong 2020-05-01 926 goto out_release;
1094d3f1236347 Darrick J. Wong 2020-05-01 927 }
1094d3f1236347 Darrick J. Wong 2020-05-01 928
1094d3f1236347 Darrick J. Wong 2020-05-01 929 if (buf_f->blf_flags &
XFS_BLF_INODE_BUF) {
1094d3f1236347 Darrick J. Wong 2020-05-01 930 error = xlog_recover_do_inode_buffer(mp,
item, bp, buf_f);
1094d3f1236347 Darrick J. Wong 2020-05-01 931 if (error)
1094d3f1236347 Darrick J. Wong 2020-05-01 932 goto out_release;
1094d3f1236347 Darrick J. Wong 2020-05-01 @933 } else if (buf_f->blf_flags &
1094d3f1236347 Darrick J. Wong 2020-05-01 934
(XFS_BLF_UDQUOT_BUF|XFS_BLF_PDQUOT_BUF|XFS_BLF_GDQUOT_BUF)) {
1094d3f1236347 Darrick J. Wong 2020-05-01 935 bool dirty;
1094d3f1236347 Darrick J. Wong 2020-05-01 936
1094d3f1236347 Darrick J. Wong 2020-05-01 937 dirty = xlog_recover_do_dquot_buffer(mp,
log, item, bp, buf_f);
1094d3f1236347 Darrick J. Wong 2020-05-01 938 if (!dirty)
1094d3f1236347 Darrick J. Wong 2020-05-01 939 goto out_release;
1094d3f1236347 Darrick J. Wong 2020-05-01 940 } else {
1094d3f1236347 Darrick J. Wong 2020-05-01 941 xlog_recover_do_reg_buffer(mp, item, bp,
buf_f, current_lsn);
1094d3f1236347 Darrick J. Wong 2020-05-01 942 }
1094d3f1236347 Darrick J. Wong 2020-05-01 943
1094d3f1236347 Darrick J. Wong 2020-05-01 944 /*
1094d3f1236347 Darrick J. Wong 2020-05-01 945 * Perform delayed write on the buffer.
Asynchronous writes will be
1094d3f1236347 Darrick J. Wong 2020-05-01 946 * slower when taking into account all
the buffers to be flushed.
1094d3f1236347 Darrick J. Wong 2020-05-01 947 *
1094d3f1236347 Darrick J. Wong 2020-05-01 948 * Also make sure that only inode buffers
with good sizes stay in
1094d3f1236347 Darrick J. Wong 2020-05-01 949 * the buffer cache. The kernel moves
inodes in buffers of 1 block
1094d3f1236347 Darrick J. Wong 2020-05-01 950 * or inode_cluster_size bytes, whichever
is bigger. The inode
1094d3f1236347 Darrick J. Wong 2020-05-01 951 * buffers in the log can be a different
size if the log was generated
1094d3f1236347 Darrick J. Wong 2020-05-01 952 * by an older kernel using unclustered
inode buffers or a newer kernel
1094d3f1236347 Darrick J. Wong 2020-05-01 953 * running with a different inode cluster
size. Regardless, if the
1094d3f1236347 Darrick J. Wong 2020-05-01 954 * the inode buffer size isn't
max(blocksize, inode_cluster_size)
1094d3f1236347 Darrick J. Wong 2020-05-01 955 * for *our* value of inode_cluster_size,
then we need to keep
1094d3f1236347 Darrick J. Wong 2020-05-01 956 * the buffer out of the buffer cache so
that the buffer won't
1094d3f1236347 Darrick J. Wong 2020-05-01 957 * overlap with future reads of those
inodes.
1094d3f1236347 Darrick J. Wong 2020-05-01 958 */
1094d3f1236347 Darrick J. Wong 2020-05-01 959 if (XFS_DINODE_MAGIC ==
1094d3f1236347 Darrick J. Wong 2020-05-01 960 be16_to_cpu(*((__be16
*)xfs_buf_offset(bp, 0))) &&
1094d3f1236347 Darrick J. Wong 2020-05-01 961 (BBTOB(bp->b_length) !=
M_IGEO(log->l_mp)->inode_cluster_size)) {
1094d3f1236347 Darrick J. Wong 2020-05-01 962 xfs_buf_stale(bp);
1094d3f1236347 Darrick J. Wong 2020-05-01 963 error = xfs_bwrite(bp);
1094d3f1236347 Darrick J. Wong 2020-05-01 964 } else {
1094d3f1236347 Darrick J. Wong 2020-05-01 965 ASSERT(bp->b_mount == mp);
1094d3f1236347 Darrick J. Wong 2020-05-01 966 bp->b_iodone = xlog_recover_iodone;
1094d3f1236347 Darrick J. Wong 2020-05-01 967 xfs_buf_delwri_queue(bp, buffer_list);
1094d3f1236347 Darrick J. Wong 2020-05-01 968 }
1094d3f1236347 Darrick J. Wong 2020-05-01 969
1094d3f1236347 Darrick J. Wong 2020-05-01 970 out_release:
1094d3f1236347 Darrick J. Wong 2020-05-01 971 xfs_buf_relse(bp);
1094d3f1236347 Darrick J. Wong 2020-05-01 972 return error;
1094d3f1236347 Darrick J. Wong 2020-05-01 973 cancelled:
1094d3f1236347 Darrick J. Wong 2020-05-01 974 trace_xfs_log_recover_buf_cancel(log,
buf_f);
1094d3f1236347 Darrick J. Wong 2020-05-01 975 return 0;
1094d3f1236347 Darrick J. Wong 2020-05-01 976 }
1094d3f1236347 Darrick J. Wong 2020-05-01 977
:::::: The code at line 933 was first introduced by commit
:::::: 1094d3f12363474b2a3d1a6c06124bec25dd1555 xfs: refactor log recovery buffer item
dispatch for pass2 commit functions
:::::: TO: Darrick J. Wong <darrick.wong(a)oracle.com>
:::::: CC: Darrick J. Wong <darrick.wong(a)oracle.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org