Skip to content

Commit 4b4d11b

Browse files
author
Darrick J. Wong
committed
Merge tag 'random-fixes-6.2_2022-11-30' of git://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux into xfs-6.2-mergeC
xfs: various fixes for 6.2 This is an assorted collection of bug fixes that have been bundled together. The first patch fixes a metadump corruption vector resulting from a three-way race between a slow-running blkid process, the kernel mounting, changing, and unmounting the fs, and xfs_db reading stale block device pagecache contents. The middle two patches address gcc warnings. The final patch fixes a subtle corruption bug wherein making a delalloc reservation on a filesystem with quotas enabled would sample the data mapping, try to attach dquots, unlock the inode to attach the dquots, relock the inode, and fail to reverify the sampled data. If another process updated the data mapping while the inode was unlocked, the reservation would proceed with stale data and corrupt the data fork. Signed-off-by: Darrick J. Wong <[email protected]> * tag 'random-fixes-6.2_2022-11-30' of git://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux: xfs: attach dquots to inode before reading data/cow fork mappings xfs: shut up -Wuninitialized in xfsaild_push xfs: use memcpy, not strncpy, to format the attr prefix during listxattr xfs: invalidate block device page cache during unmount
2 parents cd14f15 + 4c6dbfd commit 4b4d11b

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

fs/xfs/xfs_buf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,6 +1945,7 @@ xfs_free_buftarg(
19451945
list_lru_destroy(&btp->bt_lru);
19461946

19471947
blkdev_issue_flush(btp->bt_bdev);
1948+
invalidate_bdev(btp->bt_bdev);
19481949
fs_put_dax(btp->bt_daxdev, btp->bt_mount);
19491950

19501951
kmem_free(btp);

fs/xfs/xfs_iomap.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,10 @@ xfs_buffered_write_iomap_begin(
978978

979979
ASSERT(!XFS_IS_REALTIME_INODE(ip));
980980

981+
error = xfs_qm_dqattach(ip);
982+
if (error)
983+
return error;
984+
981985
error = xfs_ilock_for_iomap(ip, flags, &lockmode);
982986
if (error)
983987
return error;
@@ -1081,10 +1085,6 @@ xfs_buffered_write_iomap_begin(
10811085
allocfork = XFS_COW_FORK;
10821086
}
10831087

1084-
error = xfs_qm_dqattach_locked(ip, false);
1085-
if (error)
1086-
goto out_unlock;
1087-
10881088
if (eof && offset + count > XFS_ISIZE(ip)) {
10891089
/*
10901090
* Determine the initial size of the preallocation.

fs/xfs/xfs_trans_ail.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ xfsaild_push(
422422
struct xfs_ail_cursor cur;
423423
struct xfs_log_item *lip;
424424
xfs_lsn_t lsn;
425-
xfs_lsn_t target;
425+
xfs_lsn_t target = NULLCOMMITLSN;
426426
long tout;
427427
int stuck = 0;
428428
int flushing = 0;
@@ -472,6 +472,8 @@ xfsaild_push(
472472

473473
XFS_STATS_INC(mp, xs_push_ail);
474474

475+
ASSERT(target != NULLCOMMITLSN);
476+
475477
lsn = lip->li_lsn;
476478
while ((XFS_LSN_CMP(lip->li_lsn, target) <= 0)) {
477479
int lock_result;

fs/xfs/xfs_xattr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ __xfs_xattr_put_listent(
210210
return;
211211
}
212212
offset = context->buffer + context->count;
213-
strncpy(offset, prefix, prefix_len);
213+
memcpy(offset, prefix, prefix_len);
214214
offset += prefix_len;
215215
strncpy(offset, (char *)name, namelen); /* real name */
216216
offset += namelen;

0 commit comments

Comments
 (0)