lkml.org 
[lkml]   [2010]   [Sep]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 02/10] 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>
    ---
    fs/overlayfs/overlayfs.c | 20 ++++++++++++++++++++
    1 files changed, 20 insertions(+), 0 deletions(-)

    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 {



    \
     
     \ /
      Last update: 2010-09-06 02:53    [W:0.048 / U:29.028 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site