[PATCH] [BUGFIX] racing between rmdir and rename on 2.4.18

Hirokazu Takahashi (taka@valinux.co.jp)
Thu, 04 Apr 2002 21:00:55 +0900 (JST)


Hello

I found a bug and fix it.

When files are moved under a directory which is just being removed,
it may cause a problem because target directory might be dead.

In function vfs_rename_other(), IS_DEADDIR(new_dir) check should
be done after double_down() like vfs_rename_dir() does.

--- linux/fs/namei.c.orig Tue Feb 26 04:38:09 2002
+++ linux/fs/namei.c Tue Apr 2 12:37:37 2002
@@ -1802,7 +1802,9 @@
DQUOT_INIT(old_dir);
DQUOT_INIT(new_dir);
double_down(&old_dir->i_zombie, &new_dir->i_zombie);
- if (d_mountpoint(old_dentry)||d_mountpoint(new_dentry))
+ if (IS_DEADDIR(old_dir)||IS_DEADDIR(new_dir))
+ error = -ENOENT;
+ else if (d_mountpoint(old_dentry)||d_mountpoint(new_dentry))
error = -EBUSY;
else
error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/