Reiserfs: how to mount without journal replay?
Hi!
For recovering broken machine, I'd like to mount without replaying journal. [reiserfs panics while replaying journal; seems there are still some bugs hidden in there]. Unfortunately, "nolog" option does not seem imlemented. Are there experimental to do that?
Pavel
PS: Please CC me.
Signature · 2 lines
Philips Velo 1: 1"x4"x8", 300gram, 60, 12MB, 40bogomips, linux, mutt, details at http://atrey.karlin.mff.cuni.cz/~pavel/velo/index.html.
Quoted 3 lines · Pavel Machek
Hi!
For recovering broken machine, I'd like to mount without replaying journal.
You cannot mount without replaying even in read-only mode, because file-system meta-data are possibly inconsistent.
Quoted 2 lines
[reiserfs panics while replaying journal; seems there are still some bugs hidden in there]. Unfortunately, "nolog" option does not seem imlemented.
There is a patch allowing to mount reiserfs if there was io error during journal replay on mount. It is included into 2.4.9-ac* tree (it was sent to Linus several times, but this did not avail).
Can you send to Reiserfs mail-list <[email protected]> more detailed information about your case, like ksymoopsed stack trace, etc.
Quoted 3 lines
Are there experimental to do that?
Pavel
PS: Please CC me.
Nikita.
Quoted 9 lines
Signature · 8 lines
Philips Velo 1: 1"x4"x8", 300gram, 60, 12MB, 40bogomips, linux, mutt, details at http://atrey.karlin.mff.cuni.cz/~pavel/velo/index.html. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Hi!
Quoted 4 lines
Quoted 1 line
For recovering broken machine, I'd like to mount without replaying journal.
You cannot mount without replaying even in read-only mode, because file-system meta-data are possibly inconsistent.
Then suse's use of reiserfs is pretty b0rken. Putting reiserfsck on / partition is pretty useless -- if it crashes during mount you can't repair it.
If reiserfsck detects errors on /, you can't repair them because reiserfsck is on that partition. Ouch.
Quoted 6 lines
Quoted 2 lines
[reiserfs panics while replaying journal; seems there are still some bugs hidden in there]. Unfortunately, "nolog" option does not seem imlemented.
There is a patch allowing to mount reiserfs if there was io error during journal replay on mount. It is included into 2.4.9-ac* tree (it was sent to Linus several times, but this did not avail).
I already repaired my system -- had to install another copy of suse to another partition :-(.
Quoted 3 lines
Can you send to Reiserfs mail-list <[email protected]> more detailed information about your case, like ksymoopsed stack trace, etc.
No stack trace, sorry. It refused to mount saying that attempting to write into log block.. That's panic. Reiserfsck is not usable in such case, because ... how do you run reiserfsck from partition you can't mount?
Pavel
Signature · 2 lines
The best software in life is free (not shareware)! Pavel GCM d? s-: !g p?:+ au- a--@ w+ v- C++@ UL+++ L++ N++ E++ W--- M- Y- R+
Quoted 11 lines · Pavel Machek
Hi!
Quoted 4 lines
Quoted 1 line
For recovering broken machine, I'd like to mount without replaying journal.
You cannot mount without replaying even in read-only mode, because file-system meta-data are possibly inconsistent.
Then suse's use of reiserfs is pretty b0rken. Putting reiserfsck on / partition is pretty useless -- if it crashes during mount you can't repair it.
Every filesystem has this problem, if the root directory gets hosed you have to use the CDROM.
Booting from CDROM with SuSE is not such a problem.
Quoted 7 lines
If reiserfsck detects errors on /, you can't repair them because reiserfsck is on that partition. Ouch.
Quoted 3 lines
Quoted 2 lines
[reiserfs panics while replaying journal; seems there are still some bugs hidden in there]. Unfortunately, "nolog" option does not seem imlemented.
Quoted 6 lines
Quoted 3 lines
There is a patch allowing to mount reiserfs if there was io error during journal replay on mount. It is included into 2.4.9-ac* tree (it was sent to Linus several times, but this did not avail).
I already repaired my system -- had to install another copy of suse to another partition :-(.
I boot from CDROM when I have such problems.
Quoted 18 lines
Quoted 4 lines
Can you send to Reiserfs mail-list <[email protected]> more detailed information about your case, like ksymoopsed stack trace, etc.
No stack trace, sorry. It refused to mount saying that attempting to write into log block.. That's panic. Reiserfsck is not usable in such case, because ... how do you run reiserfsck from partition you can't mount?
Pavel
--
The best software in life is free (not shareware)! Pavel
GCM d? s-: !g p?:+ au- a--@ w+ v- C++@ UL+++ L++ N++ E++ W--- M- Y- R+ -
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 6 lines · Pavel Machek
No stack trace, sorry. It refused to mount saying that attempting to write into log block.. That's panic. Reiserfsck is not usable in such case, because ... how do you run reiserfsck from partition you can't mount?
Pavel
And how do you deal with that situation on xfs, ext3, or any other journaled fs? I don't think it even needs to be journaled at all.
If you have a broken ext2, and can't mount root, you're screwed until you put it in another system to fix it...
Mike
Quoted 15 lines · Mike Fedyk
Quoted 6 lines · Pavel Machek
No stack trace, sorry. It refused to mount saying that attempting to write into log block.. That's panic. Reiserfsck is not usable in such case, because ... how do you run reiserfsck from partition you can't mount?
PavelAnd how do you deal with that situation on xfs, ext3, or any other journaled fs? I don't think it even needs to be journaled at all.
If you have a broken ext2, and can't mount root, you're screwed until you put it in another system to fix it...
Quoted 6 lines
Mike
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
I think that life has gotten way easier now that distros can mostly be rescued using CDROMs instead of floppies.
:)
Hans
Hi!
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
For recovering broken machine, I'd like to mount without replaying journal.
You cannot mount without replaying even in read-only mode, because file-system meta-data are possibly inconsistent.
Quoted 7 lines
Quoted 3 lines
Then suse's use of reiserfs is pretty b0rken. Putting reiserfsck on / partition is pretty useless -- if it crashes during mount you can't repair it.
Every filesystem has this problem, if the root directory gets hosed you have to use the CDROM.
Booting from CDROM with SuSE is not such a problem.
ext2 is willing to mount ro even with known inconsistencies. SuSE 7.1 does not come with 'live filesystem' and install cd does not have reiserfsck on it. Too bad. You have to install somewhere to be able to run reiserfsck on suse7.1.
Pavel
Signature · 2 lines
I'm [email protected]. "In my country we have almost anarchy and I don't care." Panos Katsaloulis describing me w.r.t. patents at [email protected]
Quoted 6 lines
Quoted 1 line
Booting from CDROM with SuSE is not such a problem.
ext2 is willing to mount ro even with known inconsistencies. SuSE 7.1 does not come with 'live filesystem' and install cd does not have reiserfsck on it. Too bad. You have to install somewhere to be able to run reiserfsck on suse7.1.
You can get ext2 sufficiently hosed that you can't mount it or run fsck off it as well. Ok its harder, and "-o mount_me_harder" might be useful for reiserfs in this situation.
There is another reason for doing rescue without disk writeback which is more pressing - bad disks _often_ go close to read only when they begin to fail.
Also you need a true mount purely read only (or some kind of initrd deep voodoo) to use ext3 or reiserfs with swsuspend
Alan
Quoted 4 lines · On Thursday, August 30, 2001 11:50:05 PM +0200 Pavel Machek <[email protected]>…
ext2 is willing to mount ro even with known inconsistencies. SuSE 7.1 does not come with 'live filesystem' and install cd does not have reiserfsck on it. Too bad. You have to install somewhere to be able to run reiserfsck on suse7.1.
If your reiserfs isn't consistent, your chances of finding reiserfsck in the broken btree are slim to none. A readonly mount in this case is unlikely to find a valid, fully intact reiserfsck executable.
The best reason I've heard for a -o noreplay option is for shared readonly mounts. The patch below adds that, with a few conditions:
mount -o noreplay /dev/xxx /mnt
If no log replay is required, rw mount succeeds (ro is -o noreplay,ro is used).
Otherwise, no replay is done, mount is changed to readonly. Later attempts at mount -o rw,remount /mnt will fail with -EIO.
This is lightly tested, and not intended for inclusion anywhere. If there's enough interest, I'll verify and send in.
(against 2.4.10pre4)
-chris
#
include/linux/reiserfs_fs_sb.h +2 -0
@@ -387,6 +387,7 @@#define REISERFS_NO_UNHASHED_RELOCATION 12#define REISERFS_HASHED_RELOCATION 13#define REISERFS_TEST4 14 +#define REISERFS_NO_REPLAY 15#define REISERFS_TEST1 11#define REISERFS_TEST2 12
@@ -401,6 +402,7 @@#define reiserfs_no_unhashed_relocation (s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_NO_UNHASHED_RELOCATION))#define reiserfs_hashed_relocation (s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_HASHED_RELOCATION))#define reiserfs_test4 (s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_TEST4)) +#define reiserfs_noreplay (s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_NO_REPLAY))#define dont_have_tails (s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << NOTAIL))#define replay_only (s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REPLAYONLY))
include/linux/reiserfs_fs.h +1 -0
@@ -1723,6 +1723,7 @@*/ #define JOURNAL_BUFFER (j,n) ((j)->j_ap_blocks[((j)->j_start + (n)) % JOURNAL_BLOCK_COUNT]) +int reiserfs_replay_error (struct super_block *s) ;void reiserfs_wait_on_write_block (struct super_block *s) ;void reiserfs_block_writes (struct reiserfs_transaction_handle *th) ;void reiserfs_allow_writes (struct super_block *s) ;
fs/reiserfs/journal.c +25 -6
@@ -96,6 +96,7 @@/* state bits for the journal */ #define WRITERS_BLOCKED 1/* set when new writers not allowed */ +#define REPLAY_ERROR 2/* set when -o noreplay forces unclean mount */ static int do_journal_end (struct reiserfs_transaction_handle *,struct super_block *,unsigned long nblocks,int flags) ;static int flush_journal_list (struct super_block *s,struct reiserfs_journal_list *jl,int flushall) ;
@@ -106,6 +107,10 @@memset (SB_JOURNAL (p_s_sb)->j_hash_table,0 ,JOURNAL_HASH_SIZE *sizeof (struct reiserfs_journal_cnode *)) ; } +int reiserfs_replay_error (struct super_block *s) { +return test_bit (REPLAY_ERROR , &SB_JOURNAL (s)->j_state) ; +} +/* ** clears BH_Dirty and sticks the buffer on the clean list. Called because I can't allow refile_buffer to ** make schedule happen after I've freed a block. Look at remove_from_transaction and journal_mark_freed for
@@ -1651,12 +1656,20 @@brelse (d_bh) ; } -if (continue_replay &&is_read_only (p_s_sb->s_dev)) { -printk ("clm-2076: device is readonly, unable to replay log\n" ) ; -return -1 ; - } -if (continue_replay && (p_s_sb->s_flags &MS_RDONLY )) { -printk ("Warning, log replay starting on readonly filesystem\n" ) ; +if (continue_replay) { +if (is_read_only (p_s_sb->s_dev)) { +printk ("clm-2076: device is readonly, unable to replay log\n" ) ; +return -1 ; + } +if (reiserfs_noreplay (p_s_sb)) { +printk ("-o noreplay used to force unclean mount. FS set to readonly\n" ); + p_s_sb->s_flags |=MS_RDONLY ; +set_bit (REPLAY_ERROR , &SB_JOURNAL (p_s_sb)->j_state) ; +return 0 ; + } +if (p_s_sb->s_flags &MS_RDONLY ) { +printk ("Warning, log replay starting on readonly filesystem\n" ) ; + } }/* ok, there are transactions that need to be replayed. start with the first log block, find
@@ -2022,6 +2035,12 @@ th->t_super = p_s_sb ;/* others will check this for the don't log flag */ return 0 ; } + +if (test_bit (REPLAY_ERROR , &SB_JOURNAL (p_s_sb)->j_state)) { +printk ("clm-2100: calling journal_begin after replay errors\n" ) ; +BUG () ; + } + relock:lock_journal (p_s_sb) ;
fs/reiserfs/super.c +10 -0
@@ -176,6 +176,8 @@set_bit (REISERFS_HASHED_RELOCATION , mount_options); }else if (!strcmp (this_char,"test4" )) {set_bit (REISERFS_TEST4 , mount_options); + }else if (!strcmp (this_char,"noreplay" )) { +set_bit (REISERFS_NO_REPLAY , mount_options); }else if (!strcmp (this_char,"nolog" )) {reiserfs_warning ("reiserfs: nolog mount option not supported yet\n" ); }else if (!strcmp (this_char,"replayonly" )) {
@@ -268,6 +270,14 @@journal_mark_dirty (&th, s,SB_BUFFER_WITH_SB (s)); s->s_dirt =0 ; }else { +/* if we are currently readonly, and were mounted with noreplay, +** we need to check if replay failed and the journal params are not +** correctly set. If so, we cannot allow a rw mount, horrible, horrible +** things would happen +*/ +if (reiserfs_replay_error (s)) { +return -EIO ; + } s->u.reiserfs_sb.s_mount_state =sb_state (rs) ; s->s_flags &= ~MS_RDONLY ;/* now it is safe to call journal_begin */ journal_begin (&th, s,10 ) ;
Quoted 6 lines · Pavel Machek
Hi!
Quoted 4 lines
Quoted 3 lines
Then suse's use of reiserfs is pretty b0rken. Putting reiserfsck on / partition is pretty useless -- if it crashes during mount you can't repair it.
Quoted 8 lines
Quoted 3 lines
Every filesystem has this problem, if the root directory gets hosed you have to use the CDROM.
Booting from CDROM with SuSE is not such a problem.ext2 is willing to mount ro even with known inconsistencies. SuSE 7.1 does not come with 'live filesystem' and install cd does not have reiserfsck on it. Too bad. You have to install somewhere to be able to run reiserfsck on suse7.1.
Hmm. Is there any chance of *not* replaying the log on mount-ro, and using a combination of on disk meta-data, and journal?
Quoted 2 lines · Mike Fedyk
Hmm. Is there any chance of *not* replaying the log on mount-ro, and using a combination of on disk meta-data, and journal?
there is also the interesting problem of being unable to fsck xfs even when its successfully mounted-ro and consistent. even when mounted ro, it whinges that the fs is in use and refuses to fsck.
-Dan
Signature · 1 line
[-] Omae no subete no kichi wa ore no mono da. [-]
The SUSE CD has a rescue image which contains reiserfsck. Boot the CD in "manual" mode and select "Start rescue system" when you get to the install/boot installed/rescue menu.
Signature · 1 line
Rafael
I hate to ask you this, but will the result be a stream of users mounting -noreplay, and then asking us why things are broken (or worse, not asking....).
:-/
I think I would prefer something like:
-no_journal_replay causes mount to fail if there is a non-empty unplayed log, and otherwise (when lacking other reason for failing) succeed.
-no_journal_replay_mount_broken_fs causes mount to succeed without replaying even if there is a non-empty log. If there is a non-empty log, it mounts it readonly.
Notice how I don't assume the user will either read the man-page beyond the names of the mount options before using the options and then deciding reiserfs is broken, or that he will understand that the only thing replay could refer to is the journal (you can use log if the number of letters concerns you). I do assume that the number of users for this option will be so small that saving their typing is not worthwhile, and discouraging them by the amount of typing required is just fine to do in this case anyway....:-)
Being logically correct and documented on it won't save us from the users, always try to keep that in mind....:-)
Mounting readonly should replay the log unless -no_journal_replay is specified. Replaying the log is the correct thing to do for most users who don't read reiserfs man pages before supplying options to mount (and we do value those users). Users who use write-protected media to hold non-empty journals on reiserfs filesystems, well...., we should fail the mount for them, and if you fail with an error message telling them what to do to fix things we'll put you in for sainthood.
Hans
Quoted 145 lines · Chris Mason
Quoted 4 lines · On Thursday, August 30, 2001 11:50:05 PM +0200 Pavel Machek <[email protected]>…
ext2 is willing to mount ro even with known inconsistencies. SuSE 7.1 does not come with 'live filesystem' and install cd does not have reiserfsck on it. Too bad. You have to install somewhere to be able to run reiserfsck on suse7.1.
If your reiserfs isn't consistent, your chances of finding reiserfsck in the broken btree are slim to none. A readonly mount in this case is unlikely to find a valid, fully intact reiserfsck executable.
The best reason I've heard for a -o noreplay option is for shared readonly mounts. The patch below adds that, with a few conditions:
mount -o noreplay
/dev/xxx/mntIf no log replay is required, rw mount succeeds (ro is -o noreplay,ro is used).
Otherwise, no replay is done, mount is changed to readonly. Later attempts at mount -o rw,remount /mnt will fail with
-EIO.This is lightly tested, and not intended for inclusion anywhere. If there's enough interest, I'll verify and send in.
(against 2.4.10pre4)
-chris
#
include/linux/reiserfs_fs_sb.h Tue Sep 4 14:39:44 2001 renamed from include/linux/reiserfs_fs_sb.h Tue Sep 4 14:37:27 2001 +2
-0@@ -387,6 +387,7 @@ #define REISERFS_NO_UNHASHED_RELOCATION 12 #define REISERFS_HASHED_RELOCATION 13 #define REISERFS_TEST4 14 +#define REISERFS_NO_REPLAY 15 #define REISERFS_TEST1 11 #define REISERFS_TEST2 12@@ -401,6 +402,7 @@ #define reiserfs_no_unhashed_relocation(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_NO_UNHASHED_RELOCATION)) #define reiserfs_hashed_relocation(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_HASHED_RELOCATION)) #define reiserfs_test4(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_TEST4)) +#define reiserfs_noreplay(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REISERFS_NO_REPLAY)) #define dont_have_tails(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << NOTAIL)) #define replay_only(s) ((s)->u.reiserfs_sb.s_mount_opt & (1 << REPLAYONLY))include/linux/reiserfs_fs.h Tue Sep 4 15:47:43 2001 renamed from include/linux/reiserfs_fs.h Tue Sep 4 14:37:27 2001 +1
-0@@ -1723,6 +1723,7 @@ */ #define JOURNAL_BUFFER(j,n) ((j)->j_ap_blocks[((j)->j_start + (n)) % JOURNAL_BLOCK_COUNT]) +int reiserfs_replay_error(struct super_block *s) ; void reiserfs_wait_on_write_block(struct super_block *s) ; void reiserfs_block_writes(struct reiserfs_transaction_handle *th) ; void reiserfs_allow_writes(struct super_block *s) ;fs/reiserfs/journal.c Tue Sep 4 15:57:59 2001 renamed from fs/reiserfs/journal.c Sun Sep 2 03:52:37 2001 +25
-6@@ -96,6 +96,7 @@ /* state bits for the journal */ #define WRITERS_BLOCKED 1 /* set when new writers not allowed */ +#define REPLAY_ERROR 2 /* set when -o noreplay forces unclean mount */ static int do_journal_end(struct reiserfs_transaction_handle *,struct super_block *,unsigned long nblocks,int flags) ; static int flush_journal_list(struct super_block *s, struct reiserfs_journal_list *jl, int flushall) ;@@ -106,6 +107,10 @@ memset(SB_JOURNAL(p_s_sb)->j_hash_table, 0, JOURNAL_HASH_SIZE * sizeof(struct reiserfs_journal_cnode *)) ; } +int reiserfs_replay_error(struct super_block *s) { + return test_bit(REPLAY_ERROR, &SB_JOURNAL(s)->j_state) ; +} + /* ** clears BH_Dirty and sticks the buffer on the clean list. Called because I can't allow refile_buffer to ** make schedule happen after I've freed a block. Look at remove_from_transaction and journal_mark_freed for@@ -1651,12 +1656,20 @@ brelse(d_bh) ; } - if (continue_replay && is_read_only(p_s_sb->s_dev)) { - printk("clm-2076: device is readonly, unable to replay log\n") ; - return -1 ; - } - if (continue_replay && (p_s_sb->s_flags & MS_RDONLY)) { - printk("Warning, log replay starting on readonly filesystem\n") ; + if (continue_replay) { + if (is_read_only(p_s_sb->s_dev)) { + printk("clm-2076: device is readonly, unable to replay log\n") ; + return -1 ; + } + if (reiserfs_noreplay(p_s_sb)) { + printk("-o noreplay used to force unclean mount. FS set to readonly\n"); + p_s_sb->s_flags |= MS_RDONLY ; + set_bit(REPLAY_ERROR, &SB_JOURNAL(p_s_sb)->j_state) ; + return 0 ; + } + if (p_s_sb->s_flags & MS_RDONLY) { + printk("Warning, log replay starting on readonly filesystem\n") ; + } } /* ok, there are transactions that need to be replayed. start with the first log block, find@@ -2022,6 +2035,12 @@ th->t_super = p_s_sb ; /* others will check this for the don't log flag */ return 0 ; } + + if (test_bit(REPLAY_ERROR, &SB_JOURNAL(p_s_sb)->j_state)) { + printk("clm-2100: calling journal_begin after replay errors\n") ; + BUG() ; + } + relock: lock_journal(p_s_sb) ;fs/reiserfs/super.c Tue Sep 4 15:58:02 2001 renamed from fs/reiserfs/super.c Tue Sep 4 14:37:28 2001 +10
-0@@ -176,6 +176,8 @@ set_bit (REISERFS_HASHED_RELOCATION, mount_options); } else if (!strcmp (this_char, "test4")) { set_bit (REISERFS_TEST4, mount_options); + } else if (!strcmp (this_char, "noreplay")) { + set_bit (REISERFS_NO_REPLAY, mount_options); } else if (!strcmp (this_char, "nolog")) { reiserfs_warning("reiserfs: nolog mount option not supported yet\n"); } else if (!strcmp (this_char, "replayonly")) {@@ -268,6 +270,14 @@ journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB (s)); s->s_dirt = 0; } else { + /* if we are currently readonly, and were mounted with noreplay, + ** we need to check if replay failed and the journal params are not + ** correctly set. If so, we cannot allow a rw mount, horrible, horrible + ** things would happen + */ + if (reiserfs_replay_error(s)) { + return -EIO ; + } s->u.reiserfs_sb.s_mount_state = sb_state(rs) ; s->s_flags &= ~MS_RDONLY ; /* now it is safe to call journal_begin */ journal_begin(&th, s, 10) ;
Quoted 3 lines · On Wednesday, September 05, 2001 01:33:51 AM +0400 Hans Reiser…
I hate to ask you this, but will the result be a stream of users mounting -noreplay, and then asking us why things are broken (or worse, not asking....).
Well, now that we have the patch, fine tuning the user experience is easy. It depends on the demand for the feature....
In my mind, the most important part is that it does not allow a read/write mount when there are transactions that need to be replayed, so they can't screw up their FS any worse than it was before they started ;-)
-chris