All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] -oresize on ro filesystem causes panic
@ 2004-04-19 14:46 Jeff Mahoney
  0 siblings, 0 replies; only message in thread
From: Jeff Mahoney @ 2004-04-19 14:46 UTC (permalink / raw)
  To: ReiserFS Mailing List

[-- Attachment #1: Type: text/plain, Size: 1094 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hey all -

While developing my io-error patches (posted previously), I skipped the
resize stuff, opting to come back to it later, since it involved
re-ordering operations so we don't blow ourselves out of the water.
Today, I started digging into that code, and found that if -oresize is
used when the filesystem is read-only, it will attempt to start a
transaction on a read-only filesystem. When CONFIG_REISERFS_CHECK is
enabled, this causes an assertion failure.

mount -r /dev/hda8 /mnt
mount -oremount,resize=123456 /mnt
*panic*

The attached patch fixes the problem. It also moves the reiserfs_resize
call after the filesystem is made read-write on remount. This is so the
following succeeds:

mount -oremount,resize=123456,rw /mnt

- -Jeff

- --
Jeff Mahoney
SuSE Labs
jeffm@suse.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFAg+YtLPWxlyuTD7IRAvBXAJ9ruUhuwvqYcYoLLQxv1+76kC4XTQCfYH3E
rmTlSJjVWIJc5pVqPpv/F/s=
=aDB6
-----END PGP SIGNATURE-----

[-- Attachment #2: reiserfs-resize.diff --]
[-- Type: text/plain, Size: 1344 bytes --]

diff -rup linux-2.6.5.kgdb/fs/reiserfs/resize.c linux-2.6.5.kgdb.afs/fs/reiserfs/resize.c
--- linux-2.6.5.kgdb/fs/reiserfs/resize.c	2004-04-03 22:36:55.000000000 -0500
+++ linux-2.6.5.kgdb.afs/fs/reiserfs/resize.c	2004-04-19 10:28:53.692014416 -0400
@@ -33,6 +33,11 @@ int reiserfs_resize (struct super_block 
 	int i;
 	int copy_size ;
 
+	if (s->s_flags & MS_RDONLY) {
+		reiserfs_warning (s, "Can't resize read-only filesystem.");
+		return -EINVAL;
+	}
+
 	sb = SB_DISK_SUPER_BLOCK(s);
 
 	if (SB_BLOCK_COUNT(s) >= block_count_new) {
diff -rup linux-2.6.5.kgdb/fs/reiserfs/super.c linux-2.6.5.kgdb.afs/fs/reiserfs/super.c
--- linux-2.6.5.kgdb/fs/reiserfs/super.c	2004-04-17 13:32:13.000000000 -0400
+++ linux-2.6.5.kgdb.afs/fs/reiserfs/super.c	2004-04-19 10:30:02.897493584 -0400
@@ -890,12 +890,6 @@ static int reiserfs_remount (struct supe
 	  SB_JOURNAL_MAX_TRANS_AGE(s) = commit_max_age;
   }
 
-  if(blocks) {
-    int rc = reiserfs_resize(s, blocks);
-    if (rc != 0)
-      return rc;
-  }
-
   if (*mount_flags & MS_RDONLY) {
     reiserfs_xattr_init (s, *mount_flags);
     /* remount read-only */
@@ -944,6 +938,12 @@ static int reiserfs_remount (struct supe
     reiserfs_xattr_init (s, *mount_flags);
   }
 
+  if(blocks) {
+    int rc = reiserfs_resize(s, blocks);
+    if (rc != 0)
+      return rc;
+  }
+
   return 0;
 }
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-04-19 14:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-19 14:46 [PATCH] -oresize on ro filesystem causes panic Jeff Mahoney

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.