Whamcloud - gitweb
b=23235 Reintroduce ext4_dquot_initialize() and ext4_dquot_drop() to avoid deadlock.
authoryangsheng <Sheng.Yang@Sun.COM>
Thu, 8 Jul 2010 14:10:04 +0000 (22:10 +0800)
committerjohann <johann@granier.local>
Thu, 8 Jul 2010 14:35:51 +0000 (16:35 +0200)
The problem is that lustre already starts a transaction before calling the ldiskfs/quota functions
most of the time, so we still need quota drop & initialize to start the transaction first to avoid
ordering issue with the other quota operations.

i=johann
i=landen
i=panda

ldiskfs/kernel_patches/patches/ext4-back-dquot-to-rhel54.patch [new file with mode: 0644]
ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5-ext4.series

diff --git a/ldiskfs/kernel_patches/patches/ext4-back-dquot-to-rhel54.patch b/ldiskfs/kernel_patches/patches/ext4-back-dquot-to-rhel54.patch
new file mode 100644 (file)
index 0000000..c3b0ef8
--- /dev/null
@@ -0,0 +1,53 @@
+diff -up a/fs/ext4/super.c b/s/ext4/super.c
+--- a/fs/ext4/super.c
++++ b/fs/ext4/super.c
+@@ -706,9 +767,47 @@ static inline struct inode *dquot_to_ino
+ static ssize_t ext4_quota_write(struct super_block *sb, int type,
+                               const char *data, size_t len, loff_t off);
+
++static int ext4_dquot_initialize(struct inode *inode, int type)
++{
++      handle_t *handle;
++      int ret, err;
++
++      /* We may create quota structure so we need to reserve enough blocks */
++      handle = ext4_journal_start(inode, 2*EXT4_QUOTA_INIT_BLOCKS(inode->i_sb));
++      if (IS_ERR(handle))
++              return PTR_ERR(handle);
++      ret = dquot_initialize(inode, type);
++      err = ext4_journal_stop(handle);
++      if (!ret)
++              ret = err;
++      return ret;
++}
++
++static int ext4_dquot_drop(struct inode *inode)
++{
++      handle_t *handle;
++      int ret, err;
++
++      /* We may delete quota structure so we need to reserve enough blocks */
++      handle = ext4_journal_start(inode, 2*EXT4_QUOTA_DEL_BLOCKS(inode->i_sb));
++      if (IS_ERR(handle)) {
++              /*
++               * We call dquot_drop() anyway to at least release references
++               * to quota structures so that umount does not hang.
++               */
++              dquot_drop(inode);
++              return PTR_ERR(handle);
++      }
++      ret = dquot_drop(inode);
++      err = ext4_journal_stop(handle);
++      if (!ret)
++              ret = err;
++      return ret;
++}
++
+ static struct dquot_operations ext4_quota_operations = {
+-      .initialize     = dquot_initialize,
+-      .drop           = dquot_drop,
++      .initialize     = ext4_dquot_initialize,
++      .drop           = ext4_dquot_drop,
+       .alloc_space    = dquot_alloc_space,
+       .alloc_inode    = dquot_alloc_inode,
+       .free_space     = dquot_free_space,
index 4049c57..038fe5f 100644 (file)
@@ -28,3 +28,4 @@ ext4_data_in_dirent.patch
 ext4-extents-mount-option-rhel5.patch
 ext4-fiemap-2.6-rhel5.patch
 ext4-mballoc-skip-grps.patch
+ext4-back-dquot-to-rhel54.patch