Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 21 Sep 2019 20:37:39 +0000 (13:37 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 21 Sep 2019 20:37:39 +0000 (13:37 -0700)
Pull ext4 updates from Ted Ts'o:
 "Added new ext4 debugging ioctls to allow userspace to get information
  about the state of the extent status cache.

  Dropped workaround for pre-1970 dates which were encoded incorrectly
  in pre-4.4 kernels. Since both the kernel correctly generates, and
  e2fsck detects and fixes this issue for the past four years, it'e time
  to drop the workaround. (Also, it's not like files with dates in the
  distant past were all that common in the first place.)

  A lot of miscellaneous bug fixes and cleanups, including some ext4
  Documentation fixes. Also included are two minor bug fixes in
  fs/unicode"

* tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (21 commits)
  unicode: make array 'token' static const, makes object smaller
  unicode: Move static keyword to the front of declarations
  ext4: add missing bigalloc documentation.
  ext4: fix kernel oops caused by spurious casefold flag
  ext4: fix integer overflow when calculating commit interval
  ext4: use percpu_counters for extent_status cache hits/misses
  ext4: fix potential use after free after remounting with noblock_validity
  jbd2: add missing tracepoint for reserved handle
  ext4: fix punch hole for inline_data file systems
  ext4: rework reserved cluster accounting when invalidating pages
  ext4: documentation fixes
  ext4: treat buffers with write errors as containing valid data
  ext4: fix warning inside ext4_convert_unwritten_extents_endio
  ext4: set error return correctly when ext4_htree_store_dirent fails
  ext4: drop legacy pre-1970 encoding workaround
  ext4: add new ioctl EXT4_IOC_GET_ES_CACHE
  ext4: add a new ioctl EXT4_IOC_GETSTATE
  ext4: add a new ioctl EXT4_IOC_CLEAR_ES_CACHE
  jbd2: flush_descriptor(): Do not decrease buffer head's ref count
  ext4: remove unnecessary error check
  ...

1  2 
Documentation/filesystems/ext4/inodes.rst
Documentation/filesystems/ext4/super.rst
fs/ext4/ext4.h
fs/ext4/file.c
fs/ext4/inode.c
fs/ext4/ioctl.c
fs/ext4/super.c

diff --cc fs/ext4/ext4.h
Simple merge
diff --cc fs/ext4/file.c
Simple merge
diff --cc fs/ext4/inode.c
Simple merge
diff --cc fs/ext4/ioctl.c
index 5444d49cbf09de4a44861088c90b2c33a1b144b0,d6242b7b8718202fdff3136efd398d9a427f4dc4..0b7f316fd30f41391f9587487dbc41e204d5efae
@@@ -1113,35 -1181,35 +1181,62 @@@ resizefs_out
  #endif
        }
        case EXT4_IOC_GET_ENCRYPTION_POLICY:
 +              if (!ext4_has_feature_encrypt(sb))
 +                      return -EOPNOTSUPP;
                return fscrypt_ioctl_get_policy(filp, (void __user *)arg);
  
 +      case FS_IOC_GET_ENCRYPTION_POLICY_EX:
 +              if (!ext4_has_feature_encrypt(sb))
 +                      return -EOPNOTSUPP;
 +              return fscrypt_ioctl_get_policy_ex(filp, (void __user *)arg);
 +
 +      case FS_IOC_ADD_ENCRYPTION_KEY:
 +              if (!ext4_has_feature_encrypt(sb))
 +                      return -EOPNOTSUPP;
 +              return fscrypt_ioctl_add_key(filp, (void __user *)arg);
 +
 +      case FS_IOC_REMOVE_ENCRYPTION_KEY:
 +              if (!ext4_has_feature_encrypt(sb))
 +                      return -EOPNOTSUPP;
 +              return fscrypt_ioctl_remove_key(filp, (void __user *)arg);
 +
 +      case FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS:
 +              if (!ext4_has_feature_encrypt(sb))
 +                      return -EOPNOTSUPP;
 +              return fscrypt_ioctl_remove_key_all_users(filp,
 +                                                        (void __user *)arg);
 +      case FS_IOC_GET_ENCRYPTION_KEY_STATUS:
 +              if (!ext4_has_feature_encrypt(sb))
 +                      return -EOPNOTSUPP;
 +              return fscrypt_ioctl_get_key_status(filp, (void __user *)arg);
 +
+       case EXT4_IOC_CLEAR_ES_CACHE:
+       {
+               if (!inode_owner_or_capable(inode))
+                       return -EACCES;
+               ext4_clear_inode_es(inode);
+               return 0;
+       }
+       case EXT4_IOC_GETSTATE:
+       {
+               __u32   state = 0;
+               if (ext4_test_inode_state(inode, EXT4_STATE_EXT_PRECACHED))
+                       state |= EXT4_STATE_FLAG_EXT_PRECACHED;
+               if (ext4_test_inode_state(inode, EXT4_STATE_NEW))
+                       state |= EXT4_STATE_FLAG_NEW;
+               if (ext4_test_inode_state(inode, EXT4_STATE_NEWENTRY))
+                       state |= EXT4_STATE_FLAG_NEWENTRY;
+               if (ext4_test_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE))
+                       state |= EXT4_STATE_FLAG_DA_ALLOC_CLOSE;
+               return put_user(state, (__u32 __user *) arg);
+       }
+       case EXT4_IOC_GET_ES_CACHE:
+               return ext4_ioctl_get_es_cache(filp, arg);
        case EXT4_IOC_FSGETXATTR:
        {
                struct fsxattr fa;
@@@ -1269,15 -1326,11 +1364,18 @@@ long ext4_compat_ioctl(struct file *fil
        case EXT4_IOC_SET_ENCRYPTION_POLICY:
        case EXT4_IOC_GET_ENCRYPTION_PWSALT:
        case EXT4_IOC_GET_ENCRYPTION_POLICY:
 +      case FS_IOC_GET_ENCRYPTION_POLICY_EX:
 +      case FS_IOC_ADD_ENCRYPTION_KEY:
 +      case FS_IOC_REMOVE_ENCRYPTION_KEY:
 +      case FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS:
 +      case FS_IOC_GET_ENCRYPTION_KEY_STATUS:
        case EXT4_IOC_SHUTDOWN:
        case FS_IOC_GETFSMAP:
 +      case FS_IOC_ENABLE_VERITY:
 +      case FS_IOC_MEASURE_VERITY:
+       case EXT4_IOC_CLEAR_ES_CACHE:
+       case EXT4_IOC_GETSTATE:
+       case EXT4_IOC_GET_ES_CACHE:
                break;
        default:
                return -ENOIOCTLCMD;
diff --cc fs/ext4/super.c
Simple merge