Whamcloud - gitweb
Branch: b1_4
authoradilger <adilger>
Sat, 26 Mar 2005 08:27:13 +0000 (08:27 +0000)
committeradilger <adilger>
Sat, 26 Mar 2005 08:27:13 +0000 (08:27 +0000)
Fix regression caught by e2fsck - we weren't unlinking empty directories
if they were renamed-over by another directory.  This is impossible to
do with a shell, as it will move the source dir INTO the target instead
of OVER the target.
b=5953

ldiskfs/kernel_patches/patches/ext3-mballoc2-2.6-suse.patch
ldiskfs/kernel_patches/patches/ext3-nlinks-2.6.7.patch
lustre/kernel_patches/patches/ext3-mballoc2-2.4.24.patch
lustre/kernel_patches/patches/ext3-mballoc2-2.6-suse.patch
lustre/kernel_patches/patches/ext3-nlinks-2.4.20-hp_pnnl.patch
lustre/kernel_patches/patches/ext3-nlinks-2.4.21-chaos.patch
lustre/kernel_patches/patches/ext3-nlinks-2.4.24.patch
lustre/kernel_patches/patches/ext3-nlinks-2.6.7.patch

index b9bcfac..4de2b32 100644 (file)
@@ -2192,11 +2192,11 @@ Index: linux-2.6.5-suse/include/linux/ext3_fs_sb.h
 +      __u32           bb_bitmap;
 +      __u32           bb_buddy;
 +      spinlock_t      bb_lock;
-+      unsigned long   bb_tid;
++      unsigned long   bb_tid;
 +      struct ext3_free_metadata *bb_md_cur;
 +      unsigned short  bb_first_free;
 +      unsigned short  bb_free;
-+      unsigned        bb_counters[];
++      unsigned        bb_counters[];
 +};
 +
  /*
index d5b771a..bb9fc1b 100644 (file)
@@ -110,7 +110,7 @@ Index: linux-2.6.7/fs/ext3/namei.c
                new_inode->i_ctime = CURRENT_TIME;
        }
        old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME;
-@@ -2299,11 +2304,11 @@ static int ext3_rename (struct inode * o
+@@ -2299,11 +2304,13 @@ static int ext3_rename (struct inode * o
                PARENT_INO(dir_bh->b_data) = le32_to_cpu(new_dir->i_ino);
                BUFFER_TRACE(dir_bh, "call ext3_journal_dirty_metadata");
                ext3_journal_dirty_metadata(handle, dir_bh);
@@ -118,7 +118,9 @@ Index: linux-2.6.7/fs/ext3/namei.c
 +              ext3_dec_count(handle, old_dir);
                if (new_inode) {
 -                      new_inode->i_nlink--;
-+                      ext3_dec_count(handle, new_inode);
++                      /* checked empty_dir above, can't have another parent,
++                       * ext3_dec_count() won't work for many-linked dirs */
++                      new_inode->i_nlink = 0;
                } else {
 -                      new_dir->i_nlink++;
 +                      ext3_inc_count(handle, new_dir);
index 3782889..172432a 100644 (file)
@@ -1738,7 +1738,7 @@ Index: linux-2.4.20-rh-20.9/include/linux/ext3_fs_sb.h
 +      unsigned long   bb_bitmap;
 +      unsigned long   bb_buddy;
 +      spinlock_t      bb_lock;
-+      unsigned        bb_counters[EXT3_BB_MAX_ORDER];
++      unsigned        bb_counters[EXT3_BB_MAX_ORDER];
 +      struct ext3_free_metadata *bb_md_cur;
 +      unsigned long bb_tid;
 +};
index b9bcfac..4de2b32 100644 (file)
@@ -2192,11 +2192,11 @@ Index: linux-2.6.5-suse/include/linux/ext3_fs_sb.h
 +      __u32           bb_bitmap;
 +      __u32           bb_buddy;
 +      spinlock_t      bb_lock;
-+      unsigned long   bb_tid;
++      unsigned long   bb_tid;
 +      struct ext3_free_metadata *bb_md_cur;
 +      unsigned short  bb_first_free;
 +      unsigned short  bb_free;
-+      unsigned        bb_counters[];
++      unsigned        bb_counters[];
 +};
 +
  /*
index d2b3cd2..40bbaa5 100644 (file)
@@ -124,7 +124,7 @@ Index: linux/fs/ext3/namei.c
                new_inode->i_ctime = CURRENT_TIME;
        }
        old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME;
-@@ -2264,11 +2269,11 @@
+@@ -2264,11 +2269,13 @@
                PARENT_INO(dir_bh->b_data) = le32_to_cpu(new_dir->i_ino);
                BUFFER_TRACE(dir_bh, "call ext3_journal_dirty_metadata");
                ext3_journal_dirty_metadata(handle, dir_bh);
@@ -132,7 +132,9 @@ Index: linux/fs/ext3/namei.c
 +              ext3_dec_count(handle, old_dir);
                if (new_inode) {
 -                      new_inode->i_nlink--;
-+                      ext3_dec_count(handle, new_inode);
++                      /* checked empty_dir above, can't have another parent,
++                       * ext3_dec_count() won't work for many-linked dirs */
++                      new_inode->i_nlink = 0;
                } else {
 -                      new_dir->i_nlink++;
 +                      ext3_inc_count(handle, new_dir);
index 5990323..4543943 100644 (file)
@@ -124,7 +124,7 @@ Index: 69chaos/fs/ext3/namei.c
                new_inode->i_ctime = CURRENT_TIME;
        }
        old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME;
-@@ -2267,11 +2272,11 @@
+@@ -2267,11 +2272,13 @@
                PARENT_INO(dir_bh->b_data) = le32_to_cpu(new_dir->i_ino);
                BUFFER_TRACE(dir_bh, "call ext3_journal_dirty_metadata");
                ext3_journal_dirty_metadata(handle, dir_bh);
@@ -132,7 +132,9 @@ Index: 69chaos/fs/ext3/namei.c
 +              ext3_dec_count(handle, old_dir);
                if (new_inode) {
 -                      new_inode->i_nlink--;
-+                      ext3_dec_count(handle, new_inode);
++                      /* checked empty_dir above, can't have another parent,
++                       * ext3_dec_count() won't work for many-linked dirs */
++                      new_inode->i_nlink = 0;
                } else {
 -                      new_dir->i_nlink++;
 +                      ext3_inc_count(handle, new_dir);
index b230d34..245d83e 100644 (file)
                new_inode->i_ctime = CURRENT_TIME;
        }
        old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME;
-@@ -2296,11 +2301,11 @@
+@@ -2296,11 +2301,13 @@
                PARENT_INO(dir_bh->b_data) = le32_to_cpu(new_dir->i_ino);
                BUFFER_TRACE(dir_bh, "call ext3_journal_dirty_metadata");
                ext3_journal_dirty_metadata(handle, dir_bh);
 +              ext3_dec_count(handle, old_dir);
                if (new_inode) {
 -                      new_inode->i_nlink--;
-+                      ext3_dec_count(handle, new_inode);
++                      /* checked empty_dir above, can't have another parent,
++                       * ext3_dec_count() won't work for many-linked dirs */
++                      new_inode->i_nlink = 0;
                } else {
 -                      new_dir->i_nlink++;
 +                      ext3_inc_count(handle, new_dir);
index d5b771a..bb9fc1b 100644 (file)
@@ -110,7 +110,7 @@ Index: linux-2.6.7/fs/ext3/namei.c
                new_inode->i_ctime = CURRENT_TIME;
        }
        old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME;
-@@ -2299,11 +2304,11 @@ static int ext3_rename (struct inode * o
+@@ -2299,11 +2304,13 @@ static int ext3_rename (struct inode * o
                PARENT_INO(dir_bh->b_data) = le32_to_cpu(new_dir->i_ino);
                BUFFER_TRACE(dir_bh, "call ext3_journal_dirty_metadata");
                ext3_journal_dirty_metadata(handle, dir_bh);
@@ -118,7 +118,9 @@ Index: linux-2.6.7/fs/ext3/namei.c
 +              ext3_dec_count(handle, old_dir);
                if (new_inode) {
 -                      new_inode->i_nlink--;
-+                      ext3_dec_count(handle, new_inode);
++                      /* checked empty_dir above, can't have another parent,
++                       * ext3_dec_count() won't work for many-linked dirs */
++                      new_inode->i_nlink = 0;
                } else {
 -                      new_dir->i_nlink++;
 +                      ext3_inc_count(handle, new_dir);