hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/fs/ext4/ioctl.c
....@@ -121,7 +121,8 @@
121121 blkcnt_t blocks;
122122 unsigned short bytes;
123123
124
- inode_bl = ext4_iget(sb, EXT4_BOOT_LOADER_INO, EXT4_IGET_SPECIAL);
124
+ inode_bl = ext4_iget(sb, EXT4_BOOT_LOADER_INO,
125
+ EXT4_IGET_SPECIAL | EXT4_IGET_BAD);
125126 if (IS_ERR(inode_bl))
126127 return PTR_ERR(inode_bl);
127128 ei_bl = EXT4_I(inode_bl);
....@@ -170,7 +171,7 @@
170171 /* Protect extent tree against block allocations via delalloc */
171172 ext4_double_down_write_data_sem(inode, inode_bl);
172173
173
- if (inode_bl->i_nlink == 0) {
174
+ if (is_bad_inode(inode_bl) || !S_ISREG(inode_bl->i_mode)) {
174175 /* this inode has never been used as a BOOT_LOADER */
175176 set_nlink(inode_bl, 1);
176177 i_uid_write(inode_bl, 0);
....@@ -179,6 +180,7 @@
179180 ei_bl->i_flags = 0;
180181 inode_set_iversion(inode_bl, 1);
181182 i_size_write(inode_bl, 0);
183
+ EXT4_I(inode_bl)->i_disksize = inode_bl->i_size;
182184 inode_bl->i_mode = S_IFREG;
183185 if (ext4_has_feature_extents(sb)) {
184186 ext4_set_inode_flag(inode_bl, EXT4_INODE_EXTENTS);
....@@ -494,6 +496,10 @@
494496 if (ext4_is_quota_file(inode))
495497 return err;
496498
499
+ err = dquot_initialize(inode);
500
+ if (err)
501
+ return err;
502
+
497503 err = ext4_get_inode_loc(inode, &iloc);
498504 if (err)
499505 return err;
....@@ -508,10 +514,6 @@
508514 } else {
509515 brelse(iloc.bh);
510516 }
511
-
512
- err = dquot_initialize(inode);
513
- if (err)
514
- return err;
515517
516518 handle = ext4_journal_start(inode, EXT4_HT_QUOTA,
517519 EXT4_QUOTA_INIT_BLOCKS(sb) +
....@@ -610,6 +612,7 @@
610612 {
611613 struct ext4_sb_info *sbi = EXT4_SB(sb);
612614 __u32 flags;
615
+ int ret;
613616
614617 if (!capable(CAP_SYS_ADMIN))
615618 return -EPERM;
....@@ -628,7 +631,9 @@
628631
629632 switch (flags) {
630633 case EXT4_GOING_FLAGS_DEFAULT:
631
- freeze_bdev(sb->s_bdev);
634
+ ret = freeze_bdev(sb->s_bdev);
635
+ if (ret)
636
+ return ret;
632637 set_bit(EXT4_FLAGS_SHUTDOWN, &sbi->s_ext4_flags);
633638 thaw_bdev(sb->s_bdev);
634639 break;
....@@ -1326,13 +1331,7 @@
13261331
13271332 long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
13281333 {
1329
- long ret;
1330
-
1331
- ext4_fc_start_update(file_inode(filp));
1332
- ret = __ext4_ioctl(filp, cmd, arg);
1333
- ext4_fc_stop_update(file_inode(filp));
1334
-
1335
- return ret;
1334
+ return __ext4_ioctl(filp, cmd, arg);
13361335 }
13371336
13381337 #ifdef CONFIG_COMPAT