2.4.6 mount behavior changed (graft_tree in fs/super.c)

Mark Montague (monty@gg.caltech.edu)
Thu, 12 Jul 2001 20:50:38 -0700


For some reason, NFS has traditionally been happy mounting a plain
file on a directory, but hasn't liked mount points that aren't
directories. Although I have no idea why this is, I've been using it
to mount just one file from an NFS server.

The vfs changes in 2.4.6 now will *only* mount a file on a file, and a
directory on a directory, which, although it kinda makes more sense,
doesn't agree with mount(2):

ENOTDIR
The second argument, or a prefix of the first argu
ment, is not a directory.

For what it's worth, HPUX 10.20's, IRIX 6.5's, and SunOS 5.7's
mount(2)s agree with the man page. I don't know if the change breaks
POSIXly-correctness, but for consistency with other OSes, it seems
like the old behavior, while bizarre, is desirable.

I'm not supplying a real patch because I suspect that the fact that
graft_tree is called from two contexts makes fiddling there fraught
with peril, and I don't have time to test it right now, but I think
this patch will return mount to its old behavior (and will do
something random and possibly horrible to loopback mounts, and may not
be consistent with NFS, and probably causes cancer):

--- super.c.orig Thu Jul 12 20:42:08 2001
+++ super.c Thu Jul 12 20:47:51 2001
@@ -422,8 +422,7 @@

static int graft_tree(struct vfsmount *mnt, struct nameidata *nd)
{
- if (S_ISDIR(nd->dentry->d_inode->i_mode) !=
- S_ISDIR(mnt->mnt_root->d_inode->i_mode))
+ if ((!S_ISDIR(nd->dentry->d_inode->i_mode))
return -ENOTDIR;

down(&nd->dentry->d_inode->i_zombie);

shrug

- M

--
Mark "Monty" Montague | monty@gg.caltech.edu  | I don't do Windows(tm)
		 main(){printf("I am self-aware\\n");}
	  <URL:http://www.gg.caltech.edu/~monty/monty.shtml>
 X-PGP-Fingerprint: E4 EA 6D B1 82 46 DB A1  B0 FF 60 B9 F9 5D 5C F7

- 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/