From 9500ebf6146dcd50dab094b502d4b50d0123296a Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Fri, 21 Oct 2011 18:44:31 -0600 Subject: [PATCH] LU-762 ldiskfs: don't drop directory nlink to 0 When landing the nlink patch for ext4, for an unknown reason the logic in ext4_dec_count() was changed from the ext3 version of the patch. It now drops the nlink = 0 temporarily and then if it is a directory with nlink == 0 it increases nlink again. Instead, only drop nlink if it is larger than 2. Signed-off-by: Andreas Dilger Change-Id: Id4dd16d3764efdf6a7ea29da92de51398b300370 Reviewed-on: http://review.whamcloud.com/1579 Reviewed-by: Johann Lombardi Tested-by: Hudson --- .../kernel_patches/patches/ext4-nlink-2.6-rhel5.patch | 16 ++++++++++++++++ .../kernel_patches/series/ldiskfs-2.6-rhel5-ext4.series | 1 + 2 files changed, 17 insertions(+) create mode 100644 ldiskfs/kernel_patches/patches/ext4-nlink-2.6-rhel5.patch diff --git a/ldiskfs/kernel_patches/patches/ext4-nlink-2.6-rhel5.patch b/ldiskfs/kernel_patches/patches/ext4-nlink-2.6-rhel5.patch new file mode 100644 index 0000000..f493288 --- /dev/null +++ b/ldiskfs/kernel_patches/patches/ext4-nlink-2.6-rhel5.patch @@ -0,0 +1,16 @@ +Index: linux-stage/fs/ext4/namei.c +=================================================================== +--- linux-stage.orig/fs/ext4/namei.c ++++ linux-stage/fs/ext4/namei.c +@@ -1709,9 +1709,8 @@ static void ext4_inc_count(handle_t *han + */ + static void ext4_dec_count(handle_t *handle, struct inode *inode) + { +- drop_nlink(inode); +- if (S_ISDIR(inode->i_mode) && inode->i_nlink == 0) +- inc_nlink(inode); ++ if (!S_ISDIR(inode->i_mode) || inode->i_nlink > 2) ++ drop_nlink(inode); + } + + 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 b767923..66e7ee8 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5-ext4.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5-ext4.series @@ -4,6 +4,7 @@ iopen-2.6.18-rhel5-ext4.patch ext4-map_inode_page-2.6.18-rhel5.patch export-ext4-2.6-rhel5.patch ext4-remove-cond_resched-calls-rhel5.patch +ext4-nlink-2.6-rhel5.patch ext4-inode-version-rhel5.patch ext4-mmp-rhel5.patch ext4-lookup-dotdot-rhel5.patch -- 1.8.3.1