]> 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 23e7acd43e4ee7e9b4d37e9762948f1e982126f4..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;
 }
@@ -1875,6 +1878,13 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
        } else if (token == Opt_commit) {
                if (arg == 0)
                        arg = JBD2_DEFAULT_MAX_COMMIT_AGE;
+               else if (arg > INT_MAX / HZ) {
+                       ext4_msg(sb, KERN_ERR,
+                                "Invalid commit interval %d, "
+                                "must be smaller than %d",
+                                arg, INT_MAX / HZ);
+                       return -1;
+               }
                sbi->s_commit_interval = HZ * arg;
        } else if (token == Opt_debug_want_extra_isize) {
                sbi->s_want_extra_isize = arg;
@@ -4036,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);