All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Nick Bowler <nbowler@draconx.ca>
Cc: Dave Chinner <david@fromorbit.com>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	linux-xfs@vger.kernel.org
Subject: Re: Enlarging w/ xfs_growfs: XFS_IOC_FSGROWFSDATA xfsctl failed: Inappropriate ioctl for device
Date: Wed, 12 Dec 2018 08:09:22 -0500	[thread overview]
Message-ID: <20181212130922.GA23261@bfoster> (raw)
In-Reply-To: <CADyTPEw6DfRO_=RbmaQC2f-2QGNtXKjcmtpcuX9VaNnRXQkH6Q@mail.gmail.com>

On Tue, Dec 11, 2018 at 03:20:23PM -0500, Nick Bowler wrote:
> On 12/11/18, Nick Bowler <nbowler@draconx.ca> wrote:
> > On 12/11/18, Brian Foster <bfoster@redhat.com> wrote:
> >> Given that the structure size essentially changes the command value, I'm
> >> kind of curious why we have this ifdeffery in the first place. That
> >> aside, the patch seems reasonable to me at a glance (though some brief
> >> comments around the ifdefs would be nice).
> [...]
> > Current code has the ifdeffery.  Also since it's a syntax error to have
> > multiple case labels with the same value it'd be essential to validate
> > that all supported architectures architectures end up with different
> > values for each XFS_IOC_xyz and the corresponding XFS_IOC_xyz_32.
> 
> Right after I write this, I realize that it's almost certainly
> the case that architectures which _don't_ define BROKEN_X86_ALIGNMENT
> will have matching ioctl numbers between e.g., XFS_IOC_ALLOCSP and
> XFS_IOC_ALLOCSP_32.  Thus the ifdeffery is essential for the above
> syntactic reason.
> 

So the two struct [compat_]xfs_flock64 variants are essentially the same
with the exception of internal alignment padding that leaves a hole
after the first 4 bytes in the 64-bit variant. So on x86_64, these are
essentially two different (sized) structures and ioctl commands. On some
non-broken alignment arch, the packing may be implied and thus these
definitions evaluate down to the same ioctl command. If so, then having
those separate but equivalent value commands in the same switch
statement results in a compilation error. Am I following that correctly?

If so, then it does seem we need an ifdef to exlude those definitions so
long as we follow the one huge switch statement implementation. But is
there anything that fundamentally prevents a multiple switch statement
implementation to avoid such syntax errors?

Note that in the end I don't care too much about whether we have an
ifdef or not. I'm more interested in the most simple and elegant
implementation and it just seemed that trying to dilute the existing
ifdef may push us in the opposite direction (as opposed to something
that for example called into the "native" ioctl and fell back to the _32
variants on failure before returning an error). There may be technical
complications to that or using some form of the ifdef may just end up
being the more simple approach after all.

Brian

> Cheers,
>   Nick

  reply	other threads:[~2018-12-12 13:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10  4:29 Enlarging w/ xfs_growfs: XFS_IOC_FSGROWFSDATA xfsctl failed: Inappropriate ioctl for device Nick Bowler
2018-12-10 14:33 ` Brian Foster
2018-12-10 15:39   ` Nick Bowler
2018-12-10 16:11     ` Brian Foster
2018-12-10 16:50       ` Darrick J. Wong
2018-12-10 16:55         ` Darrick J. Wong
2018-12-10 17:46         ` Brian Foster
2018-12-10 20:54           ` Nick Bowler
2018-12-10 21:41             ` Dave Chinner
2018-12-11  7:04               ` Nick Bowler
2018-12-11 12:27                 ` Brian Foster
2018-12-11 20:13                   ` Nick Bowler
2018-12-11 20:20                     ` Nick Bowler
2018-12-12 13:09                       ` Brian Foster [this message]
2018-12-13  0:21                         ` Nick Bowler
2018-12-12  4:56                   ` Nick Bowler
2018-12-13  3:53                     ` Dave Chinner
2018-12-13  4:14                       ` Nick Bowler
2018-12-13  4:49                         ` Nick Bowler
2018-12-13 21:39                           ` Dave Chinner
2018-12-13 21:53                             ` Nick Bowler
2018-12-14  1:43                               ` Dave Chinner
2018-12-14  3:35                             ` Nick Bowler
2018-12-14  3:40                               ` [RFC PATCH xfstests] xfs: add tests to validate ioctl structure layout Nick Bowler
2019-01-15 15:55                                 ` Luis Chamberlain
2018-12-13 16:30                       ` Enlarging w/ xfs_growfs: XFS_IOC_FSGROWFSDATA xfsctl failed: Inappropriate ioctl for device Darrick J. Wong

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=20181212130922.GA23261@bfoster \
    --to=bfoster@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=nbowler@draconx.ca \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.