From: Dave Chinner <david@fromorbit.com>
To: Mark Tinguely <tinguely@sgi.com>
Cc: Brian Foster <bfoster@redhat.com>, xfs@oss.sgi.com
Subject: Re: [PATCH v5 00/10] speculative preallocation inode tracking
Date: Mon, 22 Oct 2012 09:28:32 +1100 [thread overview]
Message-ID: <20121021222832.GZ2739@dastard> (raw)
In-Reply-To: <5084368F.3000204@sgi.com>
On Sun, Oct 21, 2012 at 12:53:19PM -0500, Mark Tinguely wrote:
> On 10/21/12 09:00, Brian Foster wrote:
> >On 10/19/2012 05:02 PM, Mark Tinguely wrote:
> >>I am just curious, what is the reason for the padding in the
> >>xfs_eofblocks structure?
> >>
> >
> >I added the padding in response to review on an early revision of the set:
> >
> >http://oss.sgi.com/archives/xfs/2012-09/msg00024.html
> >
> >The purpose is to allow adding fields to the control structure down the
> >road without breaking existing binaries.
>
> Thank-you for the information.
>
> I would think that changing the number of arguments would also
> involving changing the version number.
Yes, it usually does.
> The kernel should know
> that version 1 copies in 16 bytes, version 2 copies in 16+t bytes,
> version n copies in 16+n bytes...
Gets messy, pretty quickly. Versioning and padding user facing
structures makes life a lot easy when it comes to extending
interfaces. 15-20 years of support for an ioctl is a long time, and
that's the sort of time frame we need to think about. How to make it
easy to maintain and extend over a long period of time. We should
always version and pad user facing ioctl structures for this reason.
Further, assuming that userspace knows exactly the right size for a
given feature is problematic. If there's only one structure type
for userspace to use, then it's likely they'll get it right. If
there's a different structure for every version of the ioctl, then
it's likely they'll get it wrong.
And we get validation wrong in the kernel, too. The kernel must
validate the size of the structure as being correct given the
version number, and that gets hard to validate and easy to get wrong
when you have a different structure for every version that exists.
See, for example, struct xfs_fsop_geom_t, and XFS_IOC_FSGEOMETRY_V1/
XFS_IOC_FSGEOMETRY. The originaly was an unversioned structure with
no padding, and when the V2 log format came along, the structure had
to be extended and a new ioctl added to support it. Internally they
both used the same struture, but the copy-in/out were different and
initialisation was different. The result was leaking unitialised
data to userspace because we didn't get it right. (c4d0c3b "xfs:
prevent leaking uninitialized stack memory in FSGEOMETRY_V1")
At least the new xfs_fsops_geom structure has a version number in it
so we don't have to add a new ioctl to extend it further. However,
it still doesn't have any padding so any further extensions will
have to be very careful to avoid structure size mismatches. This
could have been avoided is some padding was added as the time the
version number was added....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2012-10-21 22:26 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-05 14:17 [PATCH v5 00/10] speculative preallocation inode tracking Brian Foster
2012-10-05 14:17 ` [PATCH v5 01/10] xfs: add EOFBLOCKS inode tagging/untagging Brian Foster
2012-10-05 14:17 ` [PATCH v5 02/10] xfs: support a tag-based inode_ag_iterator Brian Foster
2012-10-05 14:17 ` [PATCH v5 03/10] xfs: create helper to check whether to free eofblocks on inode Brian Foster
2012-10-23 0:58 ` Dave Chinner
2012-10-05 14:17 ` [PATCH v5 04/10] xfs: make xfs_free_eofblocks() non-static, return EAGAIN on trylock failure Brian Foster
2012-10-05 14:17 ` [PATCH v5 05/10] xfs: create function to scan and clear EOFBLOCKS inodes Brian Foster
2012-10-23 1:01 ` Dave Chinner
2012-10-05 14:17 ` [PATCH v5 06/10] xfs: add XFS_IOC_FREE_EOFBLOCKS ioctl Brian Foster
2012-10-11 14:13 ` Ben Myers
2012-10-11 22:35 ` Brian Foster
2012-10-15 22:46 ` Ben Myers
2012-10-15 23:49 ` Dave Chinner
2012-10-16 1:39 ` Dave Chinner
2012-10-17 22:40 ` Ben Myers
2012-10-18 12:16 ` Brian Foster
2012-10-18 15:46 ` Ben Myers
2012-10-18 16:23 ` Brian Foster
2012-10-22 7:34 ` Dave Chinner
2012-10-22 13:23 ` Brian Foster
2012-10-22 22:22 ` Dave Chinner
2012-10-23 1:31 ` Dave Chinner
2012-10-24 16:16 ` Brian Foster
2012-10-24 19:27 ` Dave Chinner
2012-10-05 14:17 ` [PATCH v5 07/10] xfs: make xfs_quota_type() non-static Brian Foster
2012-10-23 1:31 ` Dave Chinner
2012-10-05 14:17 ` [PATCH v5 08/10] xfs: add quota id filtering to eofblocks scan Brian Foster
2012-10-23 1:42 ` Dave Chinner
2012-10-24 16:18 ` Brian Foster
2012-10-24 19:41 ` Dave Chinner
2012-10-24 23:02 ` Brian Foster
2012-10-25 0:02 ` Dave Chinner
2012-10-25 0:29 ` Brian Foster
2012-10-05 14:17 ` [PATCH v5 09/10] xfs: add minimum file size " Brian Foster
2012-10-23 1:43 ` Dave Chinner
2012-10-05 14:17 ` [PATCH v5 10/10] xfs: add background scanning to clear eofblocks inodes Brian Foster
2012-10-23 1:55 ` Dave Chinner
2012-10-19 21:02 ` [PATCH v5 00/10] speculative preallocation inode tracking Mark Tinguely
2012-10-21 14:00 ` Brian Foster
2012-10-21 17:53 ` Mark Tinguely
2012-10-21 20:31 ` Mark Tinguely
2012-10-21 22:28 ` Dave Chinner [this message]
2012-10-23 19:10 ` Ben Myers
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=20121021222832.GZ2739@dastard \
--to=david@fromorbit.com \
--cc=bfoster@redhat.com \
--cc=tinguely@sgi.com \
--cc=xfs@oss.sgi.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox