From: yangsheng Date: Thu, 8 Jul 2010 14:10:04 +0000 (+0800) Subject: b=23235 Reintroduce ext4_dquot_initialize() and ext4_dquot_drop() to avoid deadlock. X-Git-Tag: v1_8_4_RC1~11 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=530ddd7935bfbea6a9714c69d44da61f5efc098f;p=fs%2Flustre-release.git b=23235 Reintroduce ext4_dquot_initialize() and ext4_dquot_drop() to avoid deadlock. 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 --- 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 index 0000000..c3b0ef8 --- /dev/null +++ b/ldiskfs/kernel_patches/patches/ext4-back-dquot-to-rhel54.patch @@ -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, diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5-ext4.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5-ext4.series index 4049c57..038fe5f 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5-ext4.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5-ext4.series @@ -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