mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Kleikamp <shaggy@austin.ibm.com>
To: Florian Huber <florian.huber@mnet-online.de>
Cc: JFS Discussion <jfs-discussion@www-124.southbury.usf.ibm.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [Jfs-discussion] md raid + jfs + jfs_fsck
Date: Tue, 27 Jan 2004 14:43:05 -0600	[thread overview]
Message-ID: <1075236185.21763.89.camel@shaggy.austin.ibm.com> (raw)
In-Reply-To: <1075232395.11203.94.camel@suprafluid>

On Tue, 2004-01-27 at 13:39, Florian Huber wrote:
> On Tue, 2004-01-27 at 20:28, Dave Kleikamp wrote:
> > I wonder if JFS is having trouble getting the partition size.  Can you
> > run jfs_fsck with the -v flag to see what part of the superblock it
> > doesn't like?
> 
> The current device is:  /dev/md2
> Open(...READ/WRITE EXCLUSIVE...) returned rc = 0
> Incorrect jlog length detected in the superblock (P).
> Incorrect jlog length detected in the superblock (S).
> Superblock is corrupt and cannot be repaired 
> since both primary and secondary copies are corrupt.  

My guess is that software raid is stealing a few blocks from the end of
the partition, and JFS doesn't like that, since it's journal goes all
the way to the end.  I've created a patch that will shorten the journal
if it can safely be done.  It was built against the latest jfsutils cvs
tree, but applies to version 1.1.4:
http://www10.software.ibm.com/developer/opensource/jfs/project/pub/jfsutils-1.1.4.tar.gz

Please let me know if this fixes it.  (lkml: Yeah, I know the code is
indented too far.  It's outside the kernel, so give me a break.)

Index: jfsutils/fsck/fsckmeta.c
===================================================================
RCS file: /usr/cvs/jfs/jfsutils/fsck/fsckmeta.c,v
retrieving revision 1.18
diff -u -p -r1.18 fsckmeta.c
--- jfsutils/fsck/fsckmeta.c	17 Dec 2003 20:28:47 -0000	1.18
+++ jfsutils/fsck/fsckmeta.c	27 Jan 2004 20:27:56 -0000
@@ -2124,9 +2124,34 @@ int validate_super(int which_super)
 				}
 				agg_blks_in_aggreg += jlog_length_from_pxd;
 				if (agg_blks_in_aggreg > agg_blks_on_device) {
+					int64_t short_blocks;
+					uint32_t new_jlog_size;
 					/* log length is bad */
 					vs_rc = FSCK_BADSBFJLL;
-					fsck_send_msg(fsck_BADSBFJLL, fsck_ref_msg(which_super));
+					/* Let's try to fix it.  :^) */
+					short_blocks = agg_blks_in_aggreg -
+						agg_blks_on_device;
+					new_jlog_size = (jlog_length_from_pxd -
+							 short_blocks) *
+						sb_ptr->s_bsize;
+					/* logform likes multiples of 16K */
+					new_jlog_size &= 0xfffffC000;
+					/* Don't let it go below 1/2 MB */
+					if (new_jlog_size > (1 << 19)) {
+						printf("The volume seems to have shrunk by %Ld blocks.\n"
+						       "Will attempt to fix.\n",
+						       short_blocks);
+						jlog_length_from_pxd = 
+							new_jlog_size /
+							sb_ptr->s_bsize;
+						PXDlength(&(sb_ptr->s_logpxd),
+							  jlog_length_from_pxd);
+						vs_rc = ujfs_put_superblk(
+							 Dev_IOPort, sb_ptr, 1);
+					}
+					if (vs_rc)
+						fsck_send_msg(fsck_BADSBFJLL,
+							      fsck_ref_msg(which_super));
 				}
 			}
 		}

-- 
David Kleikamp
IBM Linux Technology Center


  parent reply	other threads:[~2004-01-27 20:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-27 19:15 Florian Huber
2004-01-27 19:28 ` [Jfs-discussion] " Dave Kleikamp
2004-01-27 19:39   ` Florian Huber
2004-01-27 19:52     ` Florian Huber
2004-01-27 20:43     ` Dave Kleikamp [this message]
2004-01-27 20:53       ` Christoph Hellwig
2004-01-27 21:19         ` Florian Huber
2004-01-27 21:22           ` Christoph Hellwig
2004-01-27 23:39             ` Neil Brown
2004-01-27 21:47         ` Gene Heskett
2004-01-28  2:47         ` Theodore Ts'o
2004-01-28  9:24         ` venom
2004-01-28  9:38           ` Christoph Hellwig
2004-01-28 16:29             ` venom
2004-01-28 10:54           ` Jakob Oestergaard
2004-01-29 22:52           ` Helge Hafting

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=1075236185.21763.89.camel@shaggy.austin.ibm.com \
    --to=shaggy@austin.ibm.com \
    --cc=florian.huber@mnet-online.de \
    --cc=jfs-discussion@www-124.southbury.usf.ibm.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®