Received: by 10.223.185.111 with SMTP id b44csp1640661wrg; Sat, 10 Mar 2018 10:21:59 -0800 (PST) X-Google-Smtp-Source: AG47ELsz/PmqIL/duXE4SKXm0TwYAG9r0E7tS1T5NgBRrz0QDhkAPUsX/ibtpJzIuoOo8TuFl4Mj X-Received: by 10.98.215.2 with SMTP id b2mr2626683pfh.87.1520706119329; Sat, 10 Mar 2018 10:21:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520706119; cv=none; d=google.com; s=arc-20160816; b=yHBFSlFj04AhnYsuSM5wbX3Wd+mGJwukde7cylBvQnaaNNcIrTc9GxrrpDmsFjdjMj PJ/2ojbPtNhjUFRLNP0HvGwytZU1pwX+RfZDxrxrLvQuFbSziJFKjEjw2s3QsS778ANV FpnjWODybz83naRuu+rQ08x6RqCTBvJLnP7/aQ38b2yxQP3ZSvqP8O+Vp/x6Q0Iwy+fQ yRWKK7vhUcmAJ9NKMhIRGyrjm4VASZ9Fl9Rji2mp6tJ+RvomUtkuGpNOmQHH9j228YA8 lQhLnvevr4TsRaLFSNprTpdS51Ul8kHaeje+R1ha1WkxtM7juHtxrURCT645zIp/hyed MBZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Rs+Um0TFQF2zDBvTSHBrSQ8wmotwkmnnaQue7SkQY5g=; b=NcpPPVqOgAnLroM1UYE8BBmius9mt/c5BS4GBYuulTlBmQhvpdamCNipcXVaubVvkd aQawJp6Y+wpi9763R53p891uxruy1rDWmY7z/T3nlguYZdmr81EhrlWpTRRuSNXmaJP5 pPcquq6jaUJD2qMLt2R7KytBP3WhDXihTjDKnZWYXbxPdnynVYOWxXqZCrzm6OfLTh78 I+CjugIfMguBNIN4AJCpbJeHKKGq/DcQBjUIBBXt4Hy0AlFd3PCAhvqKewxGMLQwQ5xT R+dy4gxrR2moO7ysqjN0oVK4cut3pW2T53YTjaLoN+tvK1J+vK1aMP8lAn3V+MMDC5pV iReA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@eng.ucsd.edu header.s=google header.b=eoFUZlPX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r9si3028836pfg.165.2018.03.10.10.21.44; Sat, 10 Mar 2018 10:21:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@eng.ucsd.edu header.s=google header.b=eoFUZlPX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932345AbeCJSUh (ORCPT + 99 others); Sat, 10 Mar 2018 13:20:37 -0500 Received: from mail-pl0-f67.google.com ([209.85.160.67]:46198 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932302AbeCJSUc (ORCPT ); Sat, 10 Mar 2018 13:20:32 -0500 Received: by mail-pl0-f67.google.com with SMTP id y8-v6so7003120pll.13 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=dvCrlT/DLcgM8uI9zbOFNVXiCqOI8ndMKgGyTOcQzUncMB+oCuEOdH9STYGfcbOoxx z5+PQ3qIIobA1O31HZ9hUCcu2GXJ7HyL0UxmIN5gLepcdP0WqgZBMRJoD9VJUYTTHAOX R6kO9PniK2j2Mgs/MMLqrf1BBLym5/zPfbhwaKXWBaVBlNHhYN/vMuj+YeiW5nIJcZm/ sIOfEykPI/SE/ECLnwTNG2xa+H9Zpr1AkkM2kc6S72avlqLJbviGzT/W7gN5+pqq73Kw mK94axDwZMgc2hYLq5mzvU0w2wcgqiBQDiujqLRDdTwDFWYTMR6DMgxYtWL8FhOMjbZg /BOQ== X-Gm-Message-State: AElRT7FrFiU7s72nfleb4pX2dTqV0CvXMo45jSj6zIfW5h2e7JTh0Til GpfwbYBJDmtV9XgBpYoTvMImqg== 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 Cc: dan.j.williams@intel.com, andy.rudoff@intel.com, coughlan@redhat.com, swanson@cs.ucsd.edu, david@fromorbit.com, jack@suse.com, swhiteho@redhat.com, miklos@szeredi.hu, andiry.xu@gmail.com, Andiry Xu 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, -- 2.7.4