Skip to content

Commit 4694472

Browse files
committed
Merge tag 'xfs-fixes-6.17-rc4' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull xfs fixes from Carlos Maiolino: "The highlight I'd like to point here is related to the XFS_RT Kconfig, which has been updated to be enabled by default now if CONFIG_BLK_DEV_ZONED is enabled. This also contains a few fixes for zoned devices support in XFS, specially related to swapon requests in inodes belonging to the zoned FS. A null-ptr dereference fix in the xattr data, due to a mishandling of medium errors generated by block devices is also included" * tag 'xfs-fixes-6.17-rc4' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: xfs: do not propagate ENODATA disk errors into xattr code xfs: reject swapon for inodes on a zoned file system earlier xfs: kick off inodegc when failing to reserve zoned blocks xfs: remove xfs_last_used_zone xfs: Default XFS_RT to Y if CONFIG_BLK_DEV_ZONED is enabled
2 parents 02d6eee + ae668cd commit 4694472

File tree

6 files changed

+25
-43
lines changed

6 files changed

+25
-43
lines changed

fs/xfs/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ config XFS_POSIX_ACL
105105
config XFS_RT
106106
bool "XFS Realtime subvolume support"
107107
depends on XFS_FS
108+
default BLK_DEV_ZONED
108109
help
109110
If you say Y here you will be able to mount and use XFS filesystems
110111
which contain a realtime subvolume. The realtime subvolume is a

fs/xfs/libxfs/xfs_attr_remote.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,13 @@ xfs_attr_rmtval_get(
435435
0, &bp, &xfs_attr3_rmt_buf_ops);
436436
if (xfs_metadata_is_sick(error))
437437
xfs_dirattr_mark_sick(args->dp, XFS_ATTR_FORK);
438+
/*
439+
* ENODATA from disk implies a disk medium failure;
440+
* ENODATA for xattrs means attribute not found, so
441+
* disambiguate that here.
442+
*/
443+
if (error == -ENODATA)
444+
error = -EIO;
438445
if (error)
439446
return error;
440447

fs/xfs/libxfs/xfs_da_btree.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2833,6 +2833,12 @@ xfs_da_read_buf(
28332833
&bp, ops);
28342834
if (xfs_metadata_is_sick(error))
28352835
xfs_dirattr_mark_sick(dp, whichfork);
2836+
/*
2837+
* ENODATA from disk implies a disk medium failure; ENODATA for
2838+
* xattrs means attribute not found, so disambiguate that here.
2839+
*/
2840+
if (error == -ENODATA && whichfork == XFS_ATTR_FORK)
2841+
error = -EIO;
28362842
if (error)
28372843
goto out_free;
28382844

fs/xfs/xfs_aops.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,9 @@ xfs_vm_swap_activate(
760760
{
761761
struct xfs_inode *ip = XFS_I(file_inode(swap_file));
762762

763+
if (xfs_is_zoned_inode(ip))
764+
return -EINVAL;
765+
763766
/*
764767
* Swap file activation can race against concurrent shared extent
765768
* removal in files that have been cloned. If this happens,

fs/xfs/xfs_zone_alloc.c

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -374,44 +374,6 @@ xfs_zone_free_blocks(
374374
return 0;
375375
}
376376

377-
/*
378-
* Check if the zone containing the data just before the offset we are
379-
* writing to is still open and has space.
380-
*/
381-
static struct xfs_open_zone *
382-
xfs_last_used_zone(
383-
struct iomap_ioend *ioend)
384-
{
385-
struct xfs_inode *ip = XFS_I(ioend->io_inode);
386-
struct xfs_mount *mp = ip->i_mount;
387-
xfs_fileoff_t offset_fsb = XFS_B_TO_FSB(mp, ioend->io_offset);
388-
struct xfs_rtgroup *rtg = NULL;
389-
struct xfs_open_zone *oz = NULL;
390-
struct xfs_iext_cursor icur;
391-
struct xfs_bmbt_irec got;
392-
393-
xfs_ilock(ip, XFS_ILOCK_SHARED);
394-
if (!xfs_iext_lookup_extent_before(ip, &ip->i_df, &offset_fsb,
395-
&icur, &got)) {
396-
xfs_iunlock(ip, XFS_ILOCK_SHARED);
397-
return NULL;
398-
}
399-
xfs_iunlock(ip, XFS_ILOCK_SHARED);
400-
401-
rtg = xfs_rtgroup_grab(mp, xfs_rtb_to_rgno(mp, got.br_startblock));
402-
if (!rtg)
403-
return NULL;
404-
405-
xfs_ilock(rtg_rmap(rtg), XFS_ILOCK_SHARED);
406-
oz = READ_ONCE(rtg->rtg_open_zone);
407-
if (oz && (oz->oz_is_gc || !atomic_inc_not_zero(&oz->oz_ref)))
408-
oz = NULL;
409-
xfs_iunlock(rtg_rmap(rtg), XFS_ILOCK_SHARED);
410-
411-
xfs_rtgroup_rele(rtg);
412-
return oz;
413-
}
414-
415377
static struct xfs_group *
416378
xfs_find_free_zone(
417379
struct xfs_mount *mp,
@@ -918,12 +880,9 @@ xfs_zone_alloc_and_submit(
918880
goto out_error;
919881

920882
/*
921-
* If we don't have a cached zone in this write context, see if the
922-
* last extent before the one we are writing to points to an active
923-
* zone. If so, just continue writing to it.
883+
* If we don't have a locally cached zone in this write context, see if
884+
* the inode is still associated with a zone and use that if so.
924885
*/
925-
if (!*oz && ioend->io_offset)
926-
*oz = xfs_last_used_zone(ioend);
927886
if (!*oz)
928887
*oz = xfs_cached_zone(mp, ip);
929888

fs/xfs/xfs_zone_space_resv.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "xfs_mount.h"
1111
#include "xfs_inode.h"
1212
#include "xfs_rtbitmap.h"
13+
#include "xfs_icache.h"
1314
#include "xfs_zone_alloc.h"
1415
#include "xfs_zone_priv.h"
1516
#include "xfs_zones.h"
@@ -230,6 +231,11 @@ xfs_zoned_space_reserve(
230231

231232
error = xfs_dec_freecounter(mp, XC_FREE_RTEXTENTS, count_fsb,
232233
flags & XFS_ZR_RESERVED);
234+
if (error == -ENOSPC && !(flags & XFS_ZR_NOWAIT)) {
235+
xfs_inodegc_flush(mp);
236+
error = xfs_dec_freecounter(mp, XC_FREE_RTEXTENTS, count_fsb,
237+
flags & XFS_ZR_RESERVED);
238+
}
233239
if (error == -ENOSPC && (flags & XFS_ZR_GREEDY) && count_fsb > 1)
234240
error = xfs_zoned_reserve_extents_greedy(mp, &count_fsb, flags);
235241
if (error)

0 commit comments

Comments
 (0)