The following commit has been merged in the master branch: commit 0e5ab8dd87c29640a46aee9e38bc3ba7645b1db0 Merge: 54eb8462f21fb170a05ad64620f0d8d0cf2b7fb5 7146bda743e6f543af60584fad2cfbb6ce83d8ac Author: Linus Torvalds torvalds@linux-foundation.org Date: Wed Jun 1 17:23:53 2022 -0700
Merge tag 'xfs-5.19-for-linus-2' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull more xfs updates from Dave Chinner: "This update is largely bug fixes and cleanups for all the code merged in the first pull request. The majority of them are to the new logged attribute code, but there are also a couple of fixes for other log recovery and memory leaks that have recently been found.
Summary:
- fix refcount leak in xfs_ifree()
- fix xfs_buf_cancel structure leaks in log recovery
- fix dquot leak after failed quota check
- fix a couple of problematic ASSERTS
- fix small aim7 perf regression in from new btree sibling validation
- clean up log incompat feature marking for new logged attribute feature
- disallow logged attributes on legacy V4 filesystem formats.
- fix da state leak when freeing attr intents
- improve validation of the attr log items in recovery
- use slab caches for commonly used attr structures
- fix leaks of attr name/value buffer and reduce copying overhead during intent logging
- remove some dead debug code from log recovery"
* tag 'xfs-5.19-for-linus-2' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: (33 commits) xfs: fix xfs_ifree() error handling to not leak perag ref xfs: move xfs_attr_use_log_assist usage out of libxfs xfs: move xfs_attr_use_log_assist out of xfs_log.c xfs: warn about LARP once per mount xfs: implement per-mount warnings for scrub and shrink usage xfs: don't log every time we clear the log incompat flags xfs: convert buf_cancel_table allocation to kmalloc_array xfs: don't leak xfs_buf_cancel structures when recovery fails xfs: refactor buffer cancellation table allocation xfs: don't leak btree cursor when insrec fails after a split xfs: purge dquots after inode walk fails during quotacheck xfs: assert in xfs_btree_del_cursor should take into account error xfs: don't assert fail on perag references on teardown xfs: avoid unnecessary runtime sibling pointer endian conversions xfs: share xattr name and value buffers when logging xattr updates xfs: do not use logged xattr updates on V4 filesystems xfs: Remove duplicate include xfs: reduce IOCB_NOWAIT judgment for retry exclusive unaligned DIO xfs: Remove dead code xfs: fix typo in comment ...
diff --combined fs/xfs/xfs_file.c index a60632ecc3f0,e2f2a3a94634..5a171c0b244b --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@@ -225,7 -225,7 +225,7 @@@ xfs_file_dio_read ret = xfs_ilock_iocb(iocb, XFS_IOLOCK_SHARED); if (ret) return ret; - ret = iomap_dio_rw(iocb, to, &xfs_read_iomap_ops, NULL, 0, 0); + ret = iomap_dio_rw(iocb, to, &xfs_read_iomap_ops, NULL, 0, NULL, 0); xfs_iunlock(ip, XFS_IOLOCK_SHARED);
return ret; @@@ -534,7 -534,7 +534,7 @@@ xfs_file_dio_write_aligned } trace_xfs_file_direct_write(iocb, from); ret = iomap_dio_rw(iocb, from, &xfs_direct_write_iomap_ops, - &xfs_dio_write_ops, 0, 0); + &xfs_dio_write_ops, 0, NULL, 0); out_unlock: if (iolock) xfs_iunlock(ip, iolock); @@@ -576,9 -576,9 +576,9 @@@ xfs_file_dio_write_unaligned * don't even bother trying the fast path in this case. */ if (iocb->ki_pos > isize || iocb->ki_pos + count >= isize) { - retry_exclusive: if (iocb->ki_flags & IOCB_NOWAIT) return -EAGAIN; + retry_exclusive: iolock = XFS_IOLOCK_EXCL; flags = IOMAP_DIO_FORCE_WAIT; } @@@ -612,7 -612,7 +612,7 @@@
trace_xfs_file_direct_write(iocb, from); ret = iomap_dio_rw(iocb, from, &xfs_direct_write_iomap_ops, - &xfs_dio_write_ops, flags, 0); + &xfs_dio_write_ops, flags, NULL, 0);
/* * Retry unaligned I/O with exclusive blocking semantics if the DIO diff --combined fs/xfs/xfs_super.c index 8495ef076ffc,a6e7b4176faf..ed18160e6181 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@@ -38,6 -38,8 +38,8 @@@ #include "xfs_pwork.h" #include "xfs_ag.h" #include "xfs_defer.h" + #include "xfs_attr_item.h" + #include "xfs_xattr.h"
#include <linux/magic.h> #include <linux/fs_context.h> @@@ -1618,10 -1620,14 +1620,10 @@@ xfs_fs_fill_super goto out_filestream_unmount; }
- if (xfs_has_discard(mp)) { - struct request_queue *q = bdev_get_queue(sb->s_bdev); - - if (!blk_queue_discard(q)) { - xfs_warn(mp, "mounting with "discard" option, but " - "the device does not support discard"); - mp->m_features &= ~XFS_FEAT_DISCARD; - } + if (xfs_has_discard(mp) && !bdev_max_discard_sectors(sb->s_bdev)) { + xfs_warn(mp, + "mounting with "discard" option, but the device does not support discard"); + mp->m_features &= ~XFS_FEAT_DISCARD; }
if (xfs_has_reflink(mp)) { @@@ -2079,8 -2085,24 +2081,24 @@@ xfs_init_caches(void if (!xfs_bui_cache) goto out_destroy_bud_cache;
+ xfs_attrd_cache = kmem_cache_create("xfs_attrd_item", + sizeof(struct xfs_attrd_log_item), + 0, 0, NULL); + if (!xfs_attrd_cache) + goto out_destroy_bui_cache; + + xfs_attri_cache = kmem_cache_create("xfs_attri_item", + sizeof(struct xfs_attri_log_item), + 0, 0, NULL); + if (!xfs_attri_cache) + goto out_destroy_attrd_cache; + return 0;
+ out_destroy_attrd_cache: + kmem_cache_destroy(xfs_attrd_cache); + out_destroy_bui_cache: + kmem_cache_destroy(xfs_bui_cache); out_destroy_bud_cache: kmem_cache_destroy(xfs_bud_cache); out_destroy_cui_cache: @@@ -2127,6 -2149,8 +2145,8 @@@ xfs_destroy_caches(void * destroy caches. */ rcu_barrier(); + kmem_cache_destroy(xfs_attri_cache); + kmem_cache_destroy(xfs_attrd_cache); kmem_cache_destroy(xfs_bui_cache); kmem_cache_destroy(xfs_bud_cache); kmem_cache_destroy(xfs_cui_cache);