super.c (3eb66e91a25497065c5322b1268cbc3953642227) | super.c (643fa9612bf1a29153eee46fd398117632f93cbe) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * linux/fs/ext4/super.c 4 * 5 * Copyright (C) 1992, 1993, 1994, 1995 6 * Remy Card (card@masi.ibp.fr) 7 * Laboratoire MASI - Institut Blaise Pascal 8 * Universite Pierre et Marie Curie (Paris VI) --- 126 unchanged lines hidden (view full) --- 135 .mount = ext4_mount, 136 .kill_sb = kill_block_super, 137 .fs_flags = FS_REQUIRES_DEV, 138}; 139MODULE_ALIAS_FS("ext3"); 140MODULE_ALIAS("ext3"); 141#define IS_EXT3_SB(sb) ((sb)->s_bdev->bd_holder == &ext3_fs_type) 142 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * linux/fs/ext4/super.c 4 * 5 * Copyright (C) 1992, 1993, 1994, 1995 6 * Remy Card (card@masi.ibp.fr) 7 * Laboratoire MASI - Institut Blaise Pascal 8 * Universite Pierre et Marie Curie (Paris VI) --- 126 unchanged lines hidden (view full) --- 135 .mount = ext4_mount, 136 .kill_sb = kill_block_super, 137 .fs_flags = FS_REQUIRES_DEV, 138}; 139MODULE_ALIAS_FS("ext3"); 140MODULE_ALIAS("ext3"); 141#define IS_EXT3_SB(sb) ((sb)->s_bdev->bd_holder == &ext3_fs_type) 142 |
143/* 144 * This works like sb_bread() except it uses ERR_PTR for error 145 * returns. Currently with sb_bread it's impossible to distinguish 146 * between ENOMEM and EIO situations (since both result in a NULL 147 * return. 148 */ 149struct buffer_head * 150ext4_sb_bread(struct super_block *sb, sector_t block, int op_flags) 151{ 152 struct buffer_head *bh = sb_getblk(sb, block); 153 154 if (bh == NULL) 155 return ERR_PTR(-ENOMEM); 156 if (buffer_uptodate(bh)) 157 return bh; 158 ll_rw_block(REQ_OP_READ, REQ_META | op_flags, 1, &bh); 159 wait_on_buffer(bh); 160 if (buffer_uptodate(bh)) 161 return bh; 162 put_bh(bh); 163 return ERR_PTR(-EIO); 164} 165 |
|
143static int ext4_verify_csum_type(struct super_block *sb, 144 struct ext4_super_block *es) 145{ 146 if (!ext4_has_feature_metadata_csum(sb)) 147 return 1; 148 149 return es->s_checksum_type == EXT4_CRC32C_CHKSUM; 150} --- 844 unchanged lines hidden (view full) --- 995 * Invalidate the journal device's buffers. We don't want them 996 * floating about in memory - the physical journal device may 997 * hotswapped, and it breaks the `ro-after' testing code. 998 */ 999 sync_blockdev(sbi->journal_bdev); 1000 invalidate_bdev(sbi->journal_bdev); 1001 ext4_blkdev_remove(sbi); 1002 } | 166static int ext4_verify_csum_type(struct super_block *sb, 167 struct ext4_super_block *es) 168{ 169 if (!ext4_has_feature_metadata_csum(sb)) 170 return 1; 171 172 return es->s_checksum_type == EXT4_CRC32C_CHKSUM; 173} --- 844 unchanged lines hidden (view full) --- 1018 * Invalidate the journal device's buffers. We don't want them 1019 * floating about in memory - the physical journal device may 1020 * hotswapped, and it breaks the `ro-after' testing code. 1021 */ 1022 sync_blockdev(sbi->journal_bdev); 1023 invalidate_bdev(sbi->journal_bdev); 1024 ext4_blkdev_remove(sbi); 1025 } |
1003 if (sbi->s_ea_inode_cache) { 1004 ext4_xattr_destroy_cache(sbi->s_ea_inode_cache); 1005 sbi->s_ea_inode_cache = NULL; 1006 } 1007 if (sbi->s_ea_block_cache) { 1008 ext4_xattr_destroy_cache(sbi->s_ea_block_cache); 1009 sbi->s_ea_block_cache = NULL; 1010 } | 1026 1027 ext4_xattr_destroy_cache(sbi->s_ea_inode_cache); 1028 sbi->s_ea_inode_cache = NULL; 1029 1030 ext4_xattr_destroy_cache(sbi->s_ea_block_cache); 1031 sbi->s_ea_block_cache = NULL; 1032 |
1011 if (sbi->s_mmp_tsk) 1012 kthread_stop(sbi->s_mmp_tsk); 1013 brelse(sbi->s_sbh); 1014 sb->s_fs_info = NULL; 1015 /* 1016 * Now that we are completely done shutting down the 1017 * superblock, we need to actually destroy the kobject. 1018 */ --- 127 unchanged lines hidden (view full) --- 1146 fscrypt_put_encryption_info(inode); 1147} 1148 1149static struct inode *ext4_nfs_get_inode(struct super_block *sb, 1150 u64 ino, u32 generation) 1151{ 1152 struct inode *inode; 1153 | 1033 if (sbi->s_mmp_tsk) 1034 kthread_stop(sbi->s_mmp_tsk); 1035 brelse(sbi->s_sbh); 1036 sb->s_fs_info = NULL; 1037 /* 1038 * Now that we are completely done shutting down the 1039 * superblock, we need to actually destroy the kobject. 1040 */ --- 127 unchanged lines hidden (view full) --- 1168 fscrypt_put_encryption_info(inode); 1169} 1170 1171static struct inode *ext4_nfs_get_inode(struct super_block *sb, 1172 u64 ino, u32 generation) 1173{ 1174 struct inode *inode; 1175 |
1154 if (ino < EXT4_FIRST_INO(sb) && ino != EXT4_ROOT_INO) 1155 return ERR_PTR(-ESTALE); 1156 if (ino > le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count)) 1157 return ERR_PTR(-ESTALE); 1158 1159 /* iget isn't really right if the inode is currently unallocated!! 1160 * 1161 * ext4_read_inode will return a bad_inode if the inode had been 1162 * deleted, so we should be safe. 1163 * | 1176 /* |
1164 * Currently we don't know the generation for parent directory, so 1165 * a generation of 0 means "accept any" 1166 */ | 1177 * Currently we don't know the generation for parent directory, so 1178 * a generation of 0 means "accept any" 1179 */ |
1167 inode = ext4_iget_normal(sb, ino); | 1180 inode = ext4_iget(sb, ino, EXT4_IGET_HANDLE); |
1168 if (IS_ERR(inode)) 1169 return ERR_CAST(inode); 1170 if (generation && inode->i_generation != generation) { 1171 iput(inode); 1172 return ERR_PTR(-ESTALE); 1173 } 1174 1175 return inode; --- 8 unchanged lines hidden (view full) --- 1184 1185static struct dentry *ext4_fh_to_parent(struct super_block *sb, struct fid *fid, 1186 int fh_len, int fh_type) 1187{ 1188 return generic_fh_to_parent(sb, fid, fh_len, fh_type, 1189 ext4_nfs_get_inode); 1190} 1191 | 1181 if (IS_ERR(inode)) 1182 return ERR_CAST(inode); 1183 if (generation && inode->i_generation != generation) { 1184 iput(inode); 1185 return ERR_PTR(-ESTALE); 1186 } 1187 1188 return inode; --- 8 unchanged lines hidden (view full) --- 1197 1198static struct dentry *ext4_fh_to_parent(struct super_block *sb, struct fid *fid, 1199 int fh_len, int fh_type) 1200{ 1201 return generic_fh_to_parent(sb, fid, fh_len, fh_type, 1202 ext4_nfs_get_inode); 1203} 1204 |
1205static int ext4_nfs_commit_metadata(struct inode *inode) 1206{ 1207 struct writeback_control wbc = { 1208 .sync_mode = WB_SYNC_ALL 1209 }; 1210 1211 trace_ext4_nfs_commit_metadata(inode); 1212 return ext4_write_inode(inode, &wbc); 1213} 1214 |
|
1192/* 1193 * Try to release metadata pages (indirect blocks, directories) which are 1194 * mapped via the block device. Since these pages could have journal heads 1195 * which would prevent try_to_free_buffers() from freeing them, we must use 1196 * jbd2 layer's try_to_free_buffers() function to release them. 1197 */ 1198static int bdev_try_to_free_page(struct super_block *sb, struct page *page, 1199 gfp_t wait) --- 4 unchanged lines hidden (view full) --- 1204 if (!page_has_buffers(page)) 1205 return 0; 1206 if (journal) 1207 return jbd2_journal_try_to_free_buffers(journal, page, 1208 wait & ~__GFP_DIRECT_RECLAIM); 1209 return try_to_free_buffers(page); 1210} 1211 | 1215/* 1216 * Try to release metadata pages (indirect blocks, directories) which are 1217 * mapped via the block device. Since these pages could have journal heads 1218 * which would prevent try_to_free_buffers() from freeing them, we must use 1219 * jbd2 layer's try_to_free_buffers() function to release them. 1220 */ 1221static int bdev_try_to_free_page(struct super_block *sb, struct page *page, 1222 gfp_t wait) --- 4 unchanged lines hidden (view full) --- 1227 if (!page_has_buffers(page)) 1228 return 0; 1229 if (journal) 1230 return jbd2_journal_try_to_free_buffers(journal, page, 1231 wait & ~__GFP_DIRECT_RECLAIM); 1232 return try_to_free_buffers(page); 1233} 1234 |
1212#ifdef CONFIG_EXT4_FS_ENCRYPTION | 1235#ifdef CONFIG_FS_ENCRYPTION |
1213static int ext4_get_context(struct inode *inode, void *ctx, size_t len) 1214{ 1215 return ext4_xattr_get(inode, EXT4_XATTR_INDEX_ENCRYPTION, 1216 EXT4_XATTR_NAME_ENCRYPTION_CONTEXT, ctx, len); 1217} 1218 1219static int ext4_set_context(struct inode *inode, const void *ctx, size_t len, 1220 void *fs_data) --- 167 unchanged lines hidden (view full) --- 1388#endif 1389 .bdev_try_to_free_page = bdev_try_to_free_page, 1390}; 1391 1392static const struct export_operations ext4_export_ops = { 1393 .fh_to_dentry = ext4_fh_to_dentry, 1394 .fh_to_parent = ext4_fh_to_parent, 1395 .get_parent = ext4_get_parent, | 1236static int ext4_get_context(struct inode *inode, void *ctx, size_t len) 1237{ 1238 return ext4_xattr_get(inode, EXT4_XATTR_INDEX_ENCRYPTION, 1239 EXT4_XATTR_NAME_ENCRYPTION_CONTEXT, ctx, len); 1240} 1241 1242static int ext4_set_context(struct inode *inode, const void *ctx, size_t len, 1243 void *fs_data) --- 167 unchanged lines hidden (view full) --- 1411#endif 1412 .bdev_try_to_free_page = bdev_try_to_free_page, 1413}; 1414 1415static const struct export_operations ext4_export_ops = { 1416 .fh_to_dentry = ext4_fh_to_dentry, 1417 .fh_to_parent = ext4_fh_to_parent, 1418 .get_parent = ext4_get_parent, |
1419 .commit_metadata = ext4_nfs_commit_metadata, |
|
1396}; 1397 1398enum { 1399 Opt_bsd_df, Opt_minix_df, Opt_grpid, Opt_nogrpid, 1400 Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic, Opt_err_ro, 1401 Opt_nouid32, Opt_debug, Opt_removed, 1402 Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl, 1403 Opt_auto_da_alloc, Opt_noauto_da_alloc, Opt_noload, --- 489 unchanged lines hidden (view full) --- 1893 if (arg > 7) { 1894 ext4_msg(sb, KERN_ERR, "Invalid journal IO priority" 1895 " (must be 0-7)"); 1896 return -1; 1897 } 1898 *journal_ioprio = 1899 IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, arg); 1900 } else if (token == Opt_test_dummy_encryption) { | 1420}; 1421 1422enum { 1423 Opt_bsd_df, Opt_minix_df, Opt_grpid, Opt_nogrpid, 1424 Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic, Opt_err_ro, 1425 Opt_nouid32, Opt_debug, Opt_removed, 1426 Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl, 1427 Opt_auto_da_alloc, Opt_noauto_da_alloc, Opt_noload, --- 489 unchanged lines hidden (view full) --- 1917 if (arg > 7) { 1918 ext4_msg(sb, KERN_ERR, "Invalid journal IO priority" 1919 " (must be 0-7)"); 1920 return -1; 1921 } 1922 *journal_ioprio = 1923 IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, arg); 1924 } else if (token == Opt_test_dummy_encryption) { |
1901#ifdef CONFIG_EXT4_FS_ENCRYPTION | 1925#ifdef CONFIG_FS_ENCRYPTION |
1902 sbi->s_mount_flags |= EXT4_MF_TEST_DUMMY_ENCRYPTION; 1903 ext4_msg(sb, KERN_WARNING, 1904 "Test dummy encryption mode enabled"); 1905#else 1906 ext4_msg(sb, KERN_WARNING, 1907 "Test dummy encryption mount option ignored"); 1908#endif 1909 } else if (m->flags & MOPT_DATAJ) { --- 24 unchanged lines hidden (view full) --- 1934 return 1; 1935 } 1936 sbi->s_jquota_fmt = m->mount_opt; 1937#endif 1938 } else if (token == Opt_dax) { 1939#ifdef CONFIG_FS_DAX 1940 ext4_msg(sb, KERN_WARNING, 1941 "DAX enabled. Warning: EXPERIMENTAL, use at your own risk"); | 1926 sbi->s_mount_flags |= EXT4_MF_TEST_DUMMY_ENCRYPTION; 1927 ext4_msg(sb, KERN_WARNING, 1928 "Test dummy encryption mode enabled"); 1929#else 1930 ext4_msg(sb, KERN_WARNING, 1931 "Test dummy encryption mount option ignored"); 1932#endif 1933 } else if (m->flags & MOPT_DATAJ) { --- 24 unchanged lines hidden (view full) --- 1958 return 1; 1959 } 1960 sbi->s_jquota_fmt = m->mount_opt; 1961#endif 1962 } else if (token == Opt_dax) { 1963#ifdef CONFIG_FS_DAX 1964 ext4_msg(sb, KERN_WARNING, 1965 "DAX enabled. Warning: EXPERIMENTAL, use at your own risk"); |
1942 sbi->s_mount_opt |= m->mount_opt; | 1966 sbi->s_mount_opt |= m->mount_opt; |
1943#else 1944 ext4_msg(sb, KERN_INFO, "dax option not supported"); 1945 return -1; 1946#endif 1947 } else if (token == Opt_data_err_abort) { 1948 sbi->s_mount_opt |= m->mount_opt; 1949 } else if (token == Opt_data_err_ignore) { 1950 sbi->s_mount_opt &= ~m->mount_opt; --- 1886 unchanged lines hidden (view full) --- 3837 le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks)); 3838 goto failed_mount; 3839 } 3840 3841 if (sbi->s_mount_opt & EXT4_MOUNT_DAX) { 3842 if (ext4_has_feature_inline_data(sb)) { 3843 ext4_msg(sb, KERN_ERR, "Cannot use DAX on a filesystem" 3844 " that may contain inline data"); | 1967#else 1968 ext4_msg(sb, KERN_INFO, "dax option not supported"); 1969 return -1; 1970#endif 1971 } else if (token == Opt_data_err_abort) { 1972 sbi->s_mount_opt |= m->mount_opt; 1973 } else if (token == Opt_data_err_ignore) { 1974 sbi->s_mount_opt &= ~m->mount_opt; --- 1886 unchanged lines hidden (view full) --- 3861 le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks)); 3862 goto failed_mount; 3863 } 3864 3865 if (sbi->s_mount_opt & EXT4_MOUNT_DAX) { 3866 if (ext4_has_feature_inline_data(sb)) { 3867 ext4_msg(sb, KERN_ERR, "Cannot use DAX on a filesystem" 3868 " that may contain inline data"); |
3845 sbi->s_mount_opt &= ~EXT4_MOUNT_DAX; | 3869 goto failed_mount; |
3846 } 3847 if (!bdev_dax_supported(sb->s_bdev, blocksize)) { 3848 ext4_msg(sb, KERN_ERR, | 3870 } 3871 if (!bdev_dax_supported(sb->s_bdev, blocksize)) { 3872 ext4_msg(sb, KERN_ERR, |
3849 "DAX unsupported by block device. Turning off DAX."); 3850 sbi->s_mount_opt &= ~EXT4_MOUNT_DAX; | 3873 "DAX unsupported by block device."); 3874 goto failed_mount; |
3851 } 3852 } 3853 3854 if (ext4_has_feature_encrypt(sb) && es->s_encryption_level) { 3855 ext4_msg(sb, KERN_ERR, "Unsupported encryption level %d", 3856 es->s_encryption_level); 3857 goto failed_mount; 3858 } --- 279 unchanged lines hidden (view full) --- 4138 sbi->s_extent_max_zeroout_kb = 32; 4139 4140 /* 4141 * set up enough so that it can read an inode 4142 */ 4143 sb->s_op = &ext4_sops; 4144 sb->s_export_op = &ext4_export_ops; 4145 sb->s_xattr = ext4_xattr_handlers; | 3875 } 3876 } 3877 3878 if (ext4_has_feature_encrypt(sb) && es->s_encryption_level) { 3879 ext4_msg(sb, KERN_ERR, "Unsupported encryption level %d", 3880 es->s_encryption_level); 3881 goto failed_mount; 3882 } --- 279 unchanged lines hidden (view full) --- 4162 sbi->s_extent_max_zeroout_kb = 32; 4163 4164 /* 4165 * set up enough so that it can read an inode 4166 */ 4167 sb->s_op = &ext4_sops; 4168 sb->s_export_op = &ext4_export_ops; 4169 sb->s_xattr = ext4_xattr_handlers; |
4146#ifdef CONFIG_EXT4_FS_ENCRYPTION | 4170#ifdef CONFIG_FS_ENCRYPTION |
4147 sb->s_cop = &ext4_cryptops; 4148#endif 4149#ifdef CONFIG_QUOTA 4150 sb->dq_op = &ext4_quota_operations; 4151 if (ext4_has_feature_quota(sb)) 4152 sb->s_qcop = &dquot_quotactl_sysfile_ops; 4153 else 4154 sb->s_qcop = &ext4_qctl_operations; --- 168 unchanged lines hidden (view full) --- 4323 goto failed_mount4; 4324 } 4325 4326 /* 4327 * The jbd2_journal_load will have done any necessary log recovery, 4328 * so we can safely mount the rest of the filesystem now. 4329 */ 4330 | 4171 sb->s_cop = &ext4_cryptops; 4172#endif 4173#ifdef CONFIG_QUOTA 4174 sb->dq_op = &ext4_quota_operations; 4175 if (ext4_has_feature_quota(sb)) 4176 sb->s_qcop = &dquot_quotactl_sysfile_ops; 4177 else 4178 sb->s_qcop = &ext4_qctl_operations; --- 168 unchanged lines hidden (view full) --- 4347 goto failed_mount4; 4348 } 4349 4350 /* 4351 * The jbd2_journal_load will have done any necessary log recovery, 4352 * so we can safely mount the rest of the filesystem now. 4353 */ 4354 |
4331 root = ext4_iget(sb, EXT4_ROOT_INO); | 4355 root = ext4_iget(sb, EXT4_ROOT_INO, EXT4_IGET_SPECIAL); |
4332 if (IS_ERR(root)) { 4333 ext4_msg(sb, KERN_ERR, "get root inode failed"); 4334 ret = PTR_ERR(root); 4335 root = NULL; 4336 goto failed_mount4; 4337 } 4338 if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { 4339 ext4_msg(sb, KERN_ERR, "corrupt root inode, run e2fsck"); --- 177 unchanged lines hidden (view full) --- 4517failed_mount4a: 4518 dput(sb->s_root); 4519 sb->s_root = NULL; 4520failed_mount4: 4521 ext4_msg(sb, KERN_ERR, "mount failed"); 4522 if (EXT4_SB(sb)->rsv_conversion_wq) 4523 destroy_workqueue(EXT4_SB(sb)->rsv_conversion_wq); 4524failed_mount_wq: | 4356 if (IS_ERR(root)) { 4357 ext4_msg(sb, KERN_ERR, "get root inode failed"); 4358 ret = PTR_ERR(root); 4359 root = NULL; 4360 goto failed_mount4; 4361 } 4362 if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { 4363 ext4_msg(sb, KERN_ERR, "corrupt root inode, run e2fsck"); --- 177 unchanged lines hidden (view full) --- 4541failed_mount4a: 4542 dput(sb->s_root); 4543 sb->s_root = NULL; 4544failed_mount4: 4545 ext4_msg(sb, KERN_ERR, "mount failed"); 4546 if (EXT4_SB(sb)->rsv_conversion_wq) 4547 destroy_workqueue(EXT4_SB(sb)->rsv_conversion_wq); 4548failed_mount_wq: |
4525 if (sbi->s_ea_inode_cache) { 4526 ext4_xattr_destroy_cache(sbi->s_ea_inode_cache); 4527 sbi->s_ea_inode_cache = NULL; 4528 } 4529 if (sbi->s_ea_block_cache) { 4530 ext4_xattr_destroy_cache(sbi->s_ea_block_cache); 4531 sbi->s_ea_block_cache = NULL; 4532 } | 4549 ext4_xattr_destroy_cache(sbi->s_ea_inode_cache); 4550 sbi->s_ea_inode_cache = NULL; 4551 4552 ext4_xattr_destroy_cache(sbi->s_ea_block_cache); 4553 sbi->s_ea_block_cache = NULL; 4554 |
4533 if (sbi->s_journal) { 4534 jbd2_journal_destroy(sbi->s_journal); 4535 sbi->s_journal = NULL; 4536 } 4537failed_mount3a: 4538 ext4_es_unregister_shrinker(sbi); 4539failed_mount3: 4540 del_timer_sync(&sbi->s_err_report); --- 52 unchanged lines hidden (view full) --- 4593{ 4594 struct inode *journal_inode; 4595 4596 /* 4597 * Test for the existence of a valid inode on disk. Bad things 4598 * happen if we iget() an unused inode, as the subsequent iput() 4599 * will try to delete it. 4600 */ | 4555 if (sbi->s_journal) { 4556 jbd2_journal_destroy(sbi->s_journal); 4557 sbi->s_journal = NULL; 4558 } 4559failed_mount3a: 4560 ext4_es_unregister_shrinker(sbi); 4561failed_mount3: 4562 del_timer_sync(&sbi->s_err_report); --- 52 unchanged lines hidden (view full) --- 4615{ 4616 struct inode *journal_inode; 4617 4618 /* 4619 * Test for the existence of a valid inode on disk. Bad things 4620 * happen if we iget() an unused inode, as the subsequent iput() 4621 * will try to delete it. 4622 */ |
4601 journal_inode = ext4_iget(sb, journal_inum); | 4623 journal_inode = ext4_iget(sb, journal_inum, EXT4_IGET_SPECIAL); |
4602 if (IS_ERR(journal_inode)) { 4603 ext4_msg(sb, KERN_ERR, "no journal found"); 4604 return NULL; 4605 } 4606 if (!journal_inode->i_nlink) { 4607 make_bad_inode(journal_inode); 4608 iput(journal_inode); 4609 ext4_msg(sb, KERN_ERR, "journal inode is deleted"); --- 265 unchanged lines hidden (view full) --- 4875 if (percpu_counter_initialized(&EXT4_SB(sb)->s_freeinodes_counter)) 4876 es->s_free_inodes_count = 4877 cpu_to_le32(percpu_counter_sum_positive( 4878 &EXT4_SB(sb)->s_freeinodes_counter)); 4879 BUFFER_TRACE(sbh, "marking dirty"); 4880 ext4_superblock_csum_set(sb); 4881 if (sync) 4882 lock_buffer(sbh); | 4624 if (IS_ERR(journal_inode)) { 4625 ext4_msg(sb, KERN_ERR, "no journal found"); 4626 return NULL; 4627 } 4628 if (!journal_inode->i_nlink) { 4629 make_bad_inode(journal_inode); 4630 iput(journal_inode); 4631 ext4_msg(sb, KERN_ERR, "journal inode is deleted"); --- 265 unchanged lines hidden (view full) --- 4897 if (percpu_counter_initialized(&EXT4_SB(sb)->s_freeinodes_counter)) 4898 es->s_free_inodes_count = 4899 cpu_to_le32(percpu_counter_sum_positive( 4900 &EXT4_SB(sb)->s_freeinodes_counter)); 4901 BUFFER_TRACE(sbh, "marking dirty"); 4902 ext4_superblock_csum_set(sb); 4903 if (sync) 4904 lock_buffer(sbh); |
4883 if (buffer_write_io_error(sbh)) { | 4905 if (buffer_write_io_error(sbh) || !buffer_uptodate(sbh)) { |
4884 /* 4885 * Oh, dear. A previous attempt to write the 4886 * superblock failed. This could happen because the 4887 * USB device was yanked out. Or it could happen to 4888 * be a transient write error and maybe the block will 4889 * be remapped. Nothing we can do but to retry the 4890 * write and hope for the best. 4891 */ --- 783 unchanged lines hidden (view full) --- 5675 le32_to_cpu(EXT4_SB(sb)->s_es->s_prj_quota_inum) 5676 }; 5677 5678 BUG_ON(!ext4_has_feature_quota(sb)); 5679 5680 if (!qf_inums[type]) 5681 return -EPERM; 5682 | 4906 /* 4907 * Oh, dear. A previous attempt to write the 4908 * superblock failed. This could happen because the 4909 * USB device was yanked out. Or it could happen to 4910 * be a transient write error and maybe the block will 4911 * be remapped. Nothing we can do but to retry the 4912 * write and hope for the best. 4913 */ --- 783 unchanged lines hidden (view full) --- 5697 le32_to_cpu(EXT4_SB(sb)->s_es->s_prj_quota_inum) 5698 }; 5699 5700 BUG_ON(!ext4_has_feature_quota(sb)); 5701 5702 if (!qf_inums[type]) 5703 return -EPERM; 5704 |
5683 qf_inode = ext4_iget(sb, qf_inums[type]); | 5705 qf_inode = ext4_iget(sb, qf_inums[type], EXT4_IGET_SPECIAL); |
5684 if (IS_ERR(qf_inode)) { 5685 ext4_error(sb, "Bad quota inode # %lu", qf_inums[type]); 5686 return PTR_ERR(qf_inode); 5687 } 5688 5689 /* Don't account quota for quota files to avoid recursion */ 5690 qf_inode->i_flags |= S_NOQUOTA; 5691 lockdep_set_quota_inode(qf_inode, I_DATA_SEM_QUOTA); 5692 err = dquot_enable(qf_inode, type, format_id, flags); | 5706 if (IS_ERR(qf_inode)) { 5707 ext4_error(sb, "Bad quota inode # %lu", qf_inums[type]); 5708 return PTR_ERR(qf_inode); 5709 } 5710 5711 /* Don't account quota for quota files to avoid recursion */ 5712 qf_inode->i_flags |= S_NOQUOTA; 5713 lockdep_set_quota_inode(qf_inode, I_DATA_SEM_QUOTA); 5714 err = dquot_enable(qf_inode, type, format_id, flags); |
5693 iput(qf_inode); | |
5694 if (err) 5695 lockdep_set_quota_inode(qf_inode, I_DATA_SEM_NORMAL); | 5715 if (err) 5716 lockdep_set_quota_inode(qf_inode, I_DATA_SEM_NORMAL); |
5717 iput(qf_inode); |
|
5696 5697 return err; 5698} 5699 5700/* Enable usage tracking for all quota types. */ 5701static int ext4_enable_quotas(struct super_block *sb) 5702{ 5703 int type, err = 0; --- 348 unchanged lines hidden --- | 5718 5719 return err; 5720} 5721 5722/* Enable usage tracking for all quota types. */ 5723static int ext4_enable_quotas(struct super_block *sb) 5724{ 5725 int type, err = 0; --- 348 unchanged lines hidden --- |