Skip to content

Commit 27c0b5c

Browse files
committed
Merge tag 'xfs-fixes-6.18-rc3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull xfs fixes from Carlos Maiolino: "The main highlight here is a fix for a bug brought in by the removal of attr2 mount option, where some installations might actually have 'attr2' explicitly configured in fstab preventing system to boot by not being able to remount the rootfs as RW. Besides that there are a couple fix to the zonefs implementation, changing XFS_ONLINE_SCRUB_STATS to depend on DEBUG_FS (was select before), and some other minor changes" * tag 'xfs-fixes-6.18-rc3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: xfs: fix locking in xchk_nlinks_collect_dir xfs: loudly complain about defunct mount options xfs: always warn about deprecated mount options xfs: don't set bt_nr_sectors to a negative number xfs: don't use __GFP_NOFAIL in xfs_init_fs_context xfs: cache open zone in inode->i_private xfs: avoid busy loops in GCD xfs: XFS_ONLINE_SCRUB_STATS should depend on DEBUG_FS xfs: do not tightly pack-write large files xfs: Improve CONFIG_XFS_RT Kconfig help
2 parents 566771a + f477af0 commit 27c0b5c

File tree

9 files changed

+193
-140
lines changed

9 files changed

+193
-140
lines changed

fs/xfs/Kconfig

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,15 @@ config XFS_RT
119119

120120
See the xfs man page in section 5 for additional information.
121121

122+
This option is mandatory to support zoned block devices. For these
123+
devices, the realtime subvolume must be backed by a zoned block
124+
device and a regular block device used as the main device (for
125+
metadata). If the zoned block device is a host-managed SMR hard-disk
126+
containing conventional zones at the beginning of its address space,
127+
XFS will use the disk conventional zones as the main device and the
128+
remaining sequential write required zones as the backing storage for
129+
the realtime subvolume.
130+
122131
If unsure, say N.
123132

124133
config XFS_DRAIN_INTENTS
@@ -156,7 +165,7 @@ config XFS_ONLINE_SCRUB_STATS
156165
bool "XFS online metadata check usage data collection"
157166
default y
158167
depends on XFS_ONLINE_SCRUB
159-
select DEBUG_FS
168+
depends on DEBUG_FS
160169
help
161170
If you say Y here, the kernel will gather usage data about
162171
the online metadata check subsystem. This includes the number

fs/xfs/scrub/nlinks.c

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,36 @@ xchk_nlinks_collect_pptr(
376376
return error;
377377
}
378378

379+
static uint
380+
xchk_nlinks_ilock_dir(
381+
struct xfs_inode *ip)
382+
{
383+
uint lock_mode = XFS_ILOCK_SHARED;
384+
385+
/*
386+
* We're going to scan the directory entries, so we must be ready to
387+
* pull the data fork mappings into memory if they aren't already.
388+
*/
389+
if (xfs_need_iread_extents(&ip->i_df))
390+
lock_mode = XFS_ILOCK_EXCL;
391+
392+
/*
393+
* We're going to scan the parent pointers, so we must be ready to
394+
* pull the attr fork mappings into memory if they aren't already.
395+
*/
396+
if (xfs_has_parent(ip->i_mount) && xfs_inode_has_attr_fork(ip) &&
397+
xfs_need_iread_extents(&ip->i_af))
398+
lock_mode = XFS_ILOCK_EXCL;
399+
400+
/*
401+
* Take the IOLOCK so that other threads cannot start a directory
402+
* update while we're scanning.
403+
*/
404+
lock_mode |= XFS_IOLOCK_SHARED;
405+
xfs_ilock(ip, lock_mode);
406+
return lock_mode;
407+
}
408+
379409
/* Walk a directory to bump the observed link counts of the children. */
380410
STATIC int
381411
xchk_nlinks_collect_dir(
@@ -394,8 +424,7 @@ xchk_nlinks_collect_dir(
394424
return 0;
395425

396426
/* Prevent anyone from changing this directory while we walk it. */
397-
xfs_ilock(dp, XFS_IOLOCK_SHARED);
398-
lock_mode = xfs_ilock_data_map_shared(dp);
427+
lock_mode = xchk_nlinks_ilock_dir(dp);
399428

400429
/*
401430
* The dotdot entry of an unlinked directory still points to the last
@@ -452,7 +481,6 @@ xchk_nlinks_collect_dir(
452481
xchk_iscan_abort(&xnc->collect_iscan);
453482
out_unlock:
454483
xfs_iunlock(dp, lock_mode);
455-
xfs_iunlock(dp, XFS_IOLOCK_SHARED);
456484
return error;
457485
}
458486

fs/xfs/xfs_buf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1751,7 +1751,7 @@ xfs_init_buftarg(
17511751
const char *descr)
17521752
{
17531753
/* The maximum size of the buftarg is only known once the sb is read. */
1754-
btp->bt_nr_sectors = (xfs_daddr_t)-1;
1754+
btp->bt_nr_sectors = XFS_BUF_DADDR_MAX;
17551755

17561756
/* Set up device logical sector size mask */
17571757
btp->bt_logical_sectorsize = logical_sectorsize;

fs/xfs/xfs_buf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ extern struct kmem_cache *xfs_buf_cache;
2222
*/
2323
struct xfs_buf;
2424

25+
#define XFS_BUF_DADDR_MAX ((xfs_daddr_t) S64_MAX)
2526
#define XFS_BUF_DADDR_NULL ((xfs_daddr_t) (-1LL))
2627

2728
#define XBF_READ (1u << 0) /* buffer intended for reading from device */

fs/xfs/xfs_mount.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ typedef struct xfs_mount {
236236
bool m_update_sb; /* sb needs update in mount */
237237
unsigned int m_max_open_zones;
238238
unsigned int m_zonegc_low_space;
239-
struct xfs_mru_cache *m_zone_cache; /* Inode to open zone cache */
240239

241240
/* max_atomic_write mount option value */
242241
unsigned long long m_awu_max_bytes;

fs/xfs/xfs_super.c

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ static const struct constant_table dax_param_enums[] = {
102102
* Table driven mount option parser.
103103
*/
104104
enum {
105-
Opt_logbufs, Opt_logbsize, Opt_logdev, Opt_rtdev,
105+
Op_deprecated, Opt_logbufs, Opt_logbsize, Opt_logdev, Opt_rtdev,
106106
Opt_wsync, Opt_noalign, Opt_swalloc, Opt_sunit, Opt_swidth, Opt_nouuid,
107107
Opt_grpid, Opt_nogrpid, Opt_bsdgroups, Opt_sysvgroups,
108108
Opt_allocsize, Opt_norecovery, Opt_inode64, Opt_inode32,
@@ -114,7 +114,21 @@ enum {
114114
Opt_lifetime, Opt_nolifetime, Opt_max_atomic_write,
115115
};
116116

117+
#define fsparam_dead(NAME) \
118+
__fsparam(NULL, (NAME), Op_deprecated, fs_param_deprecated, NULL)
119+
117120
static const struct fs_parameter_spec xfs_fs_parameters[] = {
121+
/*
122+
* These mount options were supposed to be deprecated in September 2025
123+
* but the deprecation warning was buggy, so not all users were
124+
* notified. The deprecation is now obnoxiously loud and postponed to
125+
* September 2030.
126+
*/
127+
fsparam_dead("attr2"),
128+
fsparam_dead("noattr2"),
129+
fsparam_dead("ikeep"),
130+
fsparam_dead("noikeep"),
131+
118132
fsparam_u32("logbufs", Opt_logbufs),
119133
fsparam_string("logbsize", Opt_logbsize),
120134
fsparam_string("logdev", Opt_logdev),
@@ -786,6 +800,12 @@ xfs_fs_evict_inode(
786800

787801
truncate_inode_pages_final(&inode->i_data);
788802
clear_inode(inode);
803+
804+
if (IS_ENABLED(CONFIG_XFS_RT) &&
805+
S_ISREG(inode->i_mode) && inode->i_private) {
806+
xfs_open_zone_put(inode->i_private);
807+
inode->i_private = NULL;
808+
}
789809
}
790810

791811
static void
@@ -1373,16 +1393,25 @@ suffix_kstrtoull(
13731393
static inline void
13741394
xfs_fs_warn_deprecated(
13751395
struct fs_context *fc,
1376-
struct fs_parameter *param,
1377-
uint64_t flag,
1378-
bool value)
1396+
struct fs_parameter *param)
13791397
{
1380-
/* Don't print the warning if reconfiguring and current mount point
1381-
* already had the flag set
1398+
/*
1399+
* Always warn about someone passing in a deprecated mount option.
1400+
* Previously we wouldn't print the warning if we were reconfiguring
1401+
* and current mount point already had the flag set, but that was not
1402+
* the right thing to do.
1403+
*
1404+
* Many distributions mount the root filesystem with no options in the
1405+
* initramfs and rely on mount -a to remount the root fs with the
1406+
* options in fstab. However, the old behavior meant that there would
1407+
* never be a warning about deprecated mount options for the root fs in
1408+
* /etc/fstab. On a single-fs system, that means no warning at all.
1409+
*
1410+
* Compounding this problem are distribution scripts that copy
1411+
* /proc/mounts to fstab, which means that we can't remove mount
1412+
* options unless we're 100% sure they have only ever been advertised
1413+
* in /proc/mounts in response to explicitly provided mount options.
13821414
*/
1383-
if ((fc->purpose & FS_CONTEXT_FOR_RECONFIGURE) &&
1384-
!!(XFS_M(fc->root->d_sb)->m_features & flag) == value)
1385-
return;
13861415
xfs_warn(fc->s_fs_info, "%s mount option is deprecated.", param->key);
13871416
}
13881417

@@ -1408,6 +1437,9 @@ xfs_fs_parse_param(
14081437
return opt;
14091438

14101439
switch (opt) {
1440+
case Op_deprecated:
1441+
xfs_fs_warn_deprecated(fc, param);
1442+
return 0;
14111443
case Opt_logbufs:
14121444
parsing_mp->m_logbufs = result.uint_32;
14131445
return 0;
@@ -1528,7 +1560,6 @@ xfs_fs_parse_param(
15281560
xfs_mount_set_dax_mode(parsing_mp, result.uint_32);
15291561
return 0;
15301562
#endif
1531-
/* Following mount options will be removed in September 2025 */
15321563
case Opt_max_open_zones:
15331564
parsing_mp->m_max_open_zones = result.uint_32;
15341565
return 0;
@@ -2221,7 +2252,7 @@ xfs_init_fs_context(
22212252
struct xfs_mount *mp;
22222253
int i;
22232254

2224-
mp = kzalloc(sizeof(struct xfs_mount), GFP_KERNEL | __GFP_NOFAIL);
2255+
mp = kzalloc(sizeof(struct xfs_mount), GFP_KERNEL);
22252256
if (!mp)
22262257
return -ENOMEM;
22272258

0 commit comments

Comments
 (0)