netfs allows multiple identical mounts (was: smb/mount bug.)

From: Urban Widmark (urban@teststation.com)
Date: Tue Aug 07 2001 - 18:20:18 EST


On Mon, 6 Aug 2001, Dan Podeanu wrote:

> This should be self explanatory. My guess is, its probably the smb
> filesystem reporting as mounting again a share after network failure.

A very simple way to reproduce this (on 2.4.7):

$ mount -t smbfs -o username=puw //srv/share /mnt/smb
$ mount -t smbfs -o username=puw //srv/share /mnt/smb
$ cat /proc/mounts | grep smbfs
//srv/share /mnt/smb smbfs rw 0 0
//srv/share /mnt/smb smbfs rw 0 0

But smbfs isn't alone in allowing this, nfs does it too (hej Trond):

$ mount -t nfs srv:/mnt/something /mnt/x1
$ mount -t nfs srv:/mnt/something /mnt/x1
$ cat /proc/mounts | grep x1
srv:/mnt/store /mnt/x1 nfs rw,v2,rsize=8192,...
srv:/mnt/store /mnt/x1 nfs rw,v2,rsize=8192,...

This is probably something that smbmount could check before mounting.
But I'm not sure if that is the best fix.

fs/super.c:do_add_mount has this (2.4.7)

        /* Refuse the same filesystem on the same mount point */
        if (nd->mnt->mnt_sb == sb && nd->mnt->mnt_root == nd->dentry)
                retval = -EBUSY;
        else
                retval = graft_tree(mnt, nd);

As I read the rest of the code, 'nd->mnt->mnt_sb == sb' will be true if
the block device is the same. And trying to mount a local fs multiple
times on the same place fails. However, networked fs' get a new superblock
(and device) each time they are mounted so that condition will never be
true.

It could compare the server string ("//srv/share") but what if that server
listens to more than one name?

/Urban

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



This archive was generated by hypermail 2b29 : Tue Aug 07 2001 - 21:00:48 EST