2000-11-17 03:14:23

by Jeff V. Merkey

[permalink] [raw]
Subject: NCPFS not returning Volume Size (???)

Petr,

NCPFS in 2.2.18-pre21 is not returning volume size via df -h. I checked
your code and found this comment:

static int ncp_statfs(struct super_block *sb, struct statfs *buf, int bufsiz)
{
struct statfs tmp;

/* We cannot say how much disk space is left on a mounted
NetWare Server, because free space is distributed over
volumes, and the current user might have disk quotas. So
free space is not that simple to determine. Our decision
here is to err conservatively. */

tmp.f_type = NCP_SUPER_MAGIC;
tmp.f_bsize = 512;
tmp.f_blocks = 0;
tmp.f_bfree = 0;
tmp.f_bavail = 0;
tmp.f_files = -1;
tmp.f_ffree = -1;
tmp.f_namelen = 12;
return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0;
}

NCP Code

2222/17E6 Get Object's Remaining Disk Space

(I have docs on this one and can send if you need it).

will return in NetWare sized blocks the space remaining for this
user (which will be the user ID used to login). The fact that quota's
are present for a user (user space restriction node -- in NWDIR.H)
should be irrelevant, since from the view of a Linux client attached to
a NetWare server, this is their assigned storage.

This NCP also speaks in hardcoded blocksizes of 4096 bytes, so that's
the factor for free space for whatever login ID was used to mount
the NetWare Volume that can be used in ncpfs_statfs() to return
free space.

I have not gone through your userspace code as of yet, but to make
this work, you need the ObjectID for the User Account you used to
connect to the server in order to make this work.

I noticed I could not get free space from my Server with NCPFS with
df -h, and tracked it down. Several NetWare customers migrating
installations of NetWare to Linux pointed it out when they were
moving Oracle databases over to Linux from NetWare.

I noticed that 2.4 also is not reporting Volume free space.

The current NCPFS code, like a lot of Linux code, is structured
in a manner that's very different from Novell's internal code,
(the names are shorter for one, which is an improvement). The
way the NCP codes are peeled off is different and not the
large case and switch structure employed in NetWare, so it's
a little hard for me to follow since I am used to NCPs being
grouped into case/switch classes. If you can point me to
where 1) the login ID is stored and B) where NCP packet
request/reponse headers are constructed, i.e. a skeleton
to send/receive the requests I can grab, I'll try to
code this for you.

:-)

Jeff


2000-11-17 03:29:17

by Jeff V. Merkey

[permalink] [raw]
Subject: Re: NCPFS not returning Volume Size (???)

On Thu, Nov 16, 2000 at 08:40:29PM -0700, Jeff V. Merkey wrote:
> Petr,
>
> NCPFS in 2.2.18-pre21 is not returning volume size via df -h. I checked
> your code and found this comment:
>
> static int ncp_statfs(struct super_block *sb, struct statfs *buf, int bufsiz)
> {
> struct statfs tmp;
>
> /* We cannot say how much disk space is left on a mounted
> NetWare Server, because free space is distributed over
> volumes, and the current user might have disk quotas. So
> free space is not that simple to determine. Our decision
> here is to err conservatively. */
>
> tmp.f_type = NCP_SUPER_MAGIC;
> tmp.f_bsize = 512;
> tmp.f_blocks = 0;
> tmp.f_bfree = 0;
> tmp.f_bavail = 0;
> tmp.f_files = -1;
> tmp.f_ffree = -1;
> tmp.f_namelen = 12;
> return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0;
> }
>
> NCP Code
>
> 2222/17E6 Get Object's Remaining Disk Space
>
> (I have docs on this one and can send if you need it).
>
> will return in NetWare sized blocks the space remaining for this
> user (which will be the user ID used to login). The fact that quota's
> are present for a user (user space restriction node -- in NWDIR.H)
> should be irrelevant, since from the view of a Linux client attached to
> a NetWare server, this is their assigned storage.
>
> This NCP also speaks in hardcoded blocksizes of 4096 bytes, so that's
> the factor for free space for whatever login ID was used to mount
> the NetWare Volume that can be used in ncpfs_statfs() to return
> free space.

COrrection. 3.x always reports as 4096 blocks, 4.11 > reports as
4K, 8K, 16K, 32K, and 64K. I have not checked what NSS is reporting,
but will test tonight.

Jeff

>
> I have not gone through your userspace code as of yet, but to make
> this work, you need the ObjectID for the User Account you used to
> connect to the server in order to make this work.
>
> I noticed I could not get free space from my Server with NCPFS with
> df -h, and tracked it down. Several NetWare customers migrating
> installations of NetWare to Linux pointed it out when they were
> moving Oracle databases over to Linux from NetWare.
>
> I noticed that 2.4 also is not reporting Volume free space.
>
> The current NCPFS code, like a lot of Linux code, is structured
> in a manner that's very different from Novell's internal code,
> (the names are shorter for one, which is an improvement). The
> way the NCP codes are peeled off is different and not the
> large case and switch structure employed in NetWare, so it's
> a little hard for me to follow since I am used to NCPs being
> grouped into case/switch classes. If you can point me to
> where 1) the login ID is stored and B) where NCP packet
> request/reponse headers are constructed, i.e. a skeleton
> to send/receive the requests I can grab, I'll try to
> code this for you.
>
> :-)
>
> Jeff
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> Please read the FAQ at http://www.tux.org/lkml/

2000-11-20 05:27:08

by Jeff V. Merkey

[permalink] [raw]
Subject: Re: NCPFS not returning Volume Size (???)

On Sun, Nov 19, 2000 at 05:10:06PM +0100, Petr Vandrovec wrote:
> On Thu, Nov 16, 2000 at 08:40:29PM -0700, Jeff V. Merkey wrote:
> > Petr,
> >
> > NCPFS in 2.2.18-pre21 is not returning volume size via df -h. I checked
> > your code and found this comment:
> >
> > static int ncp_statfs(struct super_block *sb, struct statfs *buf, int bufsiz)
> > {
> > NCP Code
> >
> > 2222/17E6 Get Object's Remaining Disk Space
> >
> > I noticed that 2.4 also is not reporting Volume free space.
>
> Yes, it is intentional. There are two different things:
> (1) you can mount all volumes from server to one mountpoint, and all these
> volumes share one superblock. So it is not clear, which value to
> return. Sum of all volume sizes?
> (2) in Netware, each directory can have its own space limit, so
> returned free space should differ from directory to directory.
> As statfs is per-superblock thing, I believe that returning
> 'sorry, I do not know' is better.
>
> > grouped into case/switch classes. If you can point me to
> > where 1) the login ID is stored and B) where NCP packet
> > request/reponse headers are constructed, i.e. a skeleton
> > to send/receive the requests I can grab, I'll try to
> > code this for you.
>
> loginID is not stored anywhere in kernel. You can look at
> ioctl(,NCP_IOC_GETOBJECTNAME,...). If you need your own ID
> so you know which disk space restriction retrieve, you'll have
> to first execute retrieve logged in info for current connection
> (where connection number is stored in server->connection).
>
> request/reply is built in preallocated space, you can look
> at functions in ncplib_kernel.c, f.e. ncp_open_create_file_or_subdir
> uses almost every of ncp_add_* functions. ncp_request() then
> executes RPC call and ncp_unlock_server() unlocks connection.
> You must NOT access userspace between ncp_init_request()
> and ncp_unlock_server() function, or deadlock can occur.
>

There's is a method to obtain this accurately. NSS may have
changed some things. I have a list of four issues now with this
one I need to get finished. I may need some help with your code
as I go.

Jeff


> Best regards,
> Petr Vandrovec
> [email protected]