linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Reiserfs: how to mount without journal replay?
@ 2001-08-26 13:08 Pavel Machek
  2001-08-30 12:04 ` Nikita Danilov
  0 siblings, 1 reply; 14+ messages in thread
From: Pavel Machek @ 2001-08-26 13:08 UTC (permalink / raw)
  To: linux-kernel

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.
-- 
Philips Velo 1: 1"x4"x8", 300gram, 60, 12MB, 40bogomips, linux, mutt,
details at http://atrey.karlin.mff.cuni.cz/~pavel/velo/index.html.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reiserfs: how to mount without journal replay?
  2001-08-26 13:08 Reiserfs: how to mount without journal replay? Pavel Machek
@ 2001-08-30 12:04 ` Nikita Danilov
  2001-08-30 20:53   ` Pavel Machek
  0 siblings, 1 reply; 14+ messages in thread
From: Nikita Danilov @ 2001-08-30 12:04 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-kernel

Pavel Machek writes:
 > 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.

 > [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 <Reiserfs-List@Namesys.COM> more
detailed information about your case, like ksymoopsed stack trace, etc.

 > Are there experimental to do that?
 > 								Pavel
 > PS: Please CC me.

Nikita.

 > -- 
 > 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 majordomo@vger.kernel.org
 > More majordomo info at  http://vger.kernel.org/majordomo-info.html
 > Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reiserfs: how to mount without journal replay?
  2001-08-30 12:04 ` Nikita Danilov
@ 2001-08-30 20:53   ` Pavel Machek
  2001-08-30 21:16     ` Hans Reiser
  2001-08-30 21:30     ` Mike Fedyk
  0 siblings, 2 replies; 14+ messages in thread
From: Pavel Machek @ 2001-08-30 20:53 UTC (permalink / raw)
  To: Nikita Danilov; +Cc: Pavel Machek, linux-kernel, research

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.

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.

>  > [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 :-(.

> Can you send to Reiserfs mail-list <Reiserfs-List@Namesys.COM> 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+

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reiserfs: how to mount without journal replay?
  2001-08-30 20:53   ` Pavel Machek
@ 2001-08-30 21:16     ` Hans Reiser
  2001-08-30 21:50       ` Pavel Machek
  2001-09-04 20:53       ` Chris Mason
  2001-08-30 21:30     ` Mike Fedyk
  1 sibling, 2 replies; 14+ messages in thread
From: Hans Reiser @ 2001-08-30 21:16 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Nikita Danilov, Pavel Machek, linux-kernel, research

Pavel Machek wrote:
> 
> 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.
> 
> 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.

> 
> If reiserfsck detects errors on /, you can't repair them because
> reiserfsck is on that partition. Ouch.
> 
> >  > [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 :-(.


I boot from CDROM when I have such problems.

> 
> > Can you send to Reiserfs mail-list <Reiserfs-List@Namesys.COM> 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reiserfs: how to mount without journal replay?
  2001-08-30 20:53   ` Pavel Machek
  2001-08-30 21:16     ` Hans Reiser
@ 2001-08-30 21:30     ` Mike Fedyk
  2001-08-30 21:35       ` Hans Reiser
  1 sibling, 1 reply; 14+ messages in thread
From: Mike Fedyk @ 2001-08-30 21:30 UTC (permalink / raw)
  To: linux-kernel

On Thu, Aug 30, 2001 at 10:53:23PM +0200, Pavel Machek wrote:
> 
> 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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reiserfs: how to mount without journal replay?
  2001-08-30 21:30     ` Mike Fedyk
@ 2001-08-30 21:35       ` Hans Reiser
  0 siblings, 0 replies; 14+ messages in thread
From: Hans Reiser @ 2001-08-30 21:35 UTC (permalink / raw)
  To: Mike Fedyk; +Cc: linux-kernel

Mike Fedyk wrote:
> 
> On Thu, Aug 30, 2001 at 10:53:23PM +0200, Pavel Machek wrote:
> >
> > 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
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> 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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reiserfs: how to mount without journal replay?
  2001-08-30 21:16     ` Hans Reiser
@ 2001-08-30 21:50       ` Pavel Machek
  2001-08-30 22:04         ` Mike Fedyk
                           ` (2 more replies)
  2001-09-04 20:53       ` Chris Mason
  1 sibling, 3 replies; 14+ messages in thread
From: Pavel Machek @ 2001-08-30 21:50 UTC (permalink / raw)
  To: Hans Reiser; +Cc: Nikita Danilov, Pavel Machek, linux-kernel, research

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.
> > 
> > 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
-- 
I'm pavel@ucw.cz. "In my country we have almost anarchy and I don't care."
Panos Katsaloulis describing me w.r.t. patents at discuss@linmodems.org

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reiserfs: how to mount without journal replay?
  2001-08-30 21:50       ` Pavel Machek
@ 2001-08-30 22:04         ` Mike Fedyk
  2001-08-30 22:10           ` Dan Hollis
  2001-08-30 22:15         ` Rafael Herrera
  2001-08-30 22:32         ` Alan Cox
  2 siblings, 1 reply; 14+ messages in thread
From: Mike Fedyk @ 2001-08-30 22:04 UTC (permalink / raw)
  To: linux-kernel

On Thu, Aug 30, 2001 at 11:50:05PM +0200, Pavel Machek wrote:
> Hi!
> 
> > > 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.

Hmm.  Is there any chance of *not* replaying the log on mount-ro, and using
a combination of on disk meta-data, and journal?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reiserfs: how to mount without journal replay?
  2001-08-30 22:04         ` Mike Fedyk
@ 2001-08-30 22:10           ` Dan Hollis
  0 siblings, 0 replies; 14+ messages in thread
From: Dan Hollis @ 2001-08-30 22:10 UTC (permalink / raw)
  To: Mike Fedyk; +Cc: linux-kernel

On Thu, 30 Aug 2001, Mike Fedyk wrote:
> 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

-- 
[-] Omae no subete no kichi wa ore no mono da. [-]



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reiserfs: how to mount without journal replay?
  2001-08-30 21:50       ` Pavel Machek
  2001-08-30 22:04         ` Mike Fedyk
@ 2001-08-30 22:15         ` Rafael Herrera
  2001-08-30 22:32         ` Alan Cox
  2 siblings, 0 replies; 14+ messages in thread
From: Rafael Herrera @ 2001-08-30 22:15 UTC (permalink / raw)
  To: linux-kernel

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.

-- 
     Rafael

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reiserfs: how to mount without journal replay?
  2001-08-30 21:50       ` Pavel Machek
  2001-08-30 22:04         ` Mike Fedyk
  2001-08-30 22:15         ` Rafael Herrera
@ 2001-08-30 22:32         ` Alan Cox
  2 siblings, 0 replies; 14+ messages in thread
From: Alan Cox @ 2001-08-30 22:32 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Hans Reiser, Nikita Danilov, Pavel Machek, linux-kernel, research

> > 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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reiserfs: how to mount without journal replay?
  2001-08-30 21:16     ` Hans Reiser
  2001-08-30 21:50       ` Pavel Machek
@ 2001-09-04 20:53       ` Chris Mason
  2001-09-04 21:33         ` Hans Reiser
  2001-09-05  2:01         ` Chris Mason
  1 sibling, 2 replies; 14+ messages in thread
From: Chris Mason @ 2001-09-04 20:53 UTC (permalink / raw)
  To: Pavel Machek, Hans Reiser; +Cc: Nikita Danilov, Pavel Machek, linux-kernel



On Thursday, August 30, 2001 11:50:05 PM +0200 Pavel Machek <pavel@suse.cz> wrote:

> 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

#
--- linux/include/linux/reiserfs_fs_sb.h	Tue Sep  4 14:37:27 2001
+++ linux/include/linux/reiserfs_fs_sb.h	Tue Sep  4 14:39:44 2001
@@ -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))
--- linux/include/linux/reiserfs_fs.h	Tue Sep  4 14:37:27 2001
+++ linux/include/linux/reiserfs_fs.h	Tue Sep  4 15:47:43 2001
@@ -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) ;
--- linux/fs/reiserfs/journal.c	Sun Sep  2 03:52:37 2001
+++ linux/fs/reiserfs/journal.c	Tue Sep  4 15:57:59 2001
@@ -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) ;
--- linux/fs/reiserfs/super.c	Tue Sep  4 14:37:28 2001
+++ linux/fs/reiserfs/super.c	Tue Sep  4 15:58:02 2001
@@ -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) ;





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reiserfs: how to mount without journal replay?
  2001-09-04 20:53       ` Chris Mason
@ 2001-09-04 21:33         ` Hans Reiser
  2001-09-05  2:01         ` Chris Mason
  1 sibling, 0 replies; 14+ messages in thread
From: Hans Reiser @ 2001-09-04 21:33 UTC (permalink / raw)
  To: Chris Mason
  Cc: Pavel Machek, Nikita Danilov, Pavel Machek, linux-kernel, reiserfs-dev

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


Chris Mason wrote:
> 
> On Thursday, August 30, 2001 11:50:05 PM +0200 Pavel Machek <pavel@suse.cz> wrote:
> 
> > 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
> 
> #
> --- linux/include/linux/reiserfs_fs_sb.h        Tue Sep  4 14:37:27 2001
> +++ linux/include/linux/reiserfs_fs_sb.h        Tue Sep  4 14:39:44 2001
> @@ -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))
> --- linux/include/linux/reiserfs_fs.h   Tue Sep  4 14:37:27 2001
> +++ linux/include/linux/reiserfs_fs.h   Tue Sep  4 15:47:43 2001
> @@ -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) ;
> --- linux/fs/reiserfs/journal.c Sun Sep  2 03:52:37 2001
> +++ linux/fs/reiserfs/journal.c Tue Sep  4 15:57:59 2001
> @@ -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) ;
> --- linux/fs/reiserfs/super.c   Tue Sep  4 14:37:28 2001
> +++ linux/fs/reiserfs/super.c   Tue Sep  4 15:58:02 2001
> @@ -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) ;

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reiserfs: how to mount without journal replay?
  2001-09-04 20:53       ` Chris Mason
  2001-09-04 21:33         ` Hans Reiser
@ 2001-09-05  2:01         ` Chris Mason
  1 sibling, 0 replies; 14+ messages in thread
From: Chris Mason @ 2001-09-05  2:01 UTC (permalink / raw)
  To: Hans Reiser
  Cc: Pavel Machek, Nikita Danilov, Pavel Machek, linux-kernel, reiserfs-dev



On Wednesday, September 05, 2001 01:33:51 AM +0400 Hans Reiser
<reiser@namesys.com> wrote:

> 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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2001-09-05  2:01 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-26 13:08 Reiserfs: how to mount without journal replay? Pavel Machek
2001-08-30 12:04 ` Nikita Danilov
2001-08-30 20:53   ` Pavel Machek
2001-08-30 21:16     ` Hans Reiser
2001-08-30 21:50       ` Pavel Machek
2001-08-30 22:04         ` Mike Fedyk
2001-08-30 22:10           ` Dan Hollis
2001-08-30 22:15         ` Rafael Herrera
2001-08-30 22:32         ` Alan Cox
2001-09-04 20:53       ` Chris Mason
2001-09-04 21:33         ` Hans Reiser
2001-09-05  2:01         ` Chris Mason
2001-08-30 21:30     ` Mike Fedyk
2001-08-30 21:35       ` Hans Reiser

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).