Merge tag 'for_v5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 11 Jul 2019 03:27:07 +0000 (20:27 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 11 Jul 2019 03:27:07 +0000 (20:27 -0700)
Pull ext2, udf and quota updates from Jan Kara:

 - some ext2 fixes and cleanups

 - a fix of udf bug when extending files

 - a fix of quota Q_XGETQSTAT[V] handling

* tag 'for_v5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  udf: Fix incorrect final NOT_ALLOCATED (hole) extent length
  ext2: Use kmemdup rather than duplicating its implementation
  quota: honor quota type in Q_XGETQSTAT[V] calls
  ext2: Always brelse bh on failure in ext2_iget()
  ext2: add missing brelse() in ext2_iget()
  ext2: Fix a typo in ext2_getattr argument
  ext2: fix a typo in comment
  ext2: add missing brelse() in ext2_new_inode()
  ext2: optimize ext2_xattr_get()
  ext2: introduce new helper for xattr entry comparison
  ext2: merge xattr next entry check to ext2_xattr_entry_valid()
  ext2: code cleanup for ext2_preread_inode()
  ext2: code cleanup by using test_opt() and clear_opt()
  doc: ext2: update description of quota options for ext2
  ext2: Strengthen xattr block checks
  ext2: Merge loops in ext2_xattr_set()
  ext2: introduce helper for xattr entry validation
  ext2: introduce helper for xattr header validation
  quota: add dqi_dirty_list description to comment of Dquot List Management

1  2 
fs/ext2/super.c
fs/quota/dquot.c

diff --combined fs/ext2/super.c
index 1d7ab73b10148448e07c905b561c0e95087ba608,ca7229c38fcedeb14b87e4fddc8f0bb6d0c1e093..44eb6e7eb492f2fc302cbe0652fd83269e7d2950
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   *  linux/fs/ext2/super.c
   *
@@@ -303,16 -302,16 +303,16 @@@ static int ext2_show_options(struct seq
        if (test_opt(sb, NOBH))
                seq_puts(seq, ",nobh");
  
-       if (sbi->s_mount_opt & EXT2_MOUNT_USRQUOTA)
+       if (test_opt(sb, USRQUOTA))
                seq_puts(seq, ",usrquota");
  
-       if (sbi->s_mount_opt & EXT2_MOUNT_GRPQUOTA)
+       if (test_opt(sb, GRPQUOTA))
                seq_puts(seq, ",grpquota");
  
-       if (sbi->s_mount_opt & EXT2_MOUNT_XIP)
+       if (test_opt(sb, XIP))
                seq_puts(seq, ",xip");
  
-       if (sbi->s_mount_opt & EXT2_MOUNT_DAX)
+       if (test_opt(sb, DAX))
                seq_puts(seq, ",dax");
  
        if (!test_opt(sb, RESERVATION))
@@@ -935,8 -934,7 +935,7 @@@ static int ext2_fill_super(struct super
        sbi->s_resgid = opts.s_resgid;
  
        sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
-               ((EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ?
-                SB_POSIXACL : 0);
+               (test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0);
        sb->s_iflags |= SB_I_CGROUPWB;
  
        if (le32_to_cpu(es->s_rev_level) == EXT2_GOOD_OLD_REV &&
  
        blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size);
  
-       if (sbi->s_mount_opt & EXT2_MOUNT_DAX) {
+       if (test_opt(sb, DAX)) {
                if (!bdev_dax_supported(sb->s_bdev, blocksize)) {
                        ext2_msg(sb, KERN_ERR,
                                "DAX unsupported by block device. Turning off DAX.");
-                       sbi->s_mount_opt &= ~EXT2_MOUNT_DAX;
+                       clear_opt(sbi->s_mount_opt, DAX);
                }
        }
  
@@@ -1404,7 -1402,7 +1403,7 @@@ out_set
        sbi->s_resuid = new_opts.s_resuid;
        sbi->s_resgid = new_opts.s_resgid;
        sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
-               ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? SB_POSIXACL : 0);
+               (test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0);
        spin_unlock(&sbi->s_lock);
  
        return 0;
diff --combined fs/quota/dquot.c
index 58f15a083dd11d4f945be0c05f40437d103d6288,f9b8602d5f2d8ce38513760107241e80c2969380..be9c471cdbc8c6edc7e6ffbfd0fe33f48684ca37
@@@ -223,9 -223,9 +223,9 @@@ static void put_quota_format(struct quo
  
  /*
   * Dquot List Management:
-  * The quota code uses three lists for dquot management: the inuse_list,
-  * free_dquots, and dquot_hash[] array. A single dquot structure may be
-  * on all three lists, depending on its current state.
+  * The quota code uses four lists for dquot management: the inuse_list,
+  * free_dquots, dqi_dirty_list, and dquot_hash[] array. A single dquot
+  * structure may be on some of those lists, depending on its current state.
   *
   * All dquots are placed to the end of inuse_list when first created, and this
   * list is used for invalidate operation, which must look at every dquot.
   * dqstats.free_dquots gives the number of dquots on the list. When
   * dquot is invalidated it's completely released from memory.
   *
+  * Dirty dquots are added to the dqi_dirty_list of quota_info when mark
+  * dirtied, and this list is searched when writing dirty dquots back to
+  * quota file. Note that some filesystems do dirty dquot tracking on their
+  * own (e.g. in a journal) and thus don't use dqi_dirty_list.
+  *
   * Dquots with a specific identity (device, type and id) are placed on
   * one of the dquot_hash[] hash chains. The provides an efficient search
   * mechanism to locate a specific dquot.
@@@ -1996,8 -2001,8 +2001,8 @@@ int __dquot_transfer(struct inode *inod
                                       &warn_to[cnt]);
                if (ret)
                        goto over_quota;
 -              ret = dquot_add_space(transfer_to[cnt], cur_space, rsv_space, 0,
 -                                    &warn_to[cnt]);
 +              ret = dquot_add_space(transfer_to[cnt], cur_space, rsv_space,
 +                                    DQUOT_SPACE_WARN, &warn_to[cnt]);
                if (ret) {
                        spin_lock(&transfer_to[cnt]->dq_dqb_lock);
                        dquot_decr_inodes(transfer_to[cnt], inode_usage);