[PATCH] sys_mount inconsistency in 2.0.33

Alexander Viro (viro@math.psu.edu)
Sun, 28 Dec 1997 23:22:39 -0500 (EST)


Hi!
There is some inconsistency in sys_mount (actually do_mount).
If we try to mount on the regular file with i_count>1 it returns EBUSY
instead of ENOTDIR. The following is an obvious patch for 2.0.33.

------------------------------------------------------------------------------
diff -u -r -N linux-2.0.33-orig/fs/super.c linux/fs/super.c
--- linux-2.0.33-orig/fs/super.c Thu Nov 13 04:56:09 1997
+++ linux/fs/super.c Sun Dec 28 23:06:36 1997
@@ -709,13 +709,13 @@
error = namei(dir_name, &dir_i);
if (error)
return error;
- if (dir_i->i_count != 1 || dir_i->i_mount) {
- iput(dir_i);
- return -EBUSY;
- }
if (!S_ISDIR(dir_i->i_mode)) {
iput(dir_i);
return -ENOTDIR;
+ }
+ if (dir_i->i_count != 1 || dir_i->i_mount) {
+ iput(dir_i);
+ return -EBUSY;
}
if (!fs_may_mount(dev)) {
iput(dir_i);