Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 25 Jul 2012 00:40:44 +0000 (17:40 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 25 Jul 2012 00:40:44 +0000 (17:40 -0700)
Pull misc udf, ext2, ext3, and isofs fixes from Jan Kara:
 "Assorted, mostly trivial, fixes for udf, ext2, ext3, and isofs.  I'm
  on vacation and scarcely checking email since we are expecting baby
  any day now but these fixes should be safe to go in and I don't want
  to delay them unnecessarily."

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  udf: avoid info leak on export
  isofs: avoid info leak on export
  udf: Improve table length check to avoid possible overflow
  ext3: Check return value of blkdev_issue_flush()
  jbd: Check return value of blkdev_issue_flush()
  udf: Do not decrement i_blocks when freeing indirect extent block
  udf: Fix memory leak when mounting
  ext2: cleanup the confused goto label
  UDF: Remove unnecessary variable "offset" from udf_fill_inode
  udf: stop using s_dirt
  ext3: force ro mount if ext3_setup_super() fails
  quota: fix checkpatch.pl warning by replacing <asm/uaccess.h> with <linux/uaccess.h>

1  2 
fs/ext2/super.c
fs/ext3/super.c
fs/quota/dquot.c
fs/quota/quota.c
fs/udf/namei.c

diff --combined fs/ext2/super.c
index 5df3d2d8169c25c1af4f45ce77a5f062517049de,c8e49794ab5d59e2fb2860d2e4e7b965cf27f5af..9f311d27b16f5a804150e5cce66ce0b1724e7cb8
@@@ -771,13 -771,13 +771,13 @@@ static int ext2_fill_super(struct super
        err = -ENOMEM;
        sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
        if (!sbi)
-               goto failed_unlock;
+               goto failed;
  
        sbi->s_blockgroup_lock =
                kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL);
        if (!sbi->s_blockgroup_lock) {
                kfree(sbi);
-               goto failed_unlock;
+               goto failed;
        }
        sb->s_fs_info = sbi;
        sbi->s_sb_block = sb_block;
@@@ -1130,7 -1130,7 +1130,7 @@@ failed_sbi
        sb->s_fs_info = NULL;
        kfree(sbi->s_blockgroup_lock);
        kfree(sbi);
- failed_unlock:
+ failed:
        return ret;
  }
  
@@@ -1184,12 -1184,6 +1184,12 @@@ static int ext2_sync_fs(struct super_bl
        struct ext2_sb_info *sbi = EXT2_SB(sb);
        struct ext2_super_block *es = EXT2_SB(sb)->s_es;
  
 +      /*
 +       * Write quota structures to quota file, sync_blockdev() will write
 +       * them to disk later
 +       */
 +      dquot_writeback_dquots(sb, -1);
 +
        spin_lock(&sbi->s_lock);
        if (es->s_state & cpu_to_le16(EXT2_VALID_FS)) {
                ext2_debug("setting valid to 0\n");
diff --combined fs/ext3/super.c
index 4ac304c55c5327703e19ed990c39a67460f1c4ad,b4e19926f46f721983271405a9d261d0ca22bd13..ff9bcdc5b0d5a7b5f210723092716e9e0f32937c
@@@ -2058,7 -2058,8 +2058,8 @@@ static int ext3_fill_super (struct supe
                goto failed_mount3;
        }
  
-       ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY);
+       if (ext3_setup_super(sb, es, sb->s_flags & MS_RDONLY))
+               sb->s_flags |= MS_RDONLY;
  
        EXT3_SB(sb)->s_mount_state |= EXT3_ORPHAN_FS;
        ext3_orphan_cleanup(sb, es);
@@@ -2526,11 -2527,6 +2527,11 @@@ static int ext3_sync_fs(struct super_bl
        tid_t target;
  
        trace_ext3_sync_fs(sb, wait);
 +      /*
 +       * Writeback quota in non-journalled quota case - journalled quota has
 +       * no dirty dquots
 +       */
 +      dquot_writeback_dquots(sb, -1);
        if (journal_start_commit(EXT3_SB(sb)->s_journal, &target)) {
                if (wait)
                        log_wait_commit(EXT3_SB(sb)->s_journal, target);
diff --combined fs/quota/dquot.c
index d679fc48ef27bcb6e62ac10fb9de1ba2677d7fdd,0c541dcbdf0757e484bf3f737ef256f595ee274f..36a29b753c79c709175ebfd788196d1ecad948b5
@@@ -78,7 -78,7 +78,7 @@@
  #include <linux/quotaops.h>
  #include "../internal.h" /* ugh */
  
- #include <asm/uaccess.h>
+ #include <linux/uaccess.h>
  
  /*
   * There are three quota SMP locks. dq_list_lock protects all lists with quotas
@@@ -595,14 -595,12 +595,14 @@@ out
  }
  EXPORT_SYMBOL(dquot_scan_active);
  
 -int dquot_quota_sync(struct super_block *sb, int type, int wait)
 +/* Write all dquot structures to quota files */
 +int dquot_writeback_dquots(struct super_block *sb, int type)
  {
        struct list_head *dirty;
        struct dquot *dquot;
        struct quota_info *dqopt = sb_dqopt(sb);
        int cnt;
 +      int err, ret = 0;
  
        mutex_lock(&dqopt->dqonoff_mutex);
        for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
                        atomic_inc(&dquot->dq_count);
                        spin_unlock(&dq_list_lock);
                        dqstats_inc(DQST_LOOKUPS);
 -                      sb->dq_op->write_dquot(dquot);
 +                      err = sb->dq_op->write_dquot(dquot);
 +                      if (!ret && err)
 +                              err = ret;
                        dqput(dquot);
                        spin_lock(&dq_list_lock);
                }
        dqstats_inc(DQST_SYNCS);
        mutex_unlock(&dqopt->dqonoff_mutex);
  
 -      if (!wait || (dqopt->flags & DQUOT_QUOTA_SYS_FILE))
 +      return ret;
 +}
 +EXPORT_SYMBOL(dquot_writeback_dquots);
 +
 +/* Write all dquot structures to disk and make them visible from userspace */
 +int dquot_quota_sync(struct super_block *sb, int type)
 +{
 +      struct quota_info *dqopt = sb_dqopt(sb);
 +      int cnt;
 +      int ret;
 +
 +      ret = dquot_writeback_dquots(sb, type);
 +      if (ret)
 +              return ret;
 +      if (dqopt->flags & DQUOT_QUOTA_SYS_FILE)
                return 0;
  
        /* This is not very clever (and fast) but currently I don't know about
diff --combined fs/quota/quota.c
index c659f92298d3623eed8da9eb9d53c064dd917141,639782d5a76fdddebc4178445c08f338024683a5..6f155788cbc6ed498126cfca9edff974f19b4a93
@@@ -9,7 -9,7 +9,7 @@@
  #include <linux/namei.h>
  #include <linux/slab.h>
  #include <asm/current.h>
- #include <asm/uaccess.h>
+ #include <linux/uaccess.h>
  #include <linux/kernel.h>
  #include <linux/security.h>
  #include <linux/syscalls.h>
@@@ -47,7 -47,7 +47,7 @@@ static int check_quotactl_permission(st
  static void quota_sync_one(struct super_block *sb, void *arg)
  {
        if (sb->s_qcop && sb->s_qcop->quota_sync)
 -              sb->s_qcop->quota_sync(sb, *(int *)arg, 1);
 +              sb->s_qcop->quota_sync(sb, *(int *)arg);
  }
  
  static int quota_sync_all(int type)
@@@ -270,7 -270,7 +270,7 @@@ static int do_quotactl(struct super_blo
        case Q_SYNC:
                if (!sb->s_qcop->quota_sync)
                        return -ENOSYS;
 -              return sb->s_qcop->quota_sync(sb, type, 1);
 +              return sb->s_qcop->quota_sync(sb, type);
        case Q_XQUOTAON:
        case Q_XQUOTAOFF:
        case Q_XQUOTARM:
diff --combined fs/udf/namei.c
index 544b2799a9114c4620844bec32b9921881da97b9,c31deb382afd006f26072d6744976b4258bcc202..95fee278ab9da660608226b478645878424bbf64
@@@ -251,7 -251,7 +251,7 @@@ out_ok
  }
  
  static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry,
 -                               struct nameidata *nd)
 +                               unsigned int flags)
  {
        struct inode *inode = NULL;
        struct fileIdentDesc cfi;
@@@ -551,7 -551,7 +551,7 @@@ static int udf_delete_entry(struct inod
  }
  
  static int udf_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 -                    struct nameidata *nd)
 +                    bool excl)
  {
        struct udf_fileident_bh fibh;
        struct inode *inode;
@@@ -1279,6 -1279,7 +1279,7 @@@ static int udf_encode_fh(struct inode *
        *lenp = 3;
        fid->udf.block = location.logicalBlockNum;
        fid->udf.partref = location.partitionReferenceNum;
+       fid->udf.parent_partref = 0;
        fid->udf.generation = inode->i_generation;
  
        if (parent) {