From: Holger Fischer <hoo.mb@web.de>
To: linux-btrfs@vger.kernel.org
Subject: btrfs-tools: debian/patches/08-fsck.patch
Date: Mon, 20 May 2013 17:00:28 +0200 [thread overview]
Message-ID: <519A3A8C.7010500@web.de> (raw)
Dear BTRFS-Community,
this patch is a reworked one of the debian-original to address the latest changes in the btrfs-tools source code.
It fixes problems that can occur when you boot a machine with btrfs root filesystem.
Boot can stop, because fsck of the btrfs-root-filesystem fails.
Here the patch:
>cat 08-fsck.patch
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -3549,6 +3549,12 @@ const char * const cmd_check_usage[] = {
NULL
};
+static void cmd_check_info(void)
+{
+ fprintf(stderr, "%s\n", BTRFS_BUILD_VERSION);
+ exit(0);
+}
+
int cmd_check(int argc, char **argv)
{
struct cache_tree root_cache;
@@ -3566,12 +3572,11 @@ int cmd_check(int argc, char **argv)
while(1) {
int c;
- c = getopt_long(argc, argv, "as:", long_options,
+ c = getopt_long(argc, argv, "as:nry", long_options,
&option_index);
if (c < 0)
break;
switch(c) {
- case 'a': /* ignored */ break;
case 's':
num = atol(optarg);
bytenr = btrfs_sb_offset(num);
@@ -3581,6 +3586,13 @@ int cmd_check(int argc, char **argv)
case '?':
case 'h':
usage(cmd_check_usage);
+ break;
+ case 'a':
+ case 'n':
+ case 'r':
+ case 'y':
+ cmd_check_info();
+
}
if (option_index == 1) {
printf("enabling repair mode\n");
--- a/btrfs.c
+++ b/btrfs.c
@@ -270,7 +270,8 @@ int main(int argc, char **argv)
else
bname = argv[0];
- if (!strcmp(bname, "btrfsck")) {
+ if (!strcmp(bname, "btrfsck") ||
+ !strcmp(bname, "fsck.btrfs")) {
argv[0] = "check";
} else {
argc--;
It addresses 2 issues:
- fsck.btrfs is not working anymore:
to make it work again:
- fsck.btrfs must be a (sym)link to btrfs (should be fixed in the Makefile which I did not do)
- when calling $BINPATH/fsck.btrfs the main-function in btrfs.c must add the option "check" as 1st argument
or described in a 2nd way: do "btrfs check" when basename of executable is fsck.btrfs
this is equal to the behaviour of btrfsck
the changes to btrfs.c resolve this issue
- "fsck -a <btrfsroot> (done during boot of at least ubuntu 12.04 with standard settings)
does not return 0
-> boot fails:
to make it work the debian maintainers decided to create a patch which
- prints an info (btrfs version) and return 0 when
fsck.btrfs is called with one of the options
"-a", "-n", "-r" or "-y"
I rewrote the original patch to make this work again with newer versions of btrfs-tools
Somebody upstream already cared about including "-a", so it seems somebody already tried to address this issue.
I would be happy to see these patches (or the thoughts behind, if you don't like how it's made) included upstream.
Best Regards
Holger Fischer
reply other threads:[~2013-05-20 15:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=519A3A8C.7010500@web.de \
--to=hoo.mb@web.de \
--cc=linux-btrfs@vger.kernel.org \
/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.