From: Neil Brown <neilb@suse.de>
To: "J. R. Okajima" <hooanon05@yahoo.co.jp>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
vaurora@redhat.com, viro@zeniv.linux.org.uk
Subject: Re: [PATCH 0/6] overlay filesystem prototype
Date: Sun, 5 Sep 2010 21:44:52 +1000 [thread overview]
Message-ID: <20100905214452.797527a7@notabene> (raw)
In-Reply-To: <20970.1283683030@jrobl>
On Sun, 05 Sep 2010 19:37:10 +0900
"J. R. Okajima" <hooanon05@yahoo.co.jp> wrote:
>
> Miklos Szeredi:
> > Changes since the last version:
> :::
> > - get write ref on the upper layer on mount unless the overlay
> > itself is mounted read-only
>
> I think it a good approach.
> Although it may be harmless, write-ref will not be put when a user
> executes,
> - mount -o ro /overlay
^remount, I assume
> - umount /overlay
> It will be easy to fix by implementing s_op->remount().
Something like this?
(I have a few other patches queued up, but haven't tested anything properly
yet).
NeilBrown
>From 3a9e1d4f07c5d6fd18cc165537107dd31233ec1f Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Sat, 4 Sep 2010 09:17:54 +1000
Subject: [PATCH] ovl: minimal remount support.
As overlayfs reflects the 'readonly' mount status in write-access to
the upper filesystem, we must handle remount and either drop or take
write access when the ro status changes.
Signed-off-by: NeilBrown <neilb@suse.de>
diff --git a/fs/overlayfs/overlayfs.c b/fs/overlayfs/overlayfs.c
index 0ddfeec..4e032e8 100644
--- a/fs/overlayfs/overlayfs.c
+++ b/fs/overlayfs/overlayfs.c
@@ -1685,8 +1685,28 @@ static void ovl_put_super(struct super_block *sb)
kfree(ufs);
}
+static int ovl_remount_fs(struct super_block *sb, int *flagsp, char *data)
+{
+ int flags = *flagsp;
+ struct ovl_fs *ufs = sb->s_fs_info;
+
+ /* When remounting rw or ro, we need to adjust the write access to the
+ * upper fs.
+ */
+ if (((flags ^ sb->s_flags) & MS_RDONLY) == 0)
+ /* No change to readonly status */
+ return 0;
+
+ if (flags & MS_RDONLY) {
+ mnt_drop_write(ufs->upper_mnt);
+ return 0;
+ } else
+ return mnt_want_write(ufs->upper_mnt);
+}
+
static const struct super_operations ovl_super_operations = {
.put_super = ovl_put_super,
+ .remount_fs = ovl_remount_fs,
};
struct ovl_config {
next prev parent reply other threads:[~2010-09-05 11:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-03 13:41 [PATCH 0/6] overlay filesystem prototype Miklos Szeredi
2010-09-03 13:41 ` [PATCH 1/6] vfs: implement open "forwarding" Miklos Szeredi
2010-09-03 13:41 ` [PATCH 2/6] vfs: make i_op->permission take a dentry instead of an inode Miklos Szeredi
2010-09-17 13:14 ` Aneesh Kumar K. V
2010-09-03 13:41 ` [PATCH 3/6] vfs: add flag to allow rename to same inode Miklos Szeredi
2010-09-03 13:41 ` [PATCH 4/6] vfs: export do_splice_direct() to modules Miklos Szeredi
2010-09-03 13:41 ` [PATCH 5/6] overlay: hybrid overlay filesystem prototype Miklos Szeredi
2010-09-03 13:41 ` [PATCH 6/6] overlay: overlay filesystem documentation Miklos Szeredi
2010-09-05 10:37 ` [PATCH 0/6] overlay filesystem prototype J. R. Okajima
2010-09-05 11:44 ` Neil Brown [this message]
2010-09-05 12:08 ` J. R. Okajima
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=20100905214452.797527a7@notabene \
--to=neilb@suse.de \
--cc=hooanon05@yahoo.co.jp \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=vaurora@redhat.com \
--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).