[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100905214452.797527a7@notabene>
Date: Sun, 5 Sep 2010 21:44:52 +1000
From: Neil Brown <neilb@...e.de>
To: "J. R. Okajima" <hooanon05@...oo.co.jp>
Cc: Miklos Szeredi <miklos@...redi.hu>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, vaurora@...hat.com,
viro@...iv.linux.org.uk
Subject: Re: [PATCH 0/6] overlay filesystem prototype
On Sun, 05 Sep 2010 19:37:10 +0900
"J. R. Okajima" <hooanon05@...oo.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@...e.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@...e.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 {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists