Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / kernel_patches / patches / 2.6.5-quotafix.patch
index dd6b0a2..46369fe 100644 (file)
@@ -1,9 +1,8 @@
-%patch
-Index: linux-2.6.5-7.276/include/linux/ext3_jbd.h
+Index: linux-2.6.5-7.283/include/linux/ext3_jbd.h
 ===================================================================
---- linux-2.6.5-7.276.orig/include/linux/ext3_jbd.h    2006-09-15 17:44:48.000000000 +0800
-+++ linux-2.6.5-7.276/include/linux/ext3_jbd.h 2006-10-26 16:47:10.000000000 +0800
-@@ -72,6 +72,19 @@
+--- linux-2.6.5-7.283.orig/include/linux/ext3_jbd.h
++++ linux-2.6.5-7.283/include/linux/ext3_jbd.h
+@@ -72,6 +72,19 @@ extern int ext3_writepage_trans_blocks(s
  
  #define EXT3_INDEX_EXTRA_TRANS_BLOCKS 8
  
@@ -23,7 +22,7 @@ Index: linux-2.6.5-7.276/include/linux/ext3_jbd.h
  int
  ext3_mark_iloc_dirty(handle_t *handle, 
                     struct inode *inode,
-@@ -97,6 +110,8 @@
+@@ -97,6 +110,8 @@ int ext3_mark_inode_dirty(handle_t *hand
  void ext3_journal_abort_handle(const char *caller, const char *err_fn,
                struct buffer_head *bh, handle_t *handle, int err);
  
@@ -32,11 +31,11 @@ Index: linux-2.6.5-7.276/include/linux/ext3_jbd.h
  static inline int
  __ext3_journal_get_undo_access(const char *where, handle_t *handle,
                                struct buffer_head *bh, int *credits)
-Index: linux-2.6.5-7.276/include/linux/fs.h
+Index: linux-2.6.5-7.283/include/linux/fs.h
 ===================================================================
---- linux-2.6.5-7.276.orig/include/linux/fs.h  2006-10-26 16:47:09.000000000 +0800
-+++ linux-2.6.5-7.276/include/linux/fs.h       2006-10-26 16:47:10.000000000 +0800
-@@ -967,6 +967,9 @@
+--- linux-2.6.5-7.283.orig/include/linux/fs.h
++++ linux-2.6.5-7.283/include/linux/fs.h
+@@ -967,6 +967,9 @@ struct super_operations {
        void (*umount_begin) (struct super_block *);
  
        int (*show_options)(struct seq_file *, struct vfsmount *);
@@ -46,11 +45,11 @@ Index: linux-2.6.5-7.276/include/linux/fs.h
  };
  
  /* Inode state bits.  Protected by inode_lock. */
-Index: linux-2.6.5-7.276/include/linux/quota.h
+Index: linux-2.6.5-7.283/include/linux/quota.h
 ===================================================================
---- linux-2.6.5-7.276.orig/include/linux/quota.h       2006-09-15 17:44:47.000000000 +0800
-+++ linux-2.6.5-7.276/include/linux/quota.h    2006-10-26 16:47:10.000000000 +0800
-@@ -138,6 +138,10 @@
+--- linux-2.6.5-7.283.orig/include/linux/quota.h
++++ linux-2.6.5-7.283/include/linux/quota.h
+@@ -138,6 +138,10 @@ struct if_dqinfo {
  #include <linux/dqblk_v1.h>
  #include <linux/dqblk_v2.h>
  
@@ -61,7 +60,7 @@ Index: linux-2.6.5-7.276/include/linux/quota.h
  /*
   * Data for one user/group kept in memory
   */
-@@ -168,22 +172,21 @@
+@@ -168,22 +172,21 @@ struct mem_dqinfo {
        } u;
  };
  
@@ -88,7 +87,7 @@ Index: linux-2.6.5-7.276/include/linux/quota.h
  
  struct dqstats {
        int lookups;
-@@ -204,6 +207,9 @@
+@@ -204,6 +207,9 @@ extern struct dqstats dqstats;
  #define DQ_BLKS_B     1
  #define DQ_INODES_B   2
  #define DQ_FAKE_B     3
@@ -98,7 +97,7 @@ Index: linux-2.6.5-7.276/include/linux/quota.h
  
  #define DQ_MOD        (1 << DQ_MOD_B) /* dquot modified since read */
  #define DQ_BLKS       (1 << DQ_BLKS_B)        /* uid/gid has been warned about blk limit */
-@@ -239,18 +245,22 @@
+@@ -239,18 +245,22 @@ struct quota_format_ops {
        int (*free_file_info)(struct super_block *sb, int type);        /* Called on quotaoff() */
        int (*read_dqblk)(struct dquot *dquot);         /* Read structure for one user */
        int (*commit_dqblk)(struct dquot *dquot);       /* Write (or delete) structure for one user */
@@ -125,7 +124,7 @@ Index: linux-2.6.5-7.276/include/linux/quota.h
  };
  
  /* Operations handling requests from userspace */
-@@ -283,7 +293,8 @@
+@@ -283,7 +293,8 @@ struct quota_info {
        struct semaphore dqio_sem;              /* lock device while I/O in progress */
        struct semaphore dqonoff_sem;           /* Serialize quotaon & quotaoff */
        struct rw_semaphore dqptr_sem;          /* serialize ops using quota_info struct, pointers from inode to dquots */
@@ -135,10 +134,10 @@ Index: linux-2.6.5-7.276/include/linux/quota.h
        struct mem_dqinfo info[MAXQUOTAS];      /* Information for each quota type */
        struct quota_format_ops *ops[MAXQUOTAS];        /* Operations for each type */
  };
-Index: linux-2.6.5-7.276/include/linux/quotaops.h
+Index: linux-2.6.5-7.283/include/linux/quotaops.h
 ===================================================================
---- linux-2.6.5-7.276.orig/include/linux/quotaops.h    2006-09-30 11:24:23.000000000 +0800
-+++ linux-2.6.5-7.276/include/linux/quotaops.h 2006-10-30 10:39:46.000000000 +0800
+--- linux-2.6.5-7.283.orig/include/linux/quotaops.h
++++ linux-2.6.5-7.283/include/linux/quotaops.h
 @@ -22,17 +22,22 @@
   */
  extern void sync_dquots(struct super_block *sb, int type);
@@ -166,7 +165,7 @@ Index: linux-2.6.5-7.276/include/linux/quotaops.h
  /*
   * Operations supported for diskquotas.
   */
-@@ -143,7 +148,7 @@
+@@ -143,7 +148,7 @@ static __inline__ int DQUOT_OFF(struct s
  {
        int ret = -ENOSYS;
  
@@ -175,11 +174,11 @@ Index: linux-2.6.5-7.276/include/linux/quotaops.h
                ret = sb->s_qcop->quota_off(sb, -1);
        return ret;
  }
-Index: linux-2.6.5-7.276/include/linux/security.h
+Index: linux-2.6.5-7.283/include/linux/security.h
 ===================================================================
---- linux-2.6.5-7.276.orig/include/linux/security.h    2006-09-15 17:44:47.000000000 +0800
-+++ linux-2.6.5-7.276/include/linux/security.h 2006-10-26 16:47:10.000000000 +0800
-@@ -1020,7 +1020,7 @@
+--- linux-2.6.5-7.283.orig/include/linux/security.h
++++ linux-2.6.5-7.283/include/linux/security.h
+@@ -1020,7 +1020,7 @@ struct security_operations {
        int (*sysctl) (ctl_table * table, int op);
        int (*capable) (struct task_struct * tsk, int cap);
        int (*quotactl) (int cmds, int type, int id, struct super_block * sb);
@@ -188,7 +187,7 @@ Index: linux-2.6.5-7.276/include/linux/security.h
        int (*syslog) (int type);
        int (*vm_enough_memory) (long pages);
  
-@@ -1292,9 +1292,9 @@
+@@ -1292,9 +1292,9 @@ static inline int security_quotactl (int
                         0);
  }
  
@@ -200,11 +199,11 @@ Index: linux-2.6.5-7.276/include/linux/security.h
                         0);
  }
  
-Index: linux-2.6.5-7.276/security/dummy.c
+Index: linux-2.6.5-7.283/security/dummy.c
 ===================================================================
---- linux-2.6.5-7.276.orig/security/dummy.c    2006-09-15 17:44:47.000000000 +0800
-+++ linux-2.6.5-7.276/security/dummy.c 2006-10-26 16:47:10.000000000 +0800
-@@ -90,7 +90,7 @@
+--- linux-2.6.5-7.283.orig/security/dummy.c
++++ linux-2.6.5-7.283/security/dummy.c
+@@ -90,7 +90,7 @@ static int dummy_quotactl (int cmds, int
        return 0;
  }
  
@@ -213,11 +212,11 @@ Index: linux-2.6.5-7.276/security/dummy.c
  {
        return 0;
  }
-Index: linux-2.6.5-7.276/security/selinux/hooks.c
+Index: linux-2.6.5-7.283/security/selinux/hooks.c
 ===================================================================
---- linux-2.6.5-7.276.orig/security/selinux/hooks.c    2006-09-15 17:44:47.000000000 +0800
-+++ linux-2.6.5-7.276/security/selinux/hooks.c 2006-10-26 16:47:10.000000000 +0800
-@@ -1454,9 +1454,9 @@
+--- linux-2.6.5-7.283.orig/security/selinux/hooks.c
++++ linux-2.6.5-7.283/security/selinux/hooks.c
+@@ -1454,9 +1454,9 @@ static int selinux_quotactl(int cmds, in
        return rc;
  }
  
@@ -229,10 +228,10 @@ Index: linux-2.6.5-7.276/security/selinux/hooks.c
  }
  
  static int selinux_syslog(int type)
-Index: linux-2.6.5-7.276/fs/dquot.c
+Index: linux-2.6.5-7.283/fs/dquot.c
 ===================================================================
---- linux-2.6.5-7.276.orig/fs/dquot.c  2006-09-15 17:44:47.000000000 +0800
-+++ linux-2.6.5-7.276/fs/dquot.c       2006-10-26 16:47:10.000000000 +0800
+--- linux-2.6.5-7.283.orig/fs/dquot.c
++++ linux-2.6.5-7.283/fs/dquot.c
 @@ -52,6 +52,9 @@
   *            New SMP locking.
   *            Jan Kara, <jack@suse.cz>, 10/2002
@@ -262,7 +261,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
   *  dqonoff_sem > journal_lock > dqptr_sem > dquot->dq_lock > dqio_sem
   */
  spinlock_t dq_list_lock = SPIN_LOCK_UNLOCKED;
-@@ -175,8 +179,7 @@
+@@ -175,8 +179,7 @@ static void put_quota_format(struct quot
   * on all three lists, depending on its current state.
   *
   * All dquots are placed to the end of inuse_list when first created, and this
@@ -272,7 +271,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
   *
   * Unused dquots (dq_count == 0) are added to the free_dquots list when freed,
   * and this list is searched whenever we need an available dquot.  Dquots are
-@@ -264,30 +267,105 @@
+@@ -264,30 +267,105 @@ static void wait_on_dquot(struct dquot *
        up(&dquot->dq_lock);
  }
  
@@ -384,7 +383,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
  /* Invalidate all dquots on the list. Note that this function is called after
   * quota is disabled so no new quota might be created. Because we hold
   * dqonoff_sem and pointers were already removed from inodes we actually know
-@@ -343,6 +421,11 @@
+@@ -343,6 +421,11 @@ restart:
                        continue;
                if (!dquot_dirty(dquot))
                        continue;
@@ -396,7 +395,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
                atomic_inc(&dquot->dq_count);
                dqstats.lookups++;
                spin_unlock(&dq_list_lock);
-@@ -353,11 +436,9 @@
+@@ -353,11 +436,9 @@ restart:
        spin_unlock(&dq_list_lock);
  
        for (cnt = 0; cnt < MAXQUOTAS; cnt++)
@@ -411,7 +410,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
        spin_lock(&dq_list_lock);
        dqstats.syncs++;
        spin_unlock(&dq_list_lock);
-@@ -432,11 +513,19 @@
+@@ -432,11 +513,19 @@ we_slept:
                spin_unlock(&dq_list_lock);
                return;
        }
@@ -432,7 +431,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
        atomic_dec(&dquot->dq_count);
  #ifdef __DQUOT_PARANOIA
        /* sanity check */
-@@ -495,7 +584,6 @@
+@@ -495,7 +584,6 @@ we_slept:
                insert_dquot_hash(dquot);
                dqstats.lookups++;
                spin_unlock(&dq_list_lock);
@@ -440,7 +439,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
        } else {
                if (!atomic_read(&dquot->dq_count))
                        remove_free_dquot(dquot);
-@@ -503,10 +591,15 @@
+@@ -503,10 +591,15 @@ we_slept:
                dqstats.cache_hits++;
                dqstats.lookups++;
                spin_unlock(&dq_list_lock);
@@ -457,7 +456,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
  
  #ifdef __DQUOT_PARANOIA
        if (!dquot->dq_sb)      /* Has somebody invalidated entry under us? */
-@@ -819,19 +912,19 @@
+@@ -819,19 +912,19 @@ static int check_bdq(struct dquot *dquot
   *
   * Note: this is a blocking operation.
   */
@@ -480,7 +479,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
        }
        /* Build list of quotas to initialize... */
        for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-@@ -852,13 +945,14 @@
+@@ -852,13 +945,14 @@ void dquot_initialize(struct inode *inod
                }
        }
        up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
@@ -496,7 +495,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
  {
        int cnt;
  
-@@ -871,6 +965,7 @@
+@@ -871,6 +965,7 @@ void dquot_drop(struct inode *inode)
                }
        }
        up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
@@ -504,7 +503,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
  }
  
  /*
-@@ -958,14 +1053,14 @@
+@@ -958,14 +1053,14 @@ warn_put_all:
  /*
   * This is a non-blocking operation.
   */
@@ -521,7 +520,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
        }
        down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
        spin_lock(&dq_data_lock);
-@@ -981,23 +1076,24 @@
+@@ -981,23 +1076,24 @@ sub_bytes:
        inode_sub_bytes(inode, number);
        spin_unlock(&dq_data_lock);
        up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
@@ -549,7 +548,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
        }
        spin_lock(&dq_data_lock);
        for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-@@ -1007,6 +1103,7 @@
+@@ -1007,6 +1103,7 @@ void dquot_free_inode(const struct inode
        }
        spin_unlock(&dq_data_lock);
        up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
@@ -557,7 +556,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
  }
  
  /*
-@@ -1104,6 +1201,20 @@
+@@ -1104,6 +1201,20 @@ warn_put_all:
  }
  
  /*
@@ -578,7 +577,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
   * Definitions of diskquota operations.
   */
  struct dquot_operations dquot_operations = {
-@@ -1114,7 +1225,10 @@
+@@ -1114,7 +1225,10 @@ struct dquot_operations dquot_operations
        .free_space     = dquot_free_space,
        .free_inode     = dquot_free_inode,
        .transfer       = dquot_transfer,
@@ -590,7 +589,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
  };
  
  /* Function used by filesystems for initializing the dquot_operations structure */
-@@ -1154,13 +1268,14 @@
+@@ -1154,13 +1268,14 @@ int vfs_quota_off(struct super_block *sb
  {
        int cnt;
        struct quota_info *dqopt = sb_dqopt(sb);
@@ -608,7 +607,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
                if (type != -1 && cnt != type)
                        continue;
                if (!sb_has_quota_enabled(sb, cnt))
-@@ -1172,94 +1287,115 @@
+@@ -1172,94 +1287,115 @@ int vfs_quota_off(struct super_block *sb
                invalidate_dquots(sb, cnt);
                /*
                 * Now all dquots should be invalidated, all writes done so we should be only
@@ -782,7 +781,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
  
        dqopt->ops[type] = fmt->qf_ops;
        dqopt->info[type].dqi_format = fmt;
-@@ -1269,6 +1405,7 @@
+@@ -1269,6 +1405,7 @@ int vfs_quota_on(struct super_block *sb,
                goto out_file_init;
        }
        up(&dqopt->dqio_sem);
@@ -790,7 +789,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
        set_enable_flags(dqopt, type);
  
        add_dquot_ref(sb, type);
-@@ -1277,18 +1414,51 @@
+@@ -1277,18 +1414,51 @@ int vfs_quota_on(struct super_block *sb,
        return 0;
  
  out_file_init:
@@ -845,7 +844,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
  /* Generic routine for getting common part of quota structure */
  static void do_get_dqblk(struct dquot *dquot, struct if_dqblk *di)
  {
-@@ -1430,8 +1600,10 @@
+@@ -1430,8 +1600,10 @@ int vfs_set_dqinfo(struct super_block *s
                mi->dqi_igrace = ii->dqi_igrace;
        if (ii->dqi_valid & IIF_FLAGS)
                mi->dqi_flags = (mi->dqi_flags & ~DQF_MASK) | (ii->dqi_flags & DQF_MASK);
@@ -857,7 +856,7 @@ Index: linux-2.6.5-7.276/fs/dquot.c
        up(&sb_dqopt(sb)->dqonoff_sem);
        return 0;
  }
-@@ -1564,3 +1736,15 @@
+@@ -1564,3 +1736,15 @@ EXPORT_SYMBOL(dqstats);
  EXPORT_SYMBOL(dq_list_lock);
  EXPORT_SYMBOL(dq_data_lock);
  EXPORT_SYMBOL(init_dquot_operations);
@@ -873,10 +872,10 @@ Index: linux-2.6.5-7.276/fs/dquot.c
 +EXPORT_SYMBOL(dquot_free_inode);
 +EXPORT_SYMBOL(dquot_transfer);
 +
-Index: linux-2.6.5-7.276/fs/quota_v2.c
+Index: linux-2.6.5-7.283/fs/quota_v2.c
 ===================================================================
---- linux-2.6.5-7.276.orig/fs/quota_v2.c       2006-09-15 17:44:47.000000000 +0800
-+++ linux-2.6.5-7.276/fs/quota_v2.c    2006-10-26 16:47:10.000000000 +0800
+--- linux-2.6.5-7.283.orig/fs/quota_v2.c
++++ linux-2.6.5-7.283/fs/quota_v2.c
 @@ -13,7 +13,6 @@
  #include <linux/slab.h>
  
@@ -885,7 +884,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
  
  MODULE_AUTHOR("Jan Kara");
  MODULE_DESCRIPTION("Quota format v2 support");
-@@ -30,19 +29,15 @@
+@@ -30,19 +29,15 @@ typedef char *dqbuf_t;
  static int v2_check_quota_file(struct super_block *sb, int type)
  {
        struct v2_disk_dqheader dqhead;
@@ -909,7 +908,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
        if (le32_to_cpu(dqhead.dqh_magic) != quota_magics[type] ||
            le32_to_cpu(dqhead.dqh_version) != quota_versions[type])
                return 0;
-@@ -52,20 +47,15 @@
+@@ -52,20 +47,15 @@ static int v2_check_quota_file(struct su
  /* Read information header from quota file */
  static int v2_read_file_info(struct super_block *sb, int type)
  {
@@ -933,7 +932,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
                return -1;
        }
        info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace);
-@@ -80,12 +70,9 @@
+@@ -80,12 +70,9 @@ static int v2_read_file_info(struct supe
  /* Write information header to quota file */
  static int v2_write_file_info(struct super_block *sb, int type)
  {
@@ -946,7 +945,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
  
        info->dqi_flags &= ~DQF_INFO_DIRTY;
        dinfo.dqi_bgrace = cpu_to_le32(info->dqi_bgrace);
-@@ -94,13 +81,13 @@
+@@ -94,13 +81,13 @@ static int v2_write_file_info(struct sup
        dinfo.dqi_blocks = cpu_to_le32(info->u.v2_i.dqi_blocks);
        dinfo.dqi_free_blk = cpu_to_le32(info->u.v2_i.dqi_free_blk);
        dinfo.dqi_free_entry = cpu_to_le32(info->u.v2_i.dqi_free_entry);
@@ -965,7 +964,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
                return -1;
        }
        return 0;
-@@ -144,38 +131,24 @@
+@@ -144,38 +131,24 @@ static inline void freedqbuf(dqbuf_t buf
        kfree(buf);
  }
  
@@ -1012,7 +1011,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
        struct v2_disk_dqdbheader *dh = (struct v2_disk_dqdbheader *)buf;
        int ret, blk;
  
-@@ -183,17 +156,18 @@
+@@ -183,17 +156,18 @@ static int get_free_dqblk(struct file *f
                return -ENOMEM;
        if (info->u.v2_i.dqi_free_blk) {
                blk = info->u.v2_i.dqi_free_blk;
@@ -1034,7 +1033,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
        ret = blk;
  out_buf:
        freedqbuf(buf);
-@@ -201,8 +175,9 @@
+@@ -201,8 +175,9 @@ out_buf:
  }
  
  /* Insert empty block to the list */
@@ -1045,7 +1044,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
        struct v2_disk_dqdbheader *dh = (struct v2_disk_dqdbheader *)buf;
        int err;
  
-@@ -210,16 +185,18 @@
+@@ -210,16 +185,18 @@ static int put_free_dqblk(struct file *f
        dh->dqdh_prev_free = cpu_to_le32(0);
        dh->dqdh_entries = cpu_to_le16(0);
        info->u.v2_i.dqi_free_blk = blk;
@@ -1067,7 +1066,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
        struct v2_disk_dqdbheader *dh = (struct v2_disk_dqdbheader *)buf;
        uint nextblk = le32_to_cpu(dh->dqdh_next_free), prevblk = le32_to_cpu(dh->dqdh_prev_free);
        int err;
-@@ -227,26 +204,27 @@
+@@ -227,26 +204,27 @@ static int remove_free_dqentry(struct fi
        if (!tmpbuf)
                return -ENOMEM;
        if (nextblk) {
@@ -1101,7 +1100,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
                printk(KERN_ERR "VFS: Can't write block (%u) with free entries.\n", blk);
        return 0;
  out_buf:
-@@ -255,9 +233,10 @@
+@@ -255,9 +233,10 @@ out_buf:
  }
  
  /* Insert given block to the beginning of list with free entries */
@@ -1113,7 +1112,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
        struct v2_disk_dqdbheader *dh = (struct v2_disk_dqdbheader *)buf;
        int err;
  
-@@ -265,18 +244,18 @@
+@@ -265,18 +244,18 @@ static int insert_free_dqentry(struct fi
                return -ENOMEM;
        dh->dqdh_next_free = cpu_to_le32(info->u.v2_i.dqi_free_entry);
        dh->dqdh_prev_free = cpu_to_le32(0);
@@ -1136,7 +1135,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
        return 0;
  out_buf:
        freedqbuf(tmpbuf);
-@@ -286,8 +265,8 @@
+@@ -286,8 +265,8 @@ out_buf:
  /* Find space for dquot */
  static uint find_free_dqentry(struct dquot *dquot, int *err)
  {
@@ -1147,7 +1146,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
        uint blk, i;
        struct v2_disk_dqdbheader *dh;
        struct v2_disk_dqblk *ddquot;
-@@ -303,22 +282,23 @@
+@@ -303,22 +282,23 @@ static uint find_free_dqentry(struct dqu
        ddquot = GETENTRIES(buf);
        if (info->u.v2_i.dqi_free_entry) {
                blk = info->u.v2_i.dqi_free_entry;
@@ -1176,7 +1175,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
                        printk(KERN_ERR "VFS: find_free_dqentry(): Can't remove block (%u) from entry free list.\n", blk);
                        goto out_buf;
                }
-@@ -333,7 +313,7 @@
+@@ -333,7 +313,7 @@ static uint find_free_dqentry(struct dqu
                goto out_buf;
        }
  #endif
@@ -1185,7 +1184,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
                printk(KERN_ERR "VFS: find_free_dqentry(): Can't write quota data block %u.\n", blk);
                goto out_buf;
        }
-@@ -348,8 +328,7 @@
+@@ -348,8 +328,7 @@ out_buf:
  /* Insert reference to structure into the trie */
  static int do_insert_tree(struct dquot *dquot, uint *treeblk, int depth)
  {
@@ -1195,7 +1194,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
        dqbuf_t buf;
        int ret = 0, newson = 0, newact = 0;
        u32 *ref;
-@@ -358,7 +337,7 @@
+@@ -358,7 +337,7 @@ static int do_insert_tree(struct dquot *
        if (!(buf = getdqbuf()))
                return -ENOMEM;
        if (!*treeblk) {
@@ -1204,7 +1203,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
                if (ret < 0)
                        goto out_buf;
                *treeblk = ret;
-@@ -366,7 +345,7 @@
+@@ -366,7 +345,7 @@ static int do_insert_tree(struct dquot *
                newact = 1;
        }
        else {
@@ -1213,7 +1212,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
                        printk(KERN_ERR "VFS: Can't read tree quota block %u.\n", *treeblk);
                        goto out_buf;
                }
-@@ -389,10 +368,10 @@
+@@ -389,10 +368,10 @@ static int do_insert_tree(struct dquot *
                ret = do_insert_tree(dquot, &newblk, depth+1);
        if (newson && ret >= 0) {
                ref[GETIDINDEX(dquot->dq_id, depth)] = cpu_to_le32(newblk);
@@ -1226,7 +1225,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
  out_buf:
        freedqbuf(buf);
        return ret;
-@@ -411,19 +390,14 @@
+@@ -411,19 +390,14 @@ static inline int dq_insert_tree(struct 
  static int v2_write_dquot(struct dquot *dquot)
  {
        int type = dquot->dq_type;
@@ -1247,7 +1246,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
        mem2diskdqb(&ddquot, &dquot->dq_dqb, dquot->dq_id);
        /* Argh... We may need to write structure full of zeroes but that would be
         * treated as an empty place by the rest of the code. Format change would
-@@ -431,10 +405,10 @@
+@@ -431,10 +405,10 @@ static int v2_write_dquot(struct dquot *
        memset(&empty, 0, sizeof(struct v2_disk_dqblk));
        if (!memcmp(&empty, &ddquot, sizeof(struct v2_disk_dqblk)))
                ddquot.dqb_itime = cpu_to_le64(1);
@@ -1262,7 +1261,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
        if (ret != sizeof(struct v2_disk_dqblk)) {
                printk(KERN_WARNING "VFS: dquota write failed on dev %s\n", dquot->dq_sb->s_id);
                if (ret >= 0)
-@@ -450,8 +424,8 @@
+@@ -450,8 +424,8 @@ static int v2_write_dquot(struct dquot *
  /* Free dquot entry in data block */
  static int free_dqentry(struct dquot *dquot, uint blk)
  {
@@ -1273,7 +1272,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
        struct v2_disk_dqdbheader *dh;
        dqbuf_t buf = getdqbuf();
        int ret = 0;
-@@ -459,34 +433,39 @@
+@@ -459,34 +433,39 @@ static int free_dqentry(struct dquot *dq
        if (!buf)
                return -ENOMEM;
        if (dquot->dq_off >> V2_DQBLKSIZE_BITS != blk) {
@@ -1322,7 +1321,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
                                goto out_buf;
                        }
        }
-@@ -499,8 +478,8 @@
+@@ -499,8 +478,8 @@ out_buf:
  /* Remove reference to dquot from tree */
  static int remove_tree(struct dquot *dquot, uint *blk, int depth)
  {
@@ -1333,7 +1332,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
        dqbuf_t buf = getdqbuf();
        int ret = 0;
        uint newblk;
-@@ -508,7 +487,7 @@
+@@ -508,7 +487,7 @@ static int remove_tree(struct dquot *dqu
        
        if (!buf)
                return -ENOMEM;
@@ -1342,7 +1341,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
                printk(KERN_ERR "VFS: Can't read quota data block %u\n", *blk);
                goto out_buf;
        }
-@@ -524,12 +503,13 @@
+@@ -524,12 +503,13 @@ static int remove_tree(struct dquot *dqu
                ref[GETIDINDEX(dquot->dq_id, depth)] = cpu_to_le32(0);
                for (i = 0; i < V2_DQBLKSIZE && !buf[i]; i++);  /* Block got empty? */
                if (i == V2_DQBLKSIZE) {
@@ -1359,7 +1358,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
        }
  out_buf:
        freedqbuf(buf);
-@@ -549,7 +529,6 @@
+@@ -549,7 +529,6 @@ static int v2_delete_dquot(struct dquot 
  /* Find entry in block */
  static loff_t find_block_dqentry(struct dquot *dquot, uint blk)
  {
@@ -1367,7 +1366,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
        dqbuf_t buf = getdqbuf();
        loff_t ret = 0;
        int i;
-@@ -557,27 +536,31 @@
+@@ -557,27 +536,31 @@ static loff_t find_block_dqentry(struct 
  
        if (!buf)
                return -ENOMEM;
@@ -1404,7 +1403,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
  out_buf:
        freedqbuf(buf);
        return ret;
-@@ -586,14 +569,13 @@
+@@ -586,14 +569,13 @@ out_buf:
  /* Find entry for given id in the tree */
  static loff_t find_tree_dqentry(struct dquot *dquot, uint blk, int depth)
  {
@@ -1420,7 +1419,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
                printk(KERN_ERR "VFS: Can't read quota tree block %u.\n", blk);
                goto out_buf;
        }
-@@ -619,16 +601,13 @@
+@@ -619,16 +601,13 @@ static inline loff_t find_dqentry(struct
  static int v2_read_dquot(struct dquot *dquot)
  {
        int type = dquot->dq_type;
@@ -1439,7 +1438,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
                printk(KERN_ERR "VFS: Quota invalidated while reading!\n");
                return -EIO;
        }
-@@ -636,7 +615,8 @@
+@@ -636,7 +615,8 @@ static int v2_read_dquot(struct dquot *d
        offset = find_dqentry(dquot);
        if (offset <= 0) {      /* Entry not present? */
                if (offset < 0)
@@ -1449,7 +1448,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
                dquot->dq_off = 0;
                dquot->dq_flags |= DQ_FAKE;
                memset(&dquot->dq_dqb, 0, sizeof(struct mem_dqblk));
-@@ -644,12 +624,13 @@
+@@ -644,12 +624,13 @@ static int v2_read_dquot(struct dquot *d
        }
        else {
                dquot->dq_off = offset;
@@ -1467,7 +1466,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
                        memset(&ddquot, 0, sizeof(struct v2_disk_dqblk));
                }
                else {
-@@ -660,7 +641,6 @@
+@@ -660,7 +641,6 @@ static int v2_read_dquot(struct dquot *d
                        if (!memcmp(&empty, &ddquot, sizeof(struct v2_disk_dqblk)))
                                ddquot.dqb_itime = 0;
                }
@@ -1475,7 +1474,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
                disk2memdqb(&dquot->dq_dqb, &ddquot);
        }
        dqstats.reads++;
-@@ -668,15 +648,13 @@
+@@ -668,15 +648,13 @@ static int v2_read_dquot(struct dquot *d
        return ret;
  }
  
@@ -1496,7 +1495,7 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
  }
  
  static struct quota_format_ops v2_format_ops = {
-@@ -685,7 +663,8 @@
+@@ -685,7 +663,8 @@ static struct quota_format_ops v2_format
        .write_file_info        = v2_write_file_info,
        .free_file_info         = NULL,
        .read_dqblk             = v2_read_dquot,
@@ -1506,10 +1505,10 @@ Index: linux-2.6.5-7.276/fs/quota_v2.c
  };
  
  static struct quota_format_type v2_quota_format = {
-Index: linux-2.6.5-7.276/fs/quota.c
+Index: linux-2.6.5-7.283/fs/quota.c
 ===================================================================
---- linux-2.6.5-7.276.orig/fs/quota.c  2006-09-15 17:44:47.000000000 +0800
-+++ linux-2.6.5-7.276/fs/quota.c       2006-10-26 16:47:10.000000000 +0800
+--- linux-2.6.5-7.283.orig/fs/quota.c
++++ linux-2.6.5-7.283/fs/quota.c
 @@ -14,6 +14,9 @@
  #include <linux/smp_lock.h>
  #include <linux/security.h>
@@ -1520,7 +1519,7 @@ Index: linux-2.6.5-7.276/fs/quota.c
  
  /* Check validity of quotactl */
  static int check_quotactl_valid(struct super_block *sb, int type, int cmd, qid_t id)
-@@ -134,16 +137,54 @@
+@@ -134,16 +137,54 @@ restart:
        return NULL;
  }
  
@@ -1578,11 +1577,11 @@ Index: linux-2.6.5-7.276/fs/quota.c
                        drop_super(sb);
                }
        }
-Index: linux-2.6.5-7.276/fs/ext3/inode.c
+Index: linux-2.6.5-7.283/fs/ext3/inode.c
 ===================================================================
---- linux-2.6.5-7.276.orig/fs/ext3/inode.c     2006-09-15 17:44:48.000000000 +0800
-+++ linux-2.6.5-7.276/fs/ext3/inode.c  2006-10-26 16:47:10.000000000 +0800
-@@ -1015,7 +1015,7 @@
+--- linux-2.6.5-7.283.orig/fs/ext3/inode.c
++++ linux-2.6.5-7.283/fs/ext3/inode.c
+@@ -1015,7 +1015,7 @@ out:
        return ret;
  }
  
@@ -1591,10 +1590,10 @@ Index: linux-2.6.5-7.276/fs/ext3/inode.c
  ext3_journal_dirty_data(handle_t *handle, struct buffer_head *bh)
  {
        int err = journal_dirty_data(handle, bh);
-Index: linux-2.6.5-7.276/fs/ext3/super.c
+Index: linux-2.6.5-7.283/fs/ext3/super.c
 ===================================================================
---- linux-2.6.5-7.276.orig/fs/ext3/super.c     2006-09-15 17:44:48.000000000 +0800
-+++ linux-2.6.5-7.276/fs/ext3/super.c  2006-10-26 16:47:10.000000000 +0800
+--- linux-2.6.5-7.283.orig/fs/ext3/super.c
++++ linux-2.6.5-7.283/fs/ext3/super.c
 @@ -33,6 +33,7 @@
  #include <linux/vfs.h>
  #include <linux/random.h>
@@ -1603,7 +1602,7 @@ Index: linux-2.6.5-7.276/fs/ext3/super.c
  #include "xattr.h"
  #include "acl.h"
  
-@@ -505,7 +506,33 @@
+@@ -505,7 +506,33 @@ static void ext3_clear_inode(struct inod
        ext3_discard_reservation(inode);
  }
  
@@ -1638,7 +1637,7 @@ Index: linux-2.6.5-7.276/fs/ext3/super.c
  
  static struct super_operations ext3_sops = {
        .alloc_inode    = ext3_alloc_inode,
-@@ -522,6 +549,10 @@
+@@ -522,6 +549,10 @@ static struct super_operations ext3_sops
        .statfs         = ext3_statfs,
        .remount_fs     = ext3_remount,
        .clear_inode    = ext3_clear_inode,
@@ -1648,8 +1647,8 @@ Index: linux-2.6.5-7.276/fs/ext3/super.c
 +#endif
  };
  
- struct dentry *ext3_get_parent(struct dentry *child);
-@@ -1335,7 +1366,9 @@
+ static struct dentry *ext3_get_dentry(struct super_block *sb, void *vobjp)
+@@ -1377,7 +1408,9 @@ static int ext3_fill_super (struct super
         */
        sb->s_op = &ext3_sops;
        sb->s_export_op = &ext3_export_ops;
@@ -1660,7 +1659,7 @@ Index: linux-2.6.5-7.276/fs/ext3/super.c
        INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
  
        sb->s_root = 0;
-@@ -1998,70 +2031,200 @@
+@@ -2040,70 +2073,200 @@ int ext3_statfs (struct super_block * sb
  
  #ifdef CONFIG_QUOTA
  
@@ -1909,7 +1908,7 @@ Index: linux-2.6.5-7.276/fs/ext3/super.c
  #endif
  
  static struct super_block *ext3_get_sb(struct file_system_type *fs_type,
-@@ -2086,13 +2249,7 @@
+@@ -2128,13 +2291,7 @@ static int __init init_ext3_fs(void)
        err = init_inodecache();
        if (err)
                goto out1;
@@ -1924,10 +1923,10 @@ Index: linux-2.6.5-7.276/fs/ext3/super.c
          err = register_filesystem_lifo(&ext3_fs_type);
        if (err)
                goto out;
-Index: linux-2.6.5-7.276/fs/quota_v1.c
+Index: linux-2.6.5-7.283/fs/quota_v1.c
 ===================================================================
---- linux-2.6.5-7.276.orig/fs/quota_v1.c       2006-09-15 17:44:47.000000000 +0800
-+++ linux-2.6.5-7.276/fs/quota_v1.c    2006-10-26 16:47:10.000000000 +0800
+--- linux-2.6.5-7.283.orig/fs/quota_v1.c
++++ linux-2.6.5-7.283/fs/quota_v1.c
 @@ -7,7 +7,6 @@
  #include <linux/init.h>
  #include <linux/module.h>
@@ -1936,7 +1935,7 @@ Index: linux-2.6.5-7.276/fs/quota_v1.c
  #include <asm/byteorder.h>
  
  MODULE_AUTHOR("Jan Kara");
-@@ -41,23 +40,14 @@
+@@ -41,23 +40,14 @@ static void v1_mem2disk_dqblk(struct v1_
  static int v1_read_dqblk(struct dquot *dquot)
  {
        int type = dquot->dq_type;
@@ -1962,7 +1961,7 @@ Index: linux-2.6.5-7.276/fs/quota_v1.c
  
        v1_disk2mem_dqblk(&dquot->dq_dqb, &dqblk);
        if (dquot->dq_dqb.dqb_bhardlimit == 0 && dquot->dq_dqb.dqb_bsoftlimit == 0 &&
-@@ -71,17 +61,9 @@
+@@ -71,17 +61,9 @@ static int v1_read_dqblk(struct dquot *d
  static int v1_commit_dqblk(struct dquot *dquot)
  {
        short type = dquot->dq_type;
@@ -1980,7 +1979,7 @@ Index: linux-2.6.5-7.276/fs/quota_v1.c
        /*
         * Note: clear the DQ_MOD flag unconditionally,
         * so we don't loop forever on failure.
-@@ -93,9 +75,10 @@
+@@ -93,9 +75,10 @@ static int v1_commit_dqblk(struct dquot 
                dqblk.dqb_itime = sb_dqopt(dquot->dq_sb)->info[type].dqi_igrace;
        }
        ret = 0;
@@ -1994,7 +1993,7 @@ Index: linux-2.6.5-7.276/fs/quota_v1.c
        if (ret != sizeof(struct v1_disk_dqblk)) {
                printk(KERN_WARNING "VFS: dquota write failed on dev %s\n",
                        dquot->dq_sb->s_id);
-@@ -106,7 +89,6 @@
+@@ -106,7 +89,6 @@ static int v1_commit_dqblk(struct dquot 
        ret = 0;
  
  out:
@@ -2002,7 +2001,7 @@ Index: linux-2.6.5-7.276/fs/quota_v1.c
        dqstats.writes++;
  
        return ret;
-@@ -126,14 +108,11 @@
+@@ -126,14 +108,11 @@ struct v2_disk_dqheader {
  
  static int v1_check_quota_file(struct super_block *sb, int type)
  {
@@ -2018,7 +2017,7 @@ Index: linux-2.6.5-7.276/fs/quota_v1.c
        loff_t isize;
        static const uint quota_magics[] = V2_INITQMAGICS;
  
-@@ -145,10 +124,7 @@
+@@ -145,10 +124,7 @@ static int v1_check_quota_file(struct su
        if ((blocks % sizeof(struct v1_disk_dqblk) * BLOCK_SIZE + off) % sizeof(struct v1_disk_dqblk))
                return 0;
        /* Doublecheck whether we didn't get file with new format - with old quotactl() this could happen */
@@ -2030,7 +2029,7 @@ Index: linux-2.6.5-7.276/fs/quota_v1.c
        if (size != sizeof(struct v2_disk_dqheader))
                return 1;       /* Probably not new format */
        if (le32_to_cpu(dqhead.dqh_magic) != quota_magics[type])
-@@ -160,16 +136,10 @@
+@@ -160,16 +136,10 @@ static int v1_check_quota_file(struct su
  static int v1_read_file_info(struct super_block *sb, int type)
  {
        struct quota_info *dqopt = sb_dqopt(sb);
@@ -2048,7 +2047,7 @@ Index: linux-2.6.5-7.276/fs/quota_v1.c
                if (ret >= 0)
                        ret = -EIO;
                goto out;
-@@ -178,38 +148,31 @@
+@@ -178,38 +148,31 @@ static int v1_read_file_info(struct supe
        dqopt->info[type].dqi_igrace = dqblk.dqb_itime ? dqblk.dqb_itime : MAX_IQ_TIME;
        dqopt->info[type].dqi_bgrace = dqblk.dqb_btime ? dqblk.dqb_btime : MAX_DQ_TIME;
  out:
@@ -2091,20 +2090,62 @@ Index: linux-2.6.5-7.276/fs/quota_v1.c
        return ret;
  }
  
-
-%diffstat
- fs/dquot.c               |  370 +++++++++++++++++++++++++++++++++++------------
- fs/ext3/inode.c          |    2 
- fs/ext3/super.c          |  271 +++++++++++++++++++++++++++-------
- fs/quota.c               |   47 +++++
- fs/quota_v1.c            |   63 +-------
- fs/quota_v2.c            |  245 ++++++++++++++-----------------
- include/linux/ext3_jbd.h |   15 +
- include/linux/fs.h       |    3 
- include/linux/quota.h    |   31 ++-
- include/linux/quotaops.h |   15 +
- include/linux/security.h |    6 
- security/dummy.c         |    2 
- security/selinux/hooks.c |    4 
- 13 files changed, 716 insertions(+), 358 deletions(-)
-
+Index: linux-2.6.5-7.283/fs/reiserfs/super.c
+===================================================================
+--- linux-2.6.5-7.283.orig/fs/reiserfs/super.c
++++ linux-2.6.5-7.283/fs/reiserfs/super.c
+@@ -1677,7 +1677,7 @@ inversion between quota and journal lock
+ #define REISERFS_V0_QFMT_BLOCKS (4*(JOURNAL_PER_BALANCE_CNT+2)+2+1)
+ static int (*old_write_dquot)(struct dquot *dquot);
+-static void (*old_drop_dquot)(struct inode *inode);
++static int (*old_drop_dquot)(struct inode *inode);
+ static int fmt_to_blocks(int fmt)
+ {
+@@ -1697,10 +1697,8 @@ static int reiserfs_write_dquot(struct d
+       int err;
+       struct reiserfs_transaction_handle handle;
+       struct quota_info *dqopt = sb_dqopt(dquot->dq_sb);
+-      struct inode *qinode;
+       nblocks = fmt_to_blocks(dqopt->info[dquot->dq_type].dqi_format->qf_fmt_id);
+-      qinode = dqopt->files[dquot->dq_type]->f_dentry->d_inode;
+       reiserfs_write_lock(dquot->dq_sb);
+       ret = journal_begin(&handle, dquot->dq_sb, nblocks);
+       if (ret)
+@@ -1713,11 +1711,12 @@ static int reiserfs_write_dquot(struct d
+       return ret;
+ }
+-static void reiserfs_drop_dquot(struct inode *inode)
++static int reiserfs_drop_dquot(struct inode *inode)
+ {
+       int nblocks, type;
+       struct quota_info *dqopt = sb_dqopt(inode->i_sb);
+       struct reiserfs_transaction_handle handle;
++      int err, ret;
+       for (type = 0; type < MAXQUOTAS; type++) {
+               if (sb_has_quota_enabled(inode->i_sb, type))
+@@ -1728,12 +1727,15 @@ static void reiserfs_drop_dquot(struct i
+       else
+               nblocks = 0;    /* No quota => no drop */ 
+       reiserfs_write_lock(inode->i_sb);
+-      if (journal_begin(&handle, inode->i_sb, 2*nblocks))
+-              return;
+-      old_drop_dquot(inode);
+-      journal_end(&handle, inode->i_sb, 2*nblocks);
++      err = journal_begin(&handle, inode->i_sb, 2*nblocks);
++      if (err);
++              return err;
++      ret = old_drop_dquot(inode);
++      err = journal_end(&handle, inode->i_sb, 2*nblocks);
++      if (!ret)
++              ret = err;
+       reiserfs_write_unlock(inode->i_sb);
+-      return;
++      return ret;
+ }
+ #endif