[PATCH] extend sparse file support

Jeremy Allison jra at samba.org
Fri Mar 6 17:06:45 MST 2015


On Wed, Mar 04, 2015 at 11:59:34PM +0100, David Disseldorp wrote:
> On Wed, 4 Mar 2015 14:22:38 -0800, Jeremy Allison wrote:
> 
> > > > https://git.samba.org/?p=ddiss/samba.git;a=shortlog;h=refs/heads/viel_sparse  
> > > 
> > > Ping, did this make it onto someone's queue?  
> > 
> > It's on my queue but it'd be much easier as a patchset
> > in one email (hint hint :-).
> 
> Attached, thanks!

OK - mostly good. Just a few things to clarify:

In :

-------------------------------------
Subject: [PATCH 08/19] smbd/ioctl: add FSCTL_QUERY_ALLOCATED_RANGES support

This change implements support for FSCTL_QUERY_ALLOCATED_RANGES using
the SEEK_HOLE/SEEK_DATA functionality of lseek().

Files marked non-sparse are always reported by the ioctl as fully
allocated, regardless of any potential "strict allocate = no" savings.
-------------------------------------

you have:

+       ndr_ret = ndr_pull_struct_blob(in_input, mem_ctx, &qar_req,
+               (ndr_pull_flags_fn_t)ndr_pull_fsctl_query_alloced_ranges_req);

Can you do wrap checks around the len and offset fields in
the read structure please. For example:

+       /* maximum offset is either the EOF, or the request off + len */
+       max_off = MIN(sbuf.st_ex_size,
+                     qar_req.buf.file_off + qar_req.buf.len) - 1;

I'd like wrap checks for 'qar_req.buf.file_off + qar_req.buf.len'
and any other arithmetic done on client-supplied values.

Also can you add an explaination for the -1 in the comment here please ?

This is amazingly good work David - congratulations and thanks !

Jeremy.


More information about the samba-technical mailing list