linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/3] UBIFS: parse iversion mount option
@ 2017-04-10  6:53 Oleksij Rempel
  2017-04-10  6:53 ` [PATCH v1 2/3] fs: ubifs: i_version on inode changes Oleksij Rempel
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Oleksij Rempel @ 2017-04-10  6:53 UTC (permalink / raw)
  To: richard, dedekind1, adrian.hunter, linux-mtd, linux-kernel
  Cc: Steffen Trumtrar, Oleksij Rempel

From: Steffen Trumtrar <s.trumtrar@pengutronix.de>

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 fs/ubifs/super.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index b73811bd7676..61180bee38b4 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -931,6 +931,7 @@ enum {
 	Opt_chk_data_crc,
 	Opt_no_chk_data_crc,
 	Opt_override_compr,
+	Opt_i_version,
 	Opt_err,
 };
 
@@ -942,6 +943,7 @@ static const match_table_t tokens = {
 	{Opt_chk_data_crc, "chk_data_crc"},
 	{Opt_no_chk_data_crc, "no_chk_data_crc"},
 	{Opt_override_compr, "compr=%s"},
+	{Opt_i_version, "iversion"},
 	{Opt_err, NULL},
 };
 
@@ -986,6 +988,8 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options,
 		return 0;
 
 	while ((p = strsep(&options, ","))) {
+		struct super_block *sb = c->vfs_sb;
+		unsigned long flag;
 		int token;
 
 		if (!*p)
@@ -1042,11 +1046,11 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options,
 			c->default_compr = c->mount_opts.compr_type;
 			break;
 		}
+		case Opt_i_version:
+			sb->s_flags |= MS_I_VERSION;
+			break;
 		default:
 		{
-			unsigned long flag;
-			struct super_block *sb = c->vfs_sb;
-
 			flag = parse_standard_option(p);
 			if (!flag) {
 				ubifs_err(c, "unrecognized mount option \"%s\" or missing value",
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 2/3] fs: ubifs: i_version on inode changes
  2017-04-10  6:53 [PATCH v1 1/3] UBIFS: parse iversion mount option Oleksij Rempel
@ 2017-04-10  6:53 ` Oleksij Rempel
  2017-04-10  7:48   ` Oleksij Rempel
  2017-04-10  6:53 ` [PATCH v1 3/3] fs: ubifs: set s_uuid in super block Oleksij Rempel
  2017-04-10  7:48 ` [PATCH v1 1/3] UBIFS: parse iversion mount option Oleksij Rempel
  2 siblings, 1 reply; 6+ messages in thread
From: Oleksij Rempel @ 2017-04-10  6:53 UTC (permalink / raw)
  To: richard, dedekind1, adrian.hunter, linux-mtd, linux-kernel
  Cc: Sascha Hauer, Oleksij Rempel

From: Sascha Hauer <s.hauer@pengutronix.de>

This is necessary for IMA/EVM to detect changes on inodes.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 fs/ubifs/dir.c   | 8 --------
 fs/ubifs/file.c  | 2 ++
 fs/ubifs/super.c | 3 +--
 3 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 30825d882aa9..4a300bfabf9b 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -111,14 +111,6 @@ struct inode *ubifs_new_inode(struct ubifs_info *c, struct inode *dir,
 	if (!inode)
 		return ERR_PTR(-ENOMEM);
 
-	/*
-	 * Set 'S_NOCMTIME' to prevent VFS form updating [mc]time of inodes and
-	 * marking them dirty in file write path (see 'file_update_time()').
-	 * UBIFS has to fully control "clean <-> dirty" transitions of inodes
-	 * to make budgeting work.
-	 */
-	inode->i_flags |= S_NOCMTIME;
-
 	inode_init_owner(inode, dir, mode);
 	inode->i_mtime = inode->i_atime = inode->i_ctime =
 			 ubifs_current_time(inode);
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index d9ae86f96df7..3cbc662ce160 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -1391,6 +1391,8 @@ int ubifs_update_time(struct inode *inode, struct timespec *time,
 		return err;
 
 	mutex_lock(&ui->ui_mutex);
+	if (flags & S_VERSION)
+		inode_inc_iversion(inode);
 	if (flags & S_ATIME)
 		inode->i_atime = *time;
 	if (flags & S_CTIME)
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 61180bee38b4..76e44ab88065 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -128,9 +128,8 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum)
 	if (err)
 		goto out_ino;
 
-	inode->i_flags |= S_NOCMTIME;
 #ifndef CONFIG_UBIFS_ATIME_SUPPORT
-	inode->i_flags |= S_NOATIME;
+	inode->i_flags |= S_NOATIME | S_NOCMTIME;
 #endif
 	set_nlink(inode, le32_to_cpu(ino->nlink));
 	i_uid_write(inode, le32_to_cpu(ino->uid));
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 3/3] fs: ubifs: set s_uuid in super block
  2017-04-10  6:53 [PATCH v1 1/3] UBIFS: parse iversion mount option Oleksij Rempel
  2017-04-10  6:53 ` [PATCH v1 2/3] fs: ubifs: i_version on inode changes Oleksij Rempel
@ 2017-04-10  6:53 ` Oleksij Rempel
  2017-04-10  7:48 ` [PATCH v1 1/3] UBIFS: parse iversion mount option Oleksij Rempel
  2 siblings, 0 replies; 6+ messages in thread
From: Oleksij Rempel @ 2017-04-10  6:53 UTC (permalink / raw)
  To: richard, dedekind1, adrian.hunter, linux-mtd, linux-kernel
  Cc: Steffen Trumtrar, Oleksij Rempel

From: Steffen Trumtrar <s.trumtrar@pengutronix.de>

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 fs/ubifs/super.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 76e44ab88065..3cf2e0347595 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -2075,6 +2075,7 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
 		err = -ENOMEM;
 		goto out_umount;
 	}
+	memcpy(&sb->s_uuid, &c->uuid, sizeof(c->uuid));
 
 	mutex_unlock(&c->umount_mutex);
 	return 0;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 2/3] fs: ubifs: i_version on inode changes
  2017-04-10  6:53 ` [PATCH v1 2/3] fs: ubifs: i_version on inode changes Oleksij Rempel
@ 2017-04-10  7:48   ` Oleksij Rempel
  2017-04-10 11:47     ` Richard Weinberger
  0 siblings, 1 reply; 6+ messages in thread
From: Oleksij Rempel @ 2017-04-10  7:48 UTC (permalink / raw)
  To: Oleksij Rempel, richard, dedekind1, adrian.hunter, linux-mtd,
	linux-kernel
  Cc: Sascha Hauer

please ignore this patch. It need to be updated.

On 04/10/2017 08:53 AM, Oleksij Rempel wrote:
> From: Sascha Hauer <s.hauer@pengutronix.de>
>
> This is necessary for IMA/EVM to detect changes on inodes.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>  fs/ubifs/dir.c   | 8 --------
>  fs/ubifs/file.c  | 2 ++
>  fs/ubifs/super.c | 3 +--
>  3 files changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
> index 30825d882aa9..4a300bfabf9b 100644
> --- a/fs/ubifs/dir.c
> +++ b/fs/ubifs/dir.c
> @@ -111,14 +111,6 @@ struct inode *ubifs_new_inode(struct ubifs_info *c, struct inode *dir,
>  	if (!inode)
>  		return ERR_PTR(-ENOMEM);
>
> -	/*
> -	 * Set 'S_NOCMTIME' to prevent VFS form updating [mc]time of inodes and
> -	 * marking them dirty in file write path (see 'file_update_time()').
> -	 * UBIFS has to fully control "clean <-> dirty" transitions of inodes
> -	 * to make budgeting work.
> -	 */
> -	inode->i_flags |= S_NOCMTIME;
> -
>  	inode_init_owner(inode, dir, mode);
>  	inode->i_mtime = inode->i_atime = inode->i_ctime =
>  			 ubifs_current_time(inode);
> diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
> index d9ae86f96df7..3cbc662ce160 100644
> --- a/fs/ubifs/file.c
> +++ b/fs/ubifs/file.c
> @@ -1391,6 +1391,8 @@ int ubifs_update_time(struct inode *inode, struct timespec *time,
>  		return err;
>
>  	mutex_lock(&ui->ui_mutex);
> +	if (flags & S_VERSION)
> +		inode_inc_iversion(inode);
>  	if (flags & S_ATIME)
>  		inode->i_atime = *time;
>  	if (flags & S_CTIME)
> diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
> index 61180bee38b4..76e44ab88065 100644
> --- a/fs/ubifs/super.c
> +++ b/fs/ubifs/super.c
> @@ -128,9 +128,8 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum)
>  	if (err)
>  		goto out_ino;
>
> -	inode->i_flags |= S_NOCMTIME;
>  #ifndef CONFIG_UBIFS_ATIME_SUPPORT
> -	inode->i_flags |= S_NOATIME;
> +	inode->i_flags |= S_NOATIME | S_NOCMTIME;
>  #endif
>  	set_nlink(inode, le32_to_cpu(ino->nlink));
>  	i_uid_write(inode, le32_to_cpu(ino->uid));
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/3] UBIFS: parse iversion mount option
  2017-04-10  6:53 [PATCH v1 1/3] UBIFS: parse iversion mount option Oleksij Rempel
  2017-04-10  6:53 ` [PATCH v1 2/3] fs: ubifs: i_version on inode changes Oleksij Rempel
  2017-04-10  6:53 ` [PATCH v1 3/3] fs: ubifs: set s_uuid in super block Oleksij Rempel
@ 2017-04-10  7:48 ` Oleksij Rempel
  2 siblings, 0 replies; 6+ messages in thread
From: Oleksij Rempel @ 2017-04-10  7:48 UTC (permalink / raw)
  To: Oleksij Rempel, richard, dedekind1, adrian.hunter, linux-mtd,
	linux-kernel
  Cc: Steffen Trumtrar

please ignore this patch. It need to be updated.

On 04/10/2017 08:53 AM, Oleksij Rempel wrote:
> From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
>
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>  fs/ubifs/super.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
> index b73811bd7676..61180bee38b4 100644
> --- a/fs/ubifs/super.c
> +++ b/fs/ubifs/super.c
> @@ -931,6 +931,7 @@ enum {
>  	Opt_chk_data_crc,
>  	Opt_no_chk_data_crc,
>  	Opt_override_compr,
> +	Opt_i_version,
>  	Opt_err,
>  };
>
> @@ -942,6 +943,7 @@ static const match_table_t tokens = {
>  	{Opt_chk_data_crc, "chk_data_crc"},
>  	{Opt_no_chk_data_crc, "no_chk_data_crc"},
>  	{Opt_override_compr, "compr=%s"},
> +	{Opt_i_version, "iversion"},
>  	{Opt_err, NULL},
>  };
>
> @@ -986,6 +988,8 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options,
>  		return 0;
>
>  	while ((p = strsep(&options, ","))) {
> +		struct super_block *sb = c->vfs_sb;
> +		unsigned long flag;
>  		int token;
>
>  		if (!*p)
> @@ -1042,11 +1046,11 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options,
>  			c->default_compr = c->mount_opts.compr_type;
>  			break;
>  		}
> +		case Opt_i_version:
> +			sb->s_flags |= MS_I_VERSION;
> +			break;
>  		default:
>  		{
> -			unsigned long flag;
> -			struct super_block *sb = c->vfs_sb;
> -
>  			flag = parse_standard_option(p);
>  			if (!flag) {
>  				ubifs_err(c, "unrecognized mount option \"%s\" or missing value",
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 2/3] fs: ubifs: i_version on inode changes
  2017-04-10  7:48   ` Oleksij Rempel
@ 2017-04-10 11:47     ` Richard Weinberger
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Weinberger @ 2017-04-10 11:47 UTC (permalink / raw)
  To: Oleksij Rempel, Oleksij Rempel, dedekind1, adrian.hunter,
	linux-mtd, linux-kernel
  Cc: Sascha Hauer

Am 10.04.2017 um 09:48 schrieb Oleksij Rempel:
> please ignore this patch. It need to be updated.

Okay. :-)
Please CC also linux-fsdevel.

Thanks,
//richard

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-04-10 11:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-10  6:53 [PATCH v1 1/3] UBIFS: parse iversion mount option Oleksij Rempel
2017-04-10  6:53 ` [PATCH v1 2/3] fs: ubifs: i_version on inode changes Oleksij Rempel
2017-04-10  7:48   ` Oleksij Rempel
2017-04-10 11:47     ` Richard Weinberger
2017-04-10  6:53 ` [PATCH v1 3/3] fs: ubifs: set s_uuid in super block Oleksij Rempel
2017-04-10  7:48 ` [PATCH v1 1/3] UBIFS: parse iversion mount option Oleksij Rempel

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).