svn commit: r358655 - head/sbin/mount_nfs

Slawa Olhovchenkov slw at zxy.spb.ru
Thu Mar 5 17:35:19 UTC 2020


On Thu, Mar 05, 2020 at 08:24:54PM +0300, Slawa Olhovchenkov wrote:

> On Thu, Mar 05, 2020 at 08:33:50AM -0800, Gleb Smirnoff wrote:
> 
> > On Thu, Mar 05, 2020 at 03:29:23PM +0100, Dimitry Andric wrote:
> > D> On 2020-03-04 23:27, Gleb Smirnoff wrote:
> > D> > Author: glebius
> > D> > Date: Wed Mar  4 22:27:16 2020
> > D> > New Revision: 358655
> > D> > URL: https://svnweb.freebsd.org/changeset/base/358655
> > D> > 
> > D> > Log:
> > D> >    When a machine boots the NFS mounting script is executed after
> > D> >    interfaces are configured, but for many interfaces (e.g. all Intel)
> > D> >    ifconfig causes link renegotiation, so the first attempt to mount
> > D> >    NFS always fails. After that mount_nfs sleeps for 30 seconds, while
> > D> >    only a couple seconds are actually required for interface to get up.
> > D> >    Instead of sleeping, do select(2) on routing socket and check if
> > D> >    some interface became UP and in this case retry immediately.
> > D> 
> > D> At least on i386, this causes a -Werror warning:
> > D> 
> > D> sbin/mount_nfs/mount_nfs.c:549:10: error: cast from 'char *' to 'struct
> > D> if_msghdr *' increases required alignment from 1 to 4
> > D> [-Werror,-Wcast-align]
> > D>                         ifm = (struct if_msghdr *)buf;
> > D>                               ^~~~~~~~~~~~~~~~~~~~~~~
> > D> 1 error generated.
> > D> 
> > D> In practice I don't think the buffer can ever get misaligned, so can you
> > D> please add a NO_WCAST_ALIGN= to the Makefile?
> > 
> > route(8) handles the same problem via intermediate (void *) cast. What is
> > preferred way to solve the problem? Change compiler flags file wide, or
> > just through (void *) cast?
> 
> Copy to aligned buffer or got SIGBUS on some architectures?

char buf[2048] __aligned(__alignof(struct if_msghdr));

resolve this watning.


More information about the svn-src-head mailing list