Skip to content

Commit e5e038b

Browse files
committed
Merge tag 'fs_for_v6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull ext2, isofs, udf, and quota updates from Jan Kara: "A lot of material this time: - removal of a lot of GFP_NOFS usage from ext2, udf, quota (either it was legacy or replaced with scoped memalloc_nofs_*() API) - removal of BUG_ONs in quota code - conversion of UDF to the new mount API - tightening quota on disk format verification - fix some potentially unsafe use of RCU pointers in quota code and annotate everything properly to make sparse happy - a few other small quota, ext2, udf, and isofs fixes" * tag 'fs_for_v6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: (26 commits) udf: remove SLAB_MEM_SPREAD flag usage quota: remove SLAB_MEM_SPREAD flag usage isofs: remove SLAB_MEM_SPREAD flag usage ext2: remove SLAB_MEM_SPREAD flag usage ext2: mark as deprecated udf: convert to new mount API udf: convert novrs to an option flag MAINTAINERS: add missing git address for ext2 entry quota: Detect loops in quota tree quota: Properly annotate i_dquot arrays with __rcu quota: Fix rcu annotations of inode dquot pointers isofs: handle CDs with bad root inode but good Joliet root directory udf: Avoid invalid LVID used on mount quota: Fix potential NULL pointer dereference quota: Drop GFP_NOFS instances under dquot->dq_lock and dqio_sem quota: Set nofs allocation context when acquiring dqio_sem ext2: Remove GFP_NOFS use in ext2_xattr_cache_insert() ext2: Drop GFP_NOFS use in ext2_get_blocks() ext2: Drop GFP_NOFS allocation from ext2_init_block_alloc_info() udf: Remove GFP_NOFS allocation in udf_expand_file_adinicb() ...
2 parents 1715f71 + a78e41a commit e5e038b

32 files changed

+608
-423
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8021,6 +8021,7 @@ M: Jan Kara <[email protected]>
80218021
80228022
S: Maintained
80238023
F: Documentation/filesystems/ext2.rst
8024+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git
80248025
F: fs/ext2/
80258026
F: include/linux/ext2*
80268027

fs/ext2/Kconfig

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
config EXT2_FS
3-
tristate "Second extended fs support"
3+
tristate "Second extended fs support (DEPRECATED)"
44
select BUFFER_HEAD
55
select FS_IOMAP
66
select LEGACY_DIRECT_IO
77
help
88
Ext2 is a standard Linux file system for hard disks.
99

10-
To compile this file system support as a module, choose M here: the
11-
module will be called ext2.
10+
This filesystem driver is deprecated because it does not properly
11+
support inode time stamps beyond 03:14:07 UTC on 19 January 2038.
1212

13-
If unsure, say Y.
13+
Ext2 users are advised to use ext4 driver to access their filesystem.
14+
The driver is fully compatible, supports filesystems without journal
15+
or extents, and also supports larger time stamps if the filesystem
16+
is created with at least 256 byte inodes.
17+
18+
This code is kept as a simple reference for filesystem developers.
19+
20+
If unsure, say N.
1421

1522
config EXT2_FS_XATTR
1623
bool "Ext2 extended attributes"

fs/ext2/balloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ void ext2_init_block_alloc_info(struct inode *inode)
412412
struct ext2_block_alloc_info *block_i;
413413
struct super_block *sb = inode->i_sb;
414414

415-
block_i = kmalloc(sizeof(*block_i), GFP_NOFS);
415+
block_i = kmalloc(sizeof(*block_i), GFP_KERNEL);
416416
if (block_i) {
417417
struct ext2_reserve_window_node *rsv = &block_i->rsv_window_node;
418418

fs/ext2/ext2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ struct ext2_inode_info {
674674
struct inode vfs_inode;
675675
struct list_head i_orphan; /* unlinked but open inodes */
676676
#ifdef CONFIG_QUOTA
677-
struct dquot *i_dquot[MAXQUOTAS];
677+
struct dquot __rcu *i_dquot[MAXQUOTAS];
678678
#endif
679679
};
680680

fs/ext2/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ static int ext2_get_blocks(struct inode *inode,
754754
*/
755755
err = sb_issue_zeroout(inode->i_sb,
756756
le32_to_cpu(chain[depth-1].key), count,
757-
GFP_NOFS);
757+
GFP_KERNEL);
758758
if (err) {
759759
mutex_unlock(&ei->truncate_mutex);
760760
goto cleanup;

fs/ext2/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data, siz
319319
static ssize_t ext2_quota_write(struct super_block *sb, int type, const char *data, size_t len, loff_t off);
320320
static int ext2_quota_on(struct super_block *sb, int type, int format_id,
321321
const struct path *path);
322-
static struct dquot **ext2_get_dquots(struct inode *inode)
322+
static struct dquot __rcu **ext2_get_dquots(struct inode *inode)
323323
{
324324
return EXT2_I(inode)->i_dquot;
325325
}

fs/ext2/xattr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ ext2_xattr_cache_insert(struct mb_cache *cache, struct buffer_head *bh)
874874
__u32 hash = le32_to_cpu(HDR(bh)->h_hash);
875875
int error;
876876

877-
error = mb_cache_entry_create(cache, GFP_NOFS, hash, bh->b_blocknr,
877+
error = mb_cache_entry_create(cache, GFP_KERNEL, hash, bh->b_blocknr,
878878
true);
879879
if (error) {
880880
if (error == -EBUSY) {

fs/ext4/ext4.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,7 @@ struct ext4_inode_info {
11581158
tid_t i_datasync_tid;
11591159

11601160
#ifdef CONFIG_QUOTA
1161-
struct dquot *i_dquot[MAXQUOTAS];
1161+
struct dquot __rcu *i_dquot[MAXQUOTAS];
11621162
#endif
11631163

11641164
/* Precomputed uuid+inum+igen checksum for seeding inode checksums */

fs/ext4/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,7 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
15991599
static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
16001600
unsigned int flags);
16011601

1602-
static struct dquot **ext4_get_dquots(struct inode *inode)
1602+
static struct dquot __rcu **ext4_get_dquots(struct inode *inode)
16031603
{
16041604
return EXT4_I(inode)->i_dquot;
16051605
}

fs/f2fs/f2fs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ struct f2fs_inode_info {
830830
spinlock_t i_size_lock; /* protect last_disk_size */
831831

832832
#ifdef CONFIG_QUOTA
833-
struct dquot *i_dquot[MAXQUOTAS];
833+
struct dquot __rcu *i_dquot[MAXQUOTAS];
834834

835835
/* quota space reservation, managed internally by quota code */
836836
qsize_t i_reserved_quota;

fs/f2fs/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2768,7 +2768,7 @@ int f2fs_dquot_initialize(struct inode *inode)
27682768
return dquot_initialize(inode);
27692769
}
27702770

2771-
static struct dquot **f2fs_get_dquots(struct inode *inode)
2771+
static struct dquot __rcu **f2fs_get_dquots(struct inode *inode)
27722772
{
27732773
return F2FS_I(inode)->i_dquot;
27742774
}

fs/isofs/inode.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,8 +908,22 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
908908
* we then decide whether to use the Joliet descriptor.
909909
*/
910910
inode = isofs_iget(s, sbi->s_firstdatazone, 0);
911-
if (IS_ERR(inode))
912-
goto out_no_root;
911+
912+
/*
913+
* Fix for broken CDs with a corrupt root inode but a correct Joliet
914+
* root directory.
915+
*/
916+
if (IS_ERR(inode)) {
917+
if (joliet_level && sbi->s_firstdatazone != first_data_zone) {
918+
printk(KERN_NOTICE
919+
"ISOFS: root inode is unusable. "
920+
"Disabling Rock Ridge and switching to Joliet.");
921+
sbi->s_rock = 0;
922+
inode = NULL;
923+
} else {
924+
goto out_no_root;
925+
}
926+
}
913927

914928
/*
915929
* Fix for broken CDs with Rock Ridge and empty ISO root directory but

fs/jfs/jfs_incore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ struct jfs_inode_info {
9292
} link;
9393
} u;
9494
#ifdef CONFIG_QUOTA
95-
struct dquot *i_dquot[MAXQUOTAS];
95+
struct dquot __rcu *i_dquot[MAXQUOTAS];
9696
#endif
9797
u32 dev; /* will die when we get wide dev_t */
9898
struct inode vfs_inode;

fs/jfs/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ static ssize_t jfs_quota_write(struct super_block *sb, int type,
824824
return len - towrite;
825825
}
826826

827-
static struct dquot **jfs_get_dquots(struct inode *inode)
827+
static struct dquot __rcu **jfs_get_dquots(struct inode *inode)
828828
{
829829
return JFS_IP(inode)->i_dquot;
830830
}

fs/ocfs2/inode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct ocfs2_inode_info
6565
tid_t i_sync_tid;
6666
tid_t i_datasync_tid;
6767

68-
struct dquot *i_dquot[MAXQUOTAS];
68+
struct dquot __rcu *i_dquot[MAXQUOTAS];
6969
};
7070

7171
/*

fs/ocfs2/quota_global.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,14 +447,17 @@ int ocfs2_global_write_info(struct super_block *sb, int type)
447447
int err;
448448
struct quota_info *dqopt = sb_dqopt(sb);
449449
struct ocfs2_mem_dqinfo *info = dqopt->info[type].dqi_priv;
450+
unsigned int memalloc;
450451

451452
down_write(&dqopt->dqio_sem);
453+
memalloc = memalloc_nofs_save();
452454
err = ocfs2_qinfo_lock(info, 1);
453455
if (err < 0)
454456
goto out_sem;
455457
err = __ocfs2_global_write_info(sb, type);
456458
ocfs2_qinfo_unlock(info, 1);
457459
out_sem:
460+
memalloc_nofs_restore(memalloc);
458461
up_write(&dqopt->dqio_sem);
459462
return err;
460463
}
@@ -601,6 +604,7 @@ static int ocfs2_sync_dquot_helper(struct dquot *dquot, unsigned long type)
601604
struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv;
602605
struct ocfs2_super *osb = OCFS2_SB(sb);
603606
int status = 0;
607+
unsigned int memalloc;
604608

605609
trace_ocfs2_sync_dquot_helper(from_kqid(&init_user_ns, dquot->dq_id),
606610
dquot->dq_id.type,
@@ -618,13 +622,15 @@ static int ocfs2_sync_dquot_helper(struct dquot *dquot, unsigned long type)
618622
goto out_ilock;
619623
}
620624
down_write(&sb_dqopt(sb)->dqio_sem);
625+
memalloc = memalloc_nofs_save();
621626
status = ocfs2_sync_dquot(dquot);
622627
if (status < 0)
623628
mlog_errno(status);
624629
/* We have to write local structure as well... */
625630
status = ocfs2_local_write_dquot(dquot);
626631
if (status < 0)
627632
mlog_errno(status);
633+
memalloc_nofs_restore(memalloc);
628634
up_write(&sb_dqopt(sb)->dqio_sem);
629635
ocfs2_commit_trans(osb, handle);
630636
out_ilock:
@@ -662,6 +668,7 @@ static int ocfs2_write_dquot(struct dquot *dquot)
662668
handle_t *handle;
663669
struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb);
664670
int status = 0;
671+
unsigned int memalloc;
665672

666673
trace_ocfs2_write_dquot(from_kqid(&init_user_ns, dquot->dq_id),
667674
dquot->dq_id.type);
@@ -673,7 +680,9 @@ static int ocfs2_write_dquot(struct dquot *dquot)
673680
goto out;
674681
}
675682
down_write(&sb_dqopt(dquot->dq_sb)->dqio_sem);
683+
memalloc = memalloc_nofs_save();
676684
status = ocfs2_local_write_dquot(dquot);
685+
memalloc_nofs_restore(memalloc);
677686
up_write(&sb_dqopt(dquot->dq_sb)->dqio_sem);
678687
ocfs2_commit_trans(osb, handle);
679688
out:
@@ -920,6 +929,7 @@ static int ocfs2_mark_dquot_dirty(struct dquot *dquot)
920929
struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv;
921930
handle_t *handle;
922931
struct ocfs2_super *osb = OCFS2_SB(sb);
932+
unsigned int memalloc;
923933

924934
trace_ocfs2_mark_dquot_dirty(from_kqid(&init_user_ns, dquot->dq_id),
925935
type);
@@ -946,6 +956,7 @@ static int ocfs2_mark_dquot_dirty(struct dquot *dquot)
946956
goto out_ilock;
947957
}
948958
down_write(&sb_dqopt(sb)->dqio_sem);
959+
memalloc = memalloc_nofs_save();
949960
status = ocfs2_sync_dquot(dquot);
950961
if (status < 0) {
951962
mlog_errno(status);
@@ -954,6 +965,7 @@ static int ocfs2_mark_dquot_dirty(struct dquot *dquot)
954965
/* Now write updated local dquot structure */
955966
status = ocfs2_local_write_dquot(dquot);
956967
out_dlock:
968+
memalloc_nofs_restore(memalloc);
957969
up_write(&sb_dqopt(sb)->dqio_sem);
958970
ocfs2_commit_trans(osb, handle);
959971
out_ilock:

fs/ocfs2/quota_local.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ static int ocfs2_recover_local_quota_file(struct inode *lqinode,
470470
int bit, chunk;
471471
struct ocfs2_recovery_chunk *rchunk, *next;
472472
qsize_t spacechange, inodechange;
473+
unsigned int memalloc;
473474

474475
trace_ocfs2_recover_local_quota_file((unsigned long)lqinode->i_ino, type);
475476

@@ -521,6 +522,7 @@ static int ocfs2_recover_local_quota_file(struct inode *lqinode,
521522
goto out_drop_lock;
522523
}
523524
down_write(&sb_dqopt(sb)->dqio_sem);
525+
memalloc = memalloc_nofs_save();
524526
spin_lock(&dquot->dq_dqb_lock);
525527
/* Add usage from quota entry into quota changes
526528
* of our node. Auxiliary variables are important
@@ -553,6 +555,7 @@ static int ocfs2_recover_local_quota_file(struct inode *lqinode,
553555
unlock_buffer(qbh);
554556
ocfs2_journal_dirty(handle, qbh);
555557
out_commit:
558+
memalloc_nofs_restore(memalloc);
556559
up_write(&sb_dqopt(sb)->dqio_sem);
557560
ocfs2_commit_trans(OCFS2_SB(sb), handle);
558561
out_drop_lock:

fs/ocfs2/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend);
122122
static int ocfs2_enable_quotas(struct ocfs2_super *osb);
123123
static void ocfs2_disable_quotas(struct ocfs2_super *osb);
124124

125-
static struct dquot **ocfs2_get_dquots(struct inode *inode)
125+
static struct dquot __rcu **ocfs2_get_dquots(struct inode *inode)
126126
{
127127
return OCFS2_I(inode)->i_dquot;
128128
}

0 commit comments

Comments
 (0)