]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - fs/ext4/super.c
Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm
[linux.git] / fs / ext4 / super.c
index 7310facffa9d7a9d7bcb24d2a051714309f8a49c..dd654e53ba3d982d99c05b2336dd4de9132b0978 100644 (file)
@@ -1107,6 +1107,9 @@ static int ext4_drop_inode(struct inode *inode)
 {
        int drop = generic_drop_inode(inode);
 
+       if (!drop)
+               drop = fscrypt_drop_inode(inode);
+
        trace_ext4_drop_inode(inode, drop);
        return drop;
 }
@@ -1179,6 +1182,7 @@ void ext4_clear_inode(struct inode *inode)
                EXT4_I(inode)->jinode = NULL;
        }
        fscrypt_put_encryption_info(inode);
+       fsverity_cleanup_inode(inode);
 }
 
 static struct inode *ext4_nfs_get_inode(struct super_block *sb,
@@ -4042,8 +4046,21 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
                               sbi->s_inode_size);
                        goto failed_mount;
                }
-               if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE)
-                       sb->s_time_gran = 1 << (EXT4_EPOCH_BITS - 2);
+               /*
+                * i_atime_extra is the last extra field available for [acm]times in
+                * struct ext4_inode. Checking for that field should suffice to ensure
+                * we have extra space for all three.
+                */
+               if (sbi->s_inode_size >= offsetof(struct ext4_inode, i_atime_extra) +
+                       sizeof(((struct ext4_inode *)0)->i_atime_extra)) {
+                       sb->s_time_gran = 1;
+                       sb->s_time_max = EXT4_EXTRA_TIMESTAMP_MAX;
+               } else {
+                       sb->s_time_gran = NSEC_PER_SEC;
+                       sb->s_time_max = EXT4_NON_EXTRA_TIMESTAMP_MAX;
+               }
+
+               sb->s_time_min = EXT4_TIMESTAMP_MIN;
        }
 
        sbi->s_desc_size = le16_to_cpu(es->s_desc_size);
@@ -4279,6 +4296,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 #ifdef CONFIG_FS_ENCRYPTION
        sb->s_cop = &ext4_cryptops;
 #endif
+#ifdef CONFIG_FS_VERITY
+       sb->s_vop = &ext4_verityops;
+#endif
 #ifdef CONFIG_QUOTA
        sb->dq_op = &ext4_quota_operations;
        if (ext4_has_feature_quota(sb))
@@ -4426,6 +4446,11 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
                goto failed_mount_wq;
        }
 
+       if (ext4_has_feature_verity(sb) && blocksize != PAGE_SIZE) {
+               ext4_msg(sb, KERN_ERR, "Unsupported blocksize for fs-verity");
+               goto failed_mount_wq;
+       }
+
        if (DUMMY_ENCRYPTION_ENABLED(sbi) && !sb_rdonly(sb) &&
            !ext4_has_feature_encrypt(sb)) {
                ext4_set_feature_encrypt(sb);
@@ -6101,6 +6126,10 @@ static int __init ext4_init_fs(void)
                return err;
 
        err = ext4_init_pending();
+       if (err)
+               goto out7;
+
+       err = ext4_init_post_read_processing();
        if (err)
                goto out6;
 
@@ -6142,8 +6171,10 @@ static int __init ext4_init_fs(void)
 out4:
        ext4_exit_pageio();
 out5:
-       ext4_exit_pending();
+       ext4_exit_post_read_processing();
 out6:
+       ext4_exit_pending();
+out7:
        ext4_exit_es();
 
        return err;
@@ -6160,6 +6191,7 @@ static void __exit ext4_exit_fs(void)
        ext4_exit_sysfs();
        ext4_exit_system_zone();
        ext4_exit_pageio();
+       ext4_exit_post_read_processing();
        ext4_exit_es();
        ext4_exit_pending();
 }