From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] gfs2: Avoid alignment hole in struct lm_lockname
Date: Mon, 6 Mar 2017 15:15:44 +0000 [thread overview]
Message-ID: <3685ca8e-184b-dee6-82d0-3fe6ebd5ddd7@redhat.com> (raw)
In-Reply-To: <1488810836-11427-1-git-send-email-agruenba@redhat.com>
Hi,
On 06/03/17 14:33, Andreas Gruenbacher wrote:
> Commit 88ffbf3e03 switches to using rhashtables for glocks, hashing over
> the entire struct lm_lockname instead of its individual fields. On some
> architectures, struct lm_lockname contains a hole of uninitialized
> memory due to alignment rules, which now leads to incorrect hash values.
> Get rid of that hole.
>
> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
> CC: <stable@vger.kernel.org> #v4.3+
> ---
> fs/gfs2/incore.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
> index c45084a..511e1ed 100644
> --- a/fs/gfs2/incore.h
> +++ b/fs/gfs2/incore.h
> @@ -207,7 +207,7 @@ struct lm_lockname {
> struct gfs2_sbd *ln_sbd;
> u64 ln_number;
> unsigned int ln_type;
> -};
> +} __packed __aligned(sizeof(int));
>
> #define lm_name_equal(name1, name2) \
> (((name1)->ln_number == (name2)->ln_number) && \
I'm still not sure that this is the best solution. Also, either it
should be packed or aligned to a certain size, I'm not sure how it can
be both? Changing the alignment may cause access issues on some arches.
I think it would be better just to initialize the structure to zero when
we allocate a new glock, that will ensure that the padding is always
zeroed, without changing the alignment,
Steve.
next prev parent reply other threads:[~2017-03-06 15:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-06 14:33 [Cluster-devel] [PATCH] gfs2: Avoid alignment hole in struct lm_lockname Andreas Gruenbacher
2017-03-06 15:10 ` Bob Peterson
2017-03-06 15:15 ` Steven Whitehouse [this message]
2017-03-06 16:55 ` Andreas Gruenbacher
2017-03-06 17:43 ` Steven Whitehouse
2017-03-06 18:27 ` Bob Peterson
2017-03-15 11:24 ` Andrew Price
2017-03-15 11:41 ` Andreas Gruenbacher
2017-03-15 14:34 ` Bob Peterson
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=3685ca8e-184b-dee6-82d0-3fe6ebd5ddd7@redhat.com \
--to=swhiteho@redhat.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;
as well as URLs for NNTP newsgroup(s).