* [PATCH 1/4] Properly cast to avoid compiler warnings, fixes FTBFS on alpha and ia64.
@ 2014-09-21 1:01 Dimitri John Ledkov
2014-09-21 1:01 ` [PATCH 2/4] Fixes FTBFS with --no-add-needed Dimitri John Ledkov
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Dimitri John Ledkov @ 2014-09-21 1:01 UTC (permalink / raw)
To: linux-btrfs; +Cc: Dimitri John Ledkov
Bug-Debian: http://bugs.debian.org/539433
Bug-Debian: http://bugs.debian.org/583768
Authors:
Luca Bruno <lucab@debian.org>
Alexander Kurtz <kurtz.alex@googlemail.com>
Daniel Baumann <daniel.baumann@progress-technologies.net>
Signed-off-by: Dimitri John Ledkov <xnox@debian.org>
---
btrfs-convert.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/btrfs-convert.c b/btrfs-convert.c
index 71b7bd6..3673050 100644
--- a/btrfs-convert.c
+++ b/btrfs-convert.c
@@ -2441,7 +2441,7 @@ static int do_rollback(const char *devname)
ext2_root = btrfs_read_fs_root(root->fs_info, &key);
if (!ext2_root || IS_ERR(ext2_root)) {
fprintf(stderr, "unable to open subvol %llu\n",
- key.objectid);
+ (unsigned long long) key.objectid);
goto fail;
}
--
2.1.0.rc1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/4] Fixes FTBFS with --no-add-needed.
2014-09-21 1:01 [PATCH 1/4] Properly cast to avoid compiler warnings, fixes FTBFS on alpha and ia64 Dimitri John Ledkov
@ 2014-09-21 1:01 ` Dimitri John Ledkov
2014-09-22 12:23 ` David Sterba
2014-09-21 1:01 ` [PATCH 3/4] Fixing unaligned memory accesses Dimitri John Ledkov
2014-09-21 1:01 ` [PATCH 4/4] Default to acting like fsck Dimitri John Ledkov
2 siblings, 1 reply; 9+ messages in thread
From: Dimitri John Ledkov @ 2014-09-21 1:01 UTC (permalink / raw)
To: linux-btrfs; +Cc: Luk Claes, Dimitri John Ledkov
From: Luk Claes <luk@debian.org>
Bug-Debian: http://bugs.debian.org/554059
Signed-off-by: Dimitri John Ledkov <xnox@debian.org>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index e721e99..441e925 100644
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,7 @@ TESTS = fsck-tests.sh convert-tests.sh
INSTALL = install
prefix ?= /usr/local
bindir = $(prefix)/bin
-lib_LIBS = -luuid -lblkid -lm -lz -llzo2 -L.
+lib_LIBS = -luuid -lblkid -lm -lz -llzo2 -lcom_err -L.
libdir ?= $(prefix)/lib
incdir = $(prefix)/include/btrfs
LIBS = $(lib_LIBS) $(libs_static)
--
2.1.0.rc1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/4] Fixing unaligned memory accesses.
2014-09-21 1:01 [PATCH 1/4] Properly cast to avoid compiler warnings, fixes FTBFS on alpha and ia64 Dimitri John Ledkov
2014-09-21 1:01 ` [PATCH 2/4] Fixes FTBFS with --no-add-needed Dimitri John Ledkov
@ 2014-09-21 1:01 ` Dimitri John Ledkov
2014-09-22 13:03 ` David Sterba
2014-09-21 1:01 ` [PATCH 4/4] Default to acting like fsck Dimitri John Ledkov
2 siblings, 1 reply; 9+ messages in thread
From: Dimitri John Ledkov @ 2014-09-21 1:01 UTC (permalink / raw)
To: linux-btrfs; +Cc: Shawn Landen, Dimitri John Ledkov
From: Shawn Landen <shawnlandden@gmail.com>
Bug-Debian: http://bugs.debian.org/656955
Signed-off-by: Dimitri John Ledkov <xnox@debian.org>
---
ctree.h | 18 ++++++++++++++----
volumes.c | 5 +++--
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/ctree.h b/ctree.h
index fa73c4a..92c6ad3 100644
--- a/ctree.h
+++ b/ctree.h
@@ -19,6 +19,8 @@
#ifndef __BTRFS__
#define __BTRFS__
+#include <stdint.h>
+
#if BTRFS_FLAT_INCLUDES
#include "list.h"
#include "kerncompat.h"
@@ -1191,13 +1193,17 @@ struct btrfs_root {
static inline u##bits btrfs_##name(const struct extent_buffer *eb) \
{ \
const struct btrfs_header *h = (struct btrfs_header *)eb->data; \
- return le##bits##_to_cpu(h->member); \
+ uint##bits##_t t; \
+ memcpy(&t, &h->member, sizeof(h->member)); \
+ return le##bits##_to_cpu(t); \
} \
static inline void btrfs_set_##name(struct extent_buffer *eb, \
u##bits val) \
{ \
struct btrfs_header *h = (struct btrfs_header *)eb->data; \
- h->member = cpu_to_le##bits(val); \
+ uint##bits##_t t; \
+ t = cpu_to_le##bits(val); \
+ memcpy(&h->member, &t, sizeof(h->member)); \
}
#define BTRFS_SETGET_FUNCS(name, type, member, bits) \
@@ -1219,11 +1225,15 @@ static inline void btrfs_set_##name(struct extent_buffer *eb, \
#define BTRFS_SETGET_STACK_FUNCS(name, type, member, bits) \
static inline u##bits btrfs_##name(const type *s) \
{ \
- return le##bits##_to_cpu(s->member); \
+ uint##bits##_t t; \
+ memcpy(&t, &s->member, sizeof(s->member)); \
+ return le##bits##_to_cpu(t); \
} \
static inline void btrfs_set_##name(type *s, u##bits val) \
{ \
- s->member = cpu_to_le##bits(val); \
+ uint##bits##_t t; \
+ t = cpu_to_le##bits(val); \
+ memcpy(&s->member, &t, sizeof(s->member)); \
}
BTRFS_SETGET_FUNCS(device_type, struct btrfs_dev_item, type, 64);
diff --git a/volumes.c b/volumes.c
index 388c94e..102380b 100644
--- a/volumes.c
+++ b/volumes.c
@@ -472,10 +472,11 @@ static int find_next_chunk(struct btrfs_root *root, u64 objectid, u64 *offset)
if (found_key.objectid != objectid)
*offset = 0;
else {
+ u64 t;
chunk = btrfs_item_ptr(path->nodes[0], path->slots[0],
struct btrfs_chunk);
- *offset = found_key.offset +
- btrfs_chunk_length(path->nodes[0], chunk);
+ t = found_key.offset + btrfs_chunk_length(path->nodes[0], chunk);
+ memcpy(offset, &t, sizeof(found_key.offset));
}
}
ret = 0;
--
2.1.0.rc1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/4] Default to acting like fsck.
2014-09-21 1:01 [PATCH 1/4] Properly cast to avoid compiler warnings, fixes FTBFS on alpha and ia64 Dimitri John Ledkov
2014-09-21 1:01 ` [PATCH 2/4] Fixes FTBFS with --no-add-needed Dimitri John Ledkov
2014-09-21 1:01 ` [PATCH 3/4] Fixing unaligned memory accesses Dimitri John Ledkov
@ 2014-09-21 1:01 ` Dimitri John Ledkov
2014-09-21 12:59 ` Tobias Geerinckx-Rice
2 siblings, 1 reply; 9+ messages in thread
From: Dimitri John Ledkov @ 2014-09-21 1:01 UTC (permalink / raw)
To: linux-btrfs; +Cc: Dimitri John Ledkov
Inspect arguments, if we are not called as btrfs, then assume we are
called to act like fsck.
Bug-Debian: http://bugs.debian.org/712078
Signed-off-by: Dimitri John Ledkov <xnox@debian.org>
---
btrfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/btrfs.c b/btrfs.c
index e83349c..e8a87ac 100644
--- a/btrfs.c
+++ b/btrfs.c
@@ -222,7 +222,7 @@ int main(int argc, char **argv)
else
bname = argv[0];
- if (!strcmp(bname, "btrfsck")) {
+ if (strcmp(bname, "btrfs") != 0) {
argv[0] = "check";
} else {
argc--;
--
2.1.0.rc1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 4/4] Default to acting like fsck.
2014-09-21 1:01 ` [PATCH 4/4] Default to acting like fsck Dimitri John Ledkov
@ 2014-09-21 12:59 ` Tobias Geerinckx-Rice
2014-09-22 8:58 ` Dimitri John Ledkov
0 siblings, 1 reply; 9+ messages in thread
From: Tobias Geerinckx-Rice @ 2014-09-21 12:59 UTC (permalink / raw)
To: Dimitri John Ledkov; +Cc: linux-btrfs
On 21 September 2014 03:01, Dimitri John Ledkov <xnox@debian.org> wrote:
>
> Inspect arguments, if we are not called as btrfs, then assume we are
> called to act like fsck.
[...]
> - if (!strcmp(bname, "btrfsck")) {
> + if (strcmp(bname, "btrfs") != 0) {
That's assuming a lot.
Silently (!) breaking people's btrfs-3.15_patched-DontRandomlyPanicV2
is a recipe for needless hair-pulling. Is there a reason for not using
something less like strstr(bname, "fsck") that I am missing?
Regards,
T G-R
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/4] Default to acting like fsck.
2014-09-21 12:59 ` Tobias Geerinckx-Rice
@ 2014-09-22 8:58 ` Dimitri John Ledkov
2014-09-22 13:13 ` David Sterba
0 siblings, 1 reply; 9+ messages in thread
From: Dimitri John Ledkov @ 2014-09-22 8:58 UTC (permalink / raw)
To: Tobias Geerinckx-Rice; +Cc: linux-btrfs
On 21 September 2014 13:59, Tobias Geerinckx-Rice
<tobias.geerinckx.rice@gmail.com> wrote:
> On 21 September 2014 03:01, Dimitri John Ledkov <xnox@debian.org> wrote:
>>
>> Inspect arguments, if we are not called as btrfs, then assume we are
>> called to act like fsck.
> [...]
>> - if (!strcmp(bname, "btrfsck")) {
>> + if (strcmp(bname, "btrfs") != 0) {
>
> That's assuming a lot.
>
> Silently (!) breaking people's btrfs-3.15_patched-DontRandomlyPanicV2
> is a recipe for needless hair-pulling. Is there a reason for not using
> something less like strstr(bname, "fsck") that I am missing?
>
Quite. This is verbatim patch as I have currently applied in Debian
packaging, and it was a fast fix to prevent breakage we had at one
point.
Indeed using "strstr(bname, "fsck")" would be better and sufficient to
resolve the problem we encountered (specifically fsck.btrfs -> btrfs
not acting like btrfs). Also using strstr, would fix btrfsck.my-build
to act like fsck tool.
I'll update this one patch.
--
Regards,
Dimitri.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/4] Fixes FTBFS with --no-add-needed.
2014-09-21 1:01 ` [PATCH 2/4] Fixes FTBFS with --no-add-needed Dimitri John Ledkov
@ 2014-09-22 12:23 ` David Sterba
0 siblings, 0 replies; 9+ messages in thread
From: David Sterba @ 2014-09-22 12:23 UTC (permalink / raw)
To: Dimitri John Ledkov; +Cc: linux-btrfs, Luk Claes
On Sun, Sep 21, 2014 at 02:01:20AM +0100, Dimitri John Ledkov wrote:
> --- a/Makefile
> +++ b/Makefile
> @@ -26,7 +26,7 @@ TESTS = fsck-tests.sh convert-tests.sh
> INSTALL = install
> prefix ?= /usr/local
> bindir = $(prefix)/bin
> -lib_LIBS = -luuid -lblkid -lm -lz -llzo2 -L.
> +lib_LIBS = -luuid -lblkid -lm -lz -llzo2 -lcom_err -L.
This will add the com_err library to all binaries, while it's actually
used only by the btrfs-convert utility and this dependency has been
properly added in ef85e7e285daf (released in 3.12).
One can add a per-target libraries like
btrfs_convert_libs = -lext2fs -lcom_err
Also please be more descriptive what the actual error is in the
changelog itself so I don't have to look it up in the referenced bug.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/4] Fixing unaligned memory accesses.
2014-09-21 1:01 ` [PATCH 3/4] Fixing unaligned memory accesses Dimitri John Ledkov
@ 2014-09-22 13:03 ` David Sterba
0 siblings, 0 replies; 9+ messages in thread
From: David Sterba @ 2014-09-22 13:03 UTC (permalink / raw)
To: Dimitri John Ledkov; +Cc: linux-btrfs, Shawn Landen
On Sun, Sep 21, 2014 at 02:01:21AM +0100, Dimitri John Ledkov wrote:
> From: Shawn Landen <shawnlandden@gmail.com>
>
> Bug-Debian: http://bugs.debian.org/656955
The bug seems old (2012) and agains 0.19. We've fixed a few unaligned
access bugs in the meantime. Can you please retest with 3.16?
> --- a/ctree.h
> +++ b/ctree.h
> @@ -19,6 +19,8 @@
> #ifndef __BTRFS__
> #define __BTRFS__
>
> +#include <stdint.h>
> +
> #if BTRFS_FLAT_INCLUDES
> #include "list.h"
> #include "kerncompat.h"
> @@ -1191,13 +1193,17 @@ struct btrfs_root {
> static inline u##bits btrfs_##name(const struct extent_buffer *eb) \
> { \
> const struct btrfs_header *h = (struct btrfs_header *)eb->data; \
> - return le##bits##_to_cpu(h->member); \
> + uint##bits##_t t; \
> + memcpy(&t, &h->member, sizeof(h->member)); \
> + return le##bits##_to_cpu(t); \
The change to memcpy is safe, the compiler is smart enough to not emit
any memcpy call for x86_64 and there's no change to the leXX_to_cpu
macros.
However, I'd like to check first if this is really necessary due to the
old version in the bugreport. I'd prefer using the u8/.../u64 types
instead of the stdint.h ones, for sake of consistency with the rest of
the codebase.
> --- a/volumes.c
> +++ b/volumes.c
> @@ -472,10 +472,11 @@ static int find_next_chunk(struct btrfs_root *root, u64 objectid, u64 *offset)
> if (found_key.objectid != objectid)
> *offset = 0;
> else {
> + u64 t;
> chunk = btrfs_item_ptr(path->nodes[0], path->slots[0],
> struct btrfs_chunk);
> - *offset = found_key.offset +
> - btrfs_chunk_length(path->nodes[0], chunk);
> + t = found_key.offset + btrfs_chunk_length(path->nodes[0], chunk);
> + memcpy(offset, &t, sizeof(found_key.offset));
That's not enough, there are more direct assignments to *offset in that
function. The preferred way is to add 'put_unaligned' helper into
kerncompat.h and use it.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/4] Default to acting like fsck.
2014-09-22 8:58 ` Dimitri John Ledkov
@ 2014-09-22 13:13 ` David Sterba
0 siblings, 0 replies; 9+ messages in thread
From: David Sterba @ 2014-09-22 13:13 UTC (permalink / raw)
To: Dimitri John Ledkov; +Cc: Tobias Geerinckx-Rice, linux-btrfs
On Mon, Sep 22, 2014 at 09:58:34AM +0100, Dimitri John Ledkov wrote:
> On 21 September 2014 13:59, Tobias Geerinckx-Rice
> <tobias.geerinckx.rice@gmail.com> wrote:
> > On 21 September 2014 03:01, Dimitri John Ledkov <xnox@debian.org> wrote:
> >>
> >> Inspect arguments, if we are not called as btrfs, then assume we are
> >> called to act like fsck.
> > [...]
> >> - if (!strcmp(bname, "btrfsck")) {
> >> + if (strcmp(bname, "btrfs") != 0) {
> >
> > That's assuming a lot.
> >
> > Silently (!) breaking people's btrfs-3.15_patched-DontRandomlyPanicV2
> > is a recipe for needless hair-pulling. Is there a reason for not using
> > something less like strstr(bname, "fsck") that I am missing?
> >
>
> Quite. This is verbatim patch as I have currently applied in Debian
> packaging, and it was a fast fix to prevent breakage we had at one
> point.
>
> Indeed using "strstr(bname, "fsck")" would be better and sufficient to
> resolve the problem we encountered (specifically fsck.btrfs -> btrfs
> not acting like btrfs). Also using strstr, would fix btrfsck.my-build
> to act like fsck tool.
The intention was to provide backward compatibility shortcut for
'btrfsck' -> 'btrfs check' and nothing else. The referenced bug is again
for 0.19 but there's an upstream-shipped stub fsck.btrfs (since 3.14)
that should avoid any packaging tricks.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-09-22 13:13 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-21 1:01 [PATCH 1/4] Properly cast to avoid compiler warnings, fixes FTBFS on alpha and ia64 Dimitri John Ledkov
2014-09-21 1:01 ` [PATCH 2/4] Fixes FTBFS with --no-add-needed Dimitri John Ledkov
2014-09-22 12:23 ` David Sterba
2014-09-21 1:01 ` [PATCH 3/4] Fixing unaligned memory accesses Dimitri John Ledkov
2014-09-22 13:03 ` David Sterba
2014-09-21 1:01 ` [PATCH 4/4] Default to acting like fsck Dimitri John Ledkov
2014-09-21 12:59 ` Tobias Geerinckx-Rice
2014-09-22 8:58 ` Dimitri John Ledkov
2014-09-22 13:13 ` David Sterba
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).