From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeremy Allison Subject: Re: setting allocation size in cifs/smb3 Date: Mon, 21 Jul 2014 11:55:28 -0700 Message-ID: <20140721185528.GD29893@samba2> References: <20140718170952.GA27001@samba2> <20140719051427.GA21226@jeremy-HP> <20140721182840.GC29893@samba2> Reply-To: Jeremy Allison Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jeremy Allison , samba-technical , "linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" To: Steve French Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-cifs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: On Mon, Jul 21, 2014 at 01:43:12PM -0500, Steve French wrote: > What about shrinking the file to the wrong size? In the set allocation path info it's going through: if (allocation_size) { allocation_size = smb_roundup(conn, allocation_size); } which by default uses 1MB allocation roundup values. If you need to set the file length, set the file length :-). It's arguable if the server can mess with allocation requests on file shrink, but this hasn't caused a problem in the SMB1/Windows SMB2 code paths so far, so I'm guessing it might be allowable.... More research needed !