msync - can someone shed some light please?

Richard Kettlewell rjk at terraraq.uk
Mon Jun 16 16:30:00 UTC 2025


On 15/06/2025 07:00, Julien ÉLIE wrote:
> Oh, thanks for having had a look and the patch proposal.  (Thanks, Bo, 
> too for the confirmation.)
> 
> This function is also widely used by tradindexed, as well as some 
> history writes when nfswriter is set to true in inn.conf.  So your patch 
> will also fix latent bugs for these cases too.
> 
> Looking at the whole source code, there's also cnfs_mapcntl, a slight 
> variant of the above function in storage/cnfs/cnfs.c, which saves msync 
> calls when the pages are the same as the previous ones.
>      start = (char *) ((uintptr_t) p & ~(size_t) (pagesize - 1));
>      end = (char *) (((uintptr_t) p + length + pagesize)
>                      & ~(size_t) (pagesize - 1));
> 
> end should then be fixed to use (p + length + pagesize - 1), following 
> your patch proposal.

Perhaps the repeated logic should be put into a single library function 
(and unit-tested)?

ttfn/rjk



More information about the inn-workers mailing list