linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Linux FS Maling List <linux-fsdevel@vger.kernel.org>,
	Linux Kernel Maling List <linux-kernel@vger.kernel.org>,
	Alexander Stein <alexander.stein@systec-electronic.com>
Subject: [RFC] [PATCH] vfs: remount all file-systems R/O on emergency remount.
Date: Fri, 24 Aug 2012 10:26:06 +0300	[thread overview]
Message-ID: <1345793166-14230-1-git-send-email-dedekind1@gmail.com> (raw)

From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

Currently the emergency remount (triggered by Sysrq-u) re-mounting only
those file-systems R/O, which have an associated block device (sb->s_bdev).
This does not work for file-systems like UBIFS and JFFS2 which work on top
of MTD devices (character devices) and always have sb->s_bdev = NULL.

This also does not work for tmpfs.

Most probably the intention was to avoid re-mounting R/O file-systems like
procfs, sysfs, cgroup, and debugfs. However, I do not really see why not
to remount them R/O as well in case of emergency.

This patch removes the 'sb->s_bdev != NULL' check from
'do_emergency_remount()', so _all_ file-systems will be re-mounted R/O.

Tested in Fedora - all file-systems (ext4, ubifs, procfs, sysfs, cgroup, and
debugfs) become R/O on Sysrq-u with this patch.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
 fs/super.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/super.c b/fs/super.c
index 0902cfa..95cf173 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -812,7 +812,7 @@ static void do_emergency_remount(struct work_struct *work)
 		sb->s_count++;
 		spin_unlock(&sb_lock);
 		down_write(&sb->s_umount);
-		if (sb->s_root && sb->s_bdev && (sb->s_flags & MS_BORN) &&
+		if (sb->s_root && (sb->s_flags & MS_BORN) &&
 		    !(sb->s_flags & MS_RDONLY)) {
 			/*
 			 * What lock protects sb->s_flags??
-- 
1.7.10.4


             reply	other threads:[~2012-08-24  7:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-24  7:26 Artem Bityutskiy [this message]
2012-08-24 13:20 ` [RFC] [PATCH] vfs: remount all file-systems R/O on emergency remount Marco Stornelli
2012-08-24 13:38   ` Artem Bityutskiy
2012-08-24 13:51     ` Marco Stornelli

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=1345793166-14230-1-git-send-email-dedekind1@gmail.com \
    --to=dedekind1@gmail.com \
    --cc=alexander.stein@systec-electronic.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).