From: Dave Hansen <dave@linux.vnet.ibm.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Nick Piggin <npiggin@suse.de>,
linux-kernel@vger.kernel.org,
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
Dave Hansen <dave@linux.vnet.ibm.com>
Subject: [RFC][PATCH 1/2] pin kern mounts as writable
Date: Mon, 03 Aug 2009 14:59:40 -0700 [thread overview]
Message-ID: <20090803215940.DF984602@kernel> (raw)
If we are going to continue to use mnt_clone_write() inside
of init_file(), then we're going to need some kind of extra
handling.
What I want to do in the next patch is add a debugging check
in mnt_clone_write() to double-check that there *is* a real
writer on the mount before mnt_clone_write() succeeds. To
do that, we either need to check for MS_KERNMOUNT around
that debug check, or we need to make sure that these kern
mounts *have* a write already.
I'm choosing to make sure they always have a write.
---
linux-2.6.git-dave/fs/super.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff -puN fs/super.c~pin-mnt-writable fs/super.c
--- linux-2.6.git/fs/super.c~pin-mnt-writable 2009-08-03 14:47:29.000000000 -0700
+++ linux-2.6.git-dave/fs/super.c 2009-08-03 14:49:49.000000000 -0700
@@ -948,7 +948,19 @@ EXPORT_SYMBOL_GPL(do_kern_mount);
struct vfsmount *kern_mount_data(struct file_system_type *type, void *data)
{
- return vfs_kern_mount(type, MS_KERNMOUNT, type->name, data);
+ int err = 0;
+ struct vfsmount *mnt;
+ mnt = vfs_kern_mount(type, MS_KERNMOUNT, type->name, data);
+ if (IS_ERR(mnt))
+ return mnt;
+ /*
+ * We will never allow this mount to be r/o. Doing
+ * this makes it explicit and allows mnt_clone_write()
+ * to be used unconditionally on this mount.
+ */
+ err = mnt_want_write(mnt);
+ WARN_ON(err);
+ return mnt;
}
EXPORT_SYMBOL_GPL(kern_mount_data);
diff -puN include/linux/mount.h~pin-mnt-writable include/linux/mount.h
_
next reply other threads:[~2009-08-03 21:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-03 21:59 Dave Hansen [this message]
2009-08-03 21:59 ` [RFC][PATCH 2/2] fix mnt_want_write_file() on special files Dave Hansen
2009-09-12 13:42 ` [RFC][PATCH 1/2] pin kern mounts as writable Al Viro
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=20090803215940.DF984602@kernel \
--to=dave@linux.vnet.ibm.com \
--cc=hirofumi@mail.parknet.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=npiggin@suse.de \
--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 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.