From patchwork Sat Mar 10 18:17:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andiry Xu X-Patchwork-Id: 10273831 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 138F7602BD for ; Sat, 10 Mar 2018 18:20:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0384528BAE for ; Sat, 10 Mar 2018 18:20:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC288293FC; Sat, 10 Mar 2018 18:20:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B642228BAE for ; Sat, 10 Mar 2018 18:20:34 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7AC362258AF0B; Sat, 10 Mar 2018 10:14:15 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c01::243; helo=mail-pl0-x243.google.com; envelope-from=jix024@eng.ucsd.edu; receiver=linux-nvdimm@lists.01.org Received: from mail-pl0-x243.google.com (mail-pl0-x243.google.com [IPv6:2607:f8b0:400e:c01::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0F2882258AEFB for ; Sat, 10 Mar 2018 10:14:13 -0800 (PST) Received: by mail-pl0-x243.google.com with SMTP id m22-v6so7032110pls.5 for ; Sat, 10 Mar 2018 10:20:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eng.ucsd.edu; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Rs+Um0TFQF2zDBvTSHBrSQ8wmotwkmnnaQue7SkQY5g=; b=eoFUZlPX/XWVYf387umaBVFbNaeIyF+bKmTo7HJIDOTieka+cT9Qf5wrnP3YSkbiJc RrHGrfj1oq8zzZjF5N/IeL1U+sgbxGeN4/N+bMmYF8x6egoT43CdhDCuBe/GjR/v8SU0 NvxHbrvgT4jwbNXswti2N+9y4+O/ehFXdQYDo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Rs+Um0TFQF2zDBvTSHBrSQ8wmotwkmnnaQue7SkQY5g=; b=MHWsNS7OqjxEeaq5xMdmVu0vke7O/EyIX+VxOmnBgyuACMhf3ou/YoFy2J1D26URYy NVBLrp3CwHMkXIWnS5pyDcL9V8TxCHbtqYmAbDy9mmqOvBtx+AP4QLGEaB2igoy5nauj PMmLrzMMmSIyFwnfboG7hQtQd4KFSJPkp4V5BBArn7ZgqJaNZ7HOtatCkbh4cus4DMGB +Nbpp/opSswF0RDo33l6tYLxm0lFGkn0mLae9fWTB9azPCPIgMes2q+orVEKFdV0hrCx 10h/x5i5fRRlBw6oVl8qIt2HUB59rtry/eSVhT+vH7YwVQrdYufd8hrccgWUKCarZuSW SHOA== X-Gm-Message-State: AElRT7HNnddvbXURTUbEhO33CdjzqXDuj/QtovBXFcJOM1tXiFL4BQGu Xbmn8nGbEyM3KYFDU+Yj9weexQ== X-Google-Smtp-Source: AG47ELvy8q20JM2c6MBAJwGp0jKeQEZ6uuKt/Xr0oIjWavdeJX2Nm7UJUGSED6BHNdP8EUSFaOMiNQ== X-Received: by 2002:a17:902:bc84:: with SMTP id bb4-v6mr2773605plb.317.1520706031497; Sat, 10 Mar 2018 10:20:31 -0800 (PST) Received: from brienza-desktop.8.8.4.4 (andxu.ucsd.edu. [132.239.17.134]) by smtp.gmail.com with ESMTPSA id h80sm9210167pfj.181.2018.03.10.10.20.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 10 Mar 2018 10:20:30 -0800 (PST) From: Andiry Xu To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org Subject: [RFC v2 13/83] Add remount_fs and show_options methods. Date: Sat, 10 Mar 2018 10:17:54 -0800 Message-Id: <1520705944-6723-14-git-send-email-jix024@eng.ucsd.edu> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520705944-6723-1-git-send-email-jix024@eng.ucsd.edu> References: <1520705944-6723-1-git-send-email-jix024@eng.ucsd.edu> X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: coughlan@redhat.com, miklos@szeredi.hu, Andiry Xu , david@fromorbit.com, jack@suse.com, swanson@cs.ucsd.edu, swhiteho@redhat.com, andiry.xu@gmail.com MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP From: Andiry Xu Signed-off-by: Andiry Xu --- fs/nova/super.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/fs/nova/super.c b/fs/nova/super.c index 3efb560..f41cc04 100644 --- a/fs/nova/super.c +++ b/fs/nova/super.c @@ -617,6 +617,59 @@ static int nova_fill_super(struct super_block *sb, void *data, int silent) return retval; } +static int nova_show_options(struct seq_file *seq, struct dentry *root) +{ + struct nova_sb_info *sbi = NOVA_SB(root->d_sb); + + if (sbi->mode != (0777 | S_ISVTX)) + seq_printf(seq, ",mode=%03o", sbi->mode); + if (uid_valid(sbi->uid)) + seq_printf(seq, ",uid=%u", from_kuid(&init_user_ns, sbi->uid)); + if (gid_valid(sbi->gid)) + seq_printf(seq, ",gid=%u", from_kgid(&init_user_ns, sbi->gid)); + if (test_opt(root->d_sb, ERRORS_RO)) + seq_puts(seq, ",errors=remount-ro"); + if (test_opt(root->d_sb, ERRORS_PANIC)) + seq_puts(seq, ",errors=panic"); + if (test_opt(root->d_sb, DAX)) + seq_puts(seq, ",dax"); + + return 0; +} + +static int nova_remount(struct super_block *sb, int *mntflags, char *data) +{ + unsigned long old_sb_flags; + unsigned long old_mount_opt; + struct nova_sb_info *sbi = NOVA_SB(sb); + int ret = -EINVAL; + + /* Store the old options */ + mutex_lock(&sbi->s_lock); + old_sb_flags = sb->s_flags; + old_mount_opt = sbi->s_mount_opt; + + if (nova_parse_options(data, sbi, 1)) + goto restore_opt; + + sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | + ((sbi->s_mount_opt & NOVA_MOUNT_POSIX_ACL) ? + MS_POSIXACL : 0); + + if ((*mntflags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) + nova_update_mount_time(sb); + + mutex_unlock(&sbi->s_lock); + ret = 0; + return ret; + +restore_opt: + sb->s_flags = old_sb_flags; + sbi->s_mount_opt = old_mount_opt; + mutex_unlock(&sbi->s_lock); + return ret; +} + static void nova_put_super(struct super_block *sb) { struct nova_sb_info *sbi = NOVA_SB(sb); @@ -697,6 +750,8 @@ static struct super_operations nova_sops = { .alloc_inode = nova_alloc_inode, .destroy_inode = nova_destroy_inode, .put_super = nova_put_super, + .remount_fs = nova_remount, + .show_options = nova_show_options, }; static struct dentry *nova_mount(struct file_system_type *fs_type,