LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	ext4 development <linux-ext4@vger.kernel.org>
Subject: [PATCH] [UPDATED] ext3: refuse ro to rw remount of fs with orphan inodes
Date: Thu, 11 Jan 2007 14:28:14 -0600	[thread overview]
Message-ID: <45A69DDE.2020208@redhat.com> (raw)

This is a followup to the patch which skipped orphan inode processing 
on a filesystem residing on a readonly bdev (think snapshot taken
with open, unlinked files).  That avoided an oops.

Stephen had concerns about what happens if the bdev later goes readwrite,
and the filesystem is subsequently mounted remount,rw - if the orphan
list isn't processed then, things will be in bad shape.

The patch I sent earlier to process the orphan inode list on remount
was met with silence and/or slight suspicion (from akpm) so how
about this: just to plug the hole on what I think is a pretty rare
condition, simply disallow the ro->rw transition if we have unprocessed
orphan inodes.

Then we get this:

[root@magnesium ~]# mount -o remount,rw /mnt/test
mount: /mnt/test not mounted already, or bad option
[root@magnesium ~]# dmesg | tail -n 1
EXT3-fs: hda7: couldn't remount RDWR because of unprocessed orphan inode list.  Please umount/remount instead.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Index: linux-2.6.19/fs/ext3/super.c
===================================================================
--- linux-2.6.19.orig/fs/ext3/super.c
+++ linux-2.6.19/fs/ext3/super.c
@@ -2350,6 +2350,22 @@ static int ext3_remount (struct super_bl
 				err = -EROFS;
 				goto restore_opts;
 			}
+
+			/*
+			 * If we have an unprocessed orphan list hanging
+			 * around from a previously readonly bdev mount,
+			 * require a full umount/remount for now.
+			 */
+			if (es->s_last_orphan) {
+				printk(KERN_WARNING "EXT3-fs: %s: couldn't "
+				       "remount RDWR because of unprocessed "
+				       "orphan inode list.  Please "
+				       "umount/remount instead.\n",
+				       sb->s_id);
+				err = -EINVAL;
+				goto restore_opts;
+			}
+
 			/*
 			 * Mounting a RDONLY partition read-write, so reread
 			 * and store the current valid flag.  (It may have



                 reply	other threads:[~2007-01-11 20:28 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=45A69DDE.2020208@redhat.com \
    --to=sandeen@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH] [UPDATED] ext3: refuse ro to rw remount of fs with orphan inodes' \
    /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

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