Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Jeremy Allison <jra@samba.org>
To: Steve French <smfrench@gmail.com>
Cc: "linux-cifs@vger.kernel.org" <linux-cifs@vger.kernel.org>,
	samba-technical <samba-technical@lists.samba.org>
Subject: Re: setting allocation size in cifs/smb3
Date: Fri, 18 Jul 2014 10:09:52 -0700	[thread overview]
Message-ID: <20140718170952.GA27001@samba2> (raw)
In-Reply-To: <CAH2r5ms25+31USEhsfDg7n1tqsF0+bT3qWdwjZ9p2RWEEHuxvQ@mail.gmail.com>

On Fri, Jul 18, 2014 at 01:15:07AM -0500, Steve French wrote:
> I created a patch to cifs.ko to add fallocate FALLOC_FL_KEEP_SIZE
> support and did some tests against a Samba server (Samba 4.1.6 on ext4
> on Ubuntu) and also a Windows 8.1 server (NTFS file system) and ran
> into an obvious problem.  How to tell if the allocation size is
> changed?  Neither stat on the Samba server local file system nor the
> Windows 8.1 properties show the size on disk changing.
> 
> I am sending SMB3 SetInfo level 0x13 (set allocation size) and getting
> success back from the Windows server and from Samba server.
> 
> If I set the length past the end of file I get no error, but the
> properties of the file in Windows Explorer still show the same (e.g.
> zero) as the file size.  If I try setting it to a size smaller than
> the size of the file, the file shrinks (by the way this is an awkward
> behavior to work around since on Linux fallocate can't shrink the file
> - so if you have any ideas short of revalidating the file size before
> deciding whether to send the fallocate request to Windows ...).
> 
> Any ideas why Samba shows success but doesn't actually call ext4 to
> update the allocation size?

smbd does use VFS_FALLOCATE_KEEP_SIZE, which maps
into fallocate FALLOC_FL_KEEP_SIZE if the underlying
storage supports it.

You need to set "strict allocate = true" on the
share in order to get this behavior though.

If you're setting allocation size smaller
than file size we just use ftruncate, I
don't see another possibility here. What
behavior do you expect in the shrink case ?

Jeremy.

  reply	other threads:[~2014-07-18 17:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-18  6:15 setting allocation size in cifs/smb3 Steve French
2014-07-18 17:09 ` Jeremy Allison [this message]
2014-07-19  4:49   ` Steve French
     [not found]     ` <CAH2r5mubvLEd7QFY8p-YSCojPPdwzQMXK_Ka6k7V0uKRgUeeaw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-19  5:14       ` Jeremy Allison
2014-07-21  4:47         ` Steve French
     [not found]           ` <CAH2r5mvSEYbGxE166W2GijnhKj4hVcVzhVLJQQeQeWejk4AoaQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-21 18:28             ` Jeremy Allison
2014-07-21 18:43               ` Steve French
     [not found]                 ` <CAH2r5mtLO9jwBx+EumbXzEjiprPMVvnz39CsZJsEm3dAraDDZQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-21 18:55                   ` Jeremy Allison
2014-07-21 19:27                     ` Steve French
     [not found]                       ` <CAH2r5msV39xCYsK9Ru=zaJadv5-fKa5-DHwUO7wPt+E55k0vMQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-21 19:41                         ` Steve French
     [not found]                           ` <CAH2r5msy4OWaJfAKUrc0Tzx73dsb0zx6fU1wAejKsksq1V8gdA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-23  0:07                             ` Jeremy Allison

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=20140718170952.GA27001@samba2 \
    --to=jra@samba.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=samba-technical@lists.samba.org \
    --cc=smfrench@gmail.com \
    /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