Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Sep 2010 15:29:05 +0200
From:      Polytropon <freebsd@edvax.de>
To:        Bernard Scharp <freebsd-questions@itsacon.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Multiple mount_smbfs commands fail in bash script
Message-ID:  <20100902152905.905caea1.freebsd@edvax.de>
In-Reply-To: <4C7F925B.9010807@itsacon.net>
References:  <4C7F5F25.2010604@itsacon.net> <20100902075053.4bdb443b@scorpio> <4C7F925B.9010807@itsacon.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 02 Sep 2010 14:02:35 +0200, Bernard Scharp <freebsd-questions@itsacon.net> wrote:
> 
> > 
> > Could you post the script? Anything else would be pure guess work. You
> 
> Well, I can recreate it with something as simple as:
> 
> #!/usr/local/bin/bash
> mount_smbfs //user@remotehost/share1/ /tmp/mnt/
> mount_smbfs //user@remotehost/share2/ /tmp/mnt2/

Excuse me, it may just be a stupid question... but... why do
you use bash for this purpose? Do you require any special
bash feature that cannot be done using the standard shell,
sh? I often see the urge to use bash for scripting as a
typical "Linuxism", which is usually non-portable (if that
was your goal). FreeBSD's standard scripting shell is sh,
so why not use it until you reach the ends of its functionality?



Just a guess, regarding your initial question, as I don't have
experience with "Windows" related things: Did you have the
chance to monitor correct operations of your script in the
past? Did the mound and umount (!) calls work properly? Have
you checked your commands running them in the standard dialog
shell (csh)? I assume you're running them as root (or at least
with sufficient permissions), so I don't think the problem
is there, as the error message

mount_smbfs: can't get handle to requester (no /dev/nsmb* device)

doesn't look like refering to that problem.

The error message originates from /usr/src/contrib/smbfs/lib/smb/ctx.c;
having a look around, and remembering that you said

> [...] there are (by last count) 1170 /dev/nsmb* devices
> in /dev/ (is that normal?)

I found smb_ctx_gethandle() near line 600 (version 7 OS here):

        /*
         * well, no clone capabilities available - we have to scan
         * all devices in order to get free one
         */
         for (i = 0; i < 1024; i++) {
                 snprintf(buf, sizeof(buf), "/dev/%s%d", NSMB_NAME, i);
                 fd = open(buf, O_RDWR);
                 if (fd >= 0) {
                        ctx->ct_fd = fd;
                        return 0;
                 }
         }

The limit seems to be 1024, if I read that correctly - allthough
I'm considered a "C hacker", I'm no "OS-level C hacker". :-)

Afterwards, smb_ctx_lookup() fails and gives the error message
mentioned earlier.

Remove the /dev/nsmb* devices and try again. Make sure no other
SMB stuff is currently mounted, just to be sure, as I don't have
any idea what could fail.




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100902152905.905caea1.freebsd>