public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Allison <jra@samba.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: "Jeremy Allison" <jra@samba.org>,
	"YOSHIFUJI Hideaki / 吉藤英明" <yoshfuji@linux-ipv6.org>,
	samuel.thibault@ens-lyon.org, linux-kernel@vger.kernel.org
Subject: Re: [2.6] smbfs & "du" illness
Date: Sat, 25 Sep 2004 15:08:43 -0700	[thread overview]
Message-ID: <20040925220843.GD580@jeremy1> (raw)
In-Reply-To: <Pine.LNX.4.58.0409251445470.2317@ppc970.osdl.org>

On Sat, Sep 25, 2004 at 02:59:08PM -0700, Linus Torvalds wrote:
> 
> So let's work out something that works well now, _and_ might have a chance 
> in hell of working in the future too.

Ok. BTW I've fixed this in the current SVN codebase
to do the right thing (return st_blocks expressed as
bytes).

> What kinds of values do different smb servers actually fill this field 
> with? And what's the value you expect future samba severs will use?

Ok, right now the only smb server that supports the UNIX
extensions is smbd (I'm working on getting NetApp to also
support them, but they don't as yet so we can get them to
do the right thing, bytes allocated, when they do), so we
know pretty much what will happen.

> Ie, will something like this DTRT in smb_decode_unix_basic():
> 
> 	u64 size = LVAL(p, 0);	/* file size */
> 	u64 blocks = LVAL(p, 8); /* pseudo-blocks */
> 	u32 real_blocks;
> 
>         fattr->f_size = size;
> 	real_blocks = (size + 511) >> 9;
> 
> 	/*
> 	 * old samba sends "bytes used on disk rounded up to 1MB",
> 	 * which is useless - ignore it. But if the low bits are
> 	 * set, maybe the value is valid..
> 	 */
> 	if (blocks & 0xfffff) {
> 		/*
> 		 * If the low 9 bits are non-zero, it can't
> 		 * be a byte count, but maybe it's a block
> 		 * count?
> 		 */
> 		if (blocks & 0x1ff) {
> 			.. use it how? ..
> 		} else {
> 			real_blocks = blocks >> 9;
> 		}
> 	}
>         fattr->f_blocks = real_blocks;
> 
> the above is ugly as hell, but what choice is there?

Not much, sorry. 

> It would be good to know what all different server implementations can 
> do, to know just _how_ defensive this code has to be. 

It has to deal with Samba sending bytes allocated on disk (from st_blocks),
rounded up to the nearest 1mb (or whatever the local admin compiled with,
but most people don't mess with that compile-time parameter) or starting
with Samba 3.0.8 it'll send the value from the server st_blocks expressed
as bytes. So it doesn't have to be too bad (I hope).

Jeremy.

  reply	other threads:[~2004-09-25 22:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-17 20:54 [2.6] smbfs & "du" illness Samuel Thibault
2004-09-25 16:41 ` Linus Torvalds
2004-09-25 17:11   ` Jeremy Allison
2004-09-25 17:14     ` Jeremy Allison
2004-09-25 17:41     ` YOSHIFUJI Hideaki / 吉藤英明
     [not found]       ` <20040925174406.GP580@jeremy1>
2004-09-25 18:06         ` Linus Torvalds
2004-09-25 18:12           ` Linus Torvalds
2004-09-25 18:20             ` Jeremy Allison
2004-09-25 18:25               ` Samuel Thibault
2004-09-25 18:32                 ` Jeremy Allison
2004-09-25 19:16               ` Linus Torvalds
2004-09-25 19:22                 ` Jeremy Allison
2004-09-25 19:27                   ` Samuel Thibault
2004-09-25 18:29           ` Jeremy Allison
2004-09-25 18:31             ` Jeremy Allison
2004-09-25 19:20             ` Linus Torvalds
2004-09-25 19:25               ` Jeremy Allison
2004-09-25 19:52               ` Jeremy Allison
2004-09-25 20:21                 ` Linus Torvalds
2004-09-25 21:10                   ` Jeremy Allison
2004-09-25 21:59                     ` Linus Torvalds
2004-09-25 22:08                       ` Jeremy Allison [this message]
2004-09-25 22:18                         ` Linus Torvalds
2004-09-25 22:23                           ` Jeremy Allison
2004-09-25 22:40                           ` Samuel Thibault
2004-09-26  0:41             ` Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040925220843.GD580@jeremy1 \
    --to=jra@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=torvalds@osdl.org \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox