From: Miklos Szeredi <miklos@szeredi.hu>
To: viro@zeniv.linux.org.uk
Cc: dave@linux.vnet.ibm.com, akpm@linux-foundation.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/9] vfs: fix per mount read-write
Date: Tue, 05 Oct 2010 12:31:11 +0200 [thread overview]
Message-ID: <20101005103137.421669825@szeredi.hu> (raw)
In-Reply-To: <20101005103108.288743609@szeredi.hu>
[-- Attachment #1: vfs-fix-bind-remount-read-write.patch --]
[-- Type: text/plain, Size: 1332 bytes --]
From: Miklos Szeredi <mszeredi@suse.cz>
Don't allow remounting the vfsmount read-write if the superblock is
read-only. Return -EROFS in this case.
Rename __mnt_unmake_readonly() to mnt_make_writable() to match
mnt_make_readonly().
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---
fs/namespace.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
Index: linux-2.6/fs/namespace.c
===================================================================
--- linux-2.6.orig/fs/namespace.c 2010-09-30 16:53:30.000000000 +0200
+++ linux-2.6/fs/namespace.c 2010-09-30 16:57:47.000000000 +0200
@@ -399,11 +399,18 @@ static int mnt_make_readonly(struct vfsm
return ret;
}
-static void __mnt_unmake_readonly(struct vfsmount *mnt)
+static int mnt_make_writable(struct vfsmount *mnt)
{
+ int err = 0;
+
br_write_lock(vfsmount_lock);
- mnt->mnt_flags &= ~MNT_READONLY;
+ if (mnt->mnt_sb->s_flags & MS_RDONLY)
+ err = -EROFS;
+ else
+ mnt->mnt_flags &= ~MNT_READONLY;
br_write_unlock(vfsmount_lock);
+
+ return err;
}
void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb)
@@ -1600,7 +1607,7 @@ static int change_mount_flags(struct vfs
if (readonly_request)
error = mnt_make_readonly(mnt);
else
- __mnt_unmake_readonly(mnt);
+ error = mnt_make_writable(mnt);
return error;
}
--
next prev parent reply other threads:[~2010-10-05 10:32 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-05 10:31 [PATCH 0/9] read-only remount fixes Miklos Szeredi
2010-10-05 10:31 ` [PATCH 1/9] vfs: fix infinite loop caused by clone_mnt race Miklos Szeredi
2010-10-05 10:49 ` Miklos Szeredi
2010-10-05 10:31 ` [PATCH 2/9] vfs: ignore error on forced remount Miklos Szeredi
2010-10-05 10:31 ` Miklos Szeredi [this message]
2010-10-05 10:31 ` [PATCH 4/9] vfs: add sb_force_remount_readonly() helper Miklos Szeredi
2010-10-05 10:31 ` [PATCH 5/9] vfs: allow mnt_want_write() to sleep Miklos Szeredi
2010-10-05 10:31 ` [PATCH 6/9] vfs: keep list of mounts for each superblock Miklos Szeredi
2010-10-05 10:31 ` [PATCH 7/9] vfs: protect remounting superblock read-only Miklos Szeredi
2010-10-22 6:46 ` Al Viro
2010-10-22 12:25 ` Miklos Szeredi
2010-10-22 16:10 ` Miklos Szeredi
2010-10-22 16:14 ` [PATCH 7/9 updated] " Miklos Szeredi
2010-10-23 16:19 ` Al Viro
2010-10-23 19:35 ` Miklos Szeredi
2010-10-23 21:42 ` Al Viro
2010-10-25 12:36 ` Miklos Szeredi
2010-10-05 10:31 ` [PATCH 8/9] vfs: fs_may_remount_ro: turn unnecessary check into a WARN_ON Miklos Szeredi
2010-10-05 10:31 ` [PATCH 9/9] vfs: mark mounts read-only on forced remount Miklos Szeredi
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=20101005103137.421669825@szeredi.hu \
--to=miklos@szeredi.hu \
--cc=akpm@linux-foundation.org \
--cc=dave@linux.vnet.ibm.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
all inboxes | Powered by JetHome®