linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 04/21] procfs: drop vmtruncate
@ 2012-10-20 12:17 Marco Stornelli
  2012-10-24 15:12 ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Marco Stornelli @ 2012-10-20 12:17 UTC (permalink / raw)
  To: Linux FS Devel; +Cc: linux-kernel

Removed vmtruncate

Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
---
 fs/proc/base.c        |    3 ++-
 fs/proc/generic.c     |    3 ++-
 fs/proc/proc_sysctl.c |    3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index 144a967..f976f31 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -544,9 +544,10 @@ int proc_setattr(struct dentry *dentry, struct iattr *attr)
 
 	if ((attr->ia_valid & ATTR_SIZE) &&
 	    attr->ia_size != i_size_read(inode)) {
-		error = vmtruncate(inode, attr->ia_size);
+		error = inode_newsize_ok(inode, attr->ia_size);
 		if (error)
 			return error;
+		truncate_setsize(inode, attr->ia_size);
 	}
 
 	setattr_copy(inode, attr);
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 0d80cef..6e7a8a7 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -263,9 +263,10 @@ static int proc_notify_change(struct dentry *dentry, struct iattr *iattr)
 
 	if ((iattr->ia_valid & ATTR_SIZE) &&
 	    iattr->ia_size != i_size_read(inode)) {
-		error = vmtruncate(inode, iattr->ia_size);
+		error = inode_newsize_ok(inode, iattr->ia_size);
 		if (error)
 			return error;
+		truncate_setsize(inode, iattr->ia_size);
 	}
 
 	setattr_copy(inode, iattr);
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index a781bdf..f8d7989 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -737,9 +737,10 @@ static int proc_sys_setattr(struct dentry *dentry, struct iattr *attr)
 
 	if ((attr->ia_valid & ATTR_SIZE) &&
 	    attr->ia_size != i_size_read(inode)) {
-		error = vmtruncate(inode, attr->ia_size);
+		error = inode_newsize_ok(inode, attr->ia_size);
 		if (error)
 			return error;
+		truncate_setsize(inode, attr->ia_size);
 	}
 
 	setattr_copy(inode, attr);
-- 
1.7.3.4

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

* Re: [PATCH 04/21] procfs: drop vmtruncate
  2012-10-20 12:17 [PATCH 04/21] procfs: drop vmtruncate Marco Stornelli
@ 2012-10-24 15:12 ` Christoph Hellwig
  2012-10-24 16:02   ` Marco Stornelli
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2012-10-24 15:12 UTC (permalink / raw)
  To: Marco Stornelli; +Cc: Linux FS Devel, linux-kernel

On Sat, Oct 20, 2012 at 02:17:33PM +0200, Marco Stornelli wrote:
> Removed vmtruncate
> 
> Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>

As Al pointed out we probably shouldn't even allow truncate on procfs.
Can look into refusing it instead, please?


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

* Re: [PATCH 04/21] procfs: drop vmtruncate
  2012-10-24 15:12 ` Christoph Hellwig
@ 2012-10-24 16:02   ` Marco Stornelli
  0 siblings, 0 replies; 6+ messages in thread
From: Marco Stornelli @ 2012-10-24 16:02 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Linux FS Devel, linux-kernel

Il 24/10/2012 17:12, Christoph Hellwig ha scritto:
> On Sat, Oct 20, 2012 at 02:17:33PM +0200, Marco Stornelli wrote:
>> Removed vmtruncate
>>
>> Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
>
> As Al pointed out we probably shouldn't even allow truncate on procfs.
> Can look into refusing it instead, please?
>
>

Mmmm...for example the command "truncate --size=100 config.gz" is a nop, 
so it seems to me it makes no sense to support the size change, but I 
don't know if there are other use cases. However, should we return EPERM 
in case of size change checking it before inode_change_ok()?

Marco

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

* [PATCH 04/21] procfs: drop vmtruncate
@ 2012-12-15 10:48 Marco Stornelli
  0 siblings, 0 replies; 6+ messages in thread
From: Marco Stornelli @ 2012-12-15 10:48 UTC (permalink / raw)
  To: Linux FS Devel; +Cc: linux-kernel, Al Viro

Removed vmtruncate

Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
---
 fs/proc/base.c        |    7 -------
 fs/proc/generic.c     |    9 +--------
 fs/proc/proc_sysctl.c |    7 -------
 3 files changed, 1 insertions(+), 22 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index aa63d25..c88e14a 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -542,13 +542,6 @@ int proc_setattr(struct dentry *dentry, struct iattr *attr)
 	if (error)
 		return error;
 
-	if ((attr->ia_valid & ATTR_SIZE) &&
-	    attr->ia_size != i_size_read(inode)) {
-		error = vmtruncate(inode, attr->ia_size);
-		if (error)
-			return error;
-	}
-
 	setattr_copy(inode, attr);
 	mark_inode_dirty(inode);
 	return 0;
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 0d80cef..0c00b63 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -261,16 +261,9 @@ static int proc_notify_change(struct dentry *dentry, struct iattr *iattr)
 	if (error)
 		return error;
 
-	if ((iattr->ia_valid & ATTR_SIZE) &&
-	    iattr->ia_size != i_size_read(inode)) {
-		error = vmtruncate(inode, iattr->ia_size);
-		if (error)
-			return error;
-	}
-
 	setattr_copy(inode, iattr);
 	mark_inode_dirty(inode);
-	
+
 	de->uid = inode->i_uid;
 	de->gid = inode->i_gid;
 	de->mode = inode->i_mode;
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 701580d..1827d88 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -736,13 +736,6 @@ static int proc_sys_setattr(struct dentry *dentry, struct iattr *attr)
 	if (error)
 		return error;
 
-	if ((attr->ia_valid & ATTR_SIZE) &&
-	    attr->ia_size != i_size_read(inode)) {
-		error = vmtruncate(inode, attr->ia_size);
-		if (error)
-			return error;
-	}
-
 	setattr_copy(inode, attr);
 	mark_inode_dirty(inode);
 	return 0;
-- 
1.7.3.4

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

* [PATCH 04/21] procfs: drop vmtruncate
@ 2012-11-03  9:24 Marco Stornelli
  0 siblings, 0 replies; 6+ messages in thread
From: Marco Stornelli @ 2012-11-03  9:24 UTC (permalink / raw)
  To: Linux FS Devel; +Cc: linux-kernel

Removed vmtruncate

Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
---
 fs/proc/base.c        |    7 -------
 fs/proc/generic.c     |    9 +--------
 fs/proc/proc_sysctl.c |    7 -------
 3 files changed, 1 insertions(+), 22 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index 144a967..6f009a3 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -542,13 +542,6 @@ int proc_setattr(struct dentry *dentry, struct iattr *attr)
 	if (error)
 		return error;
 
-	if ((attr->ia_valid & ATTR_SIZE) &&
-	    attr->ia_size != i_size_read(inode)) {
-		error = vmtruncate(inode, attr->ia_size);
-		if (error)
-			return error;
-	}
-
 	setattr_copy(inode, attr);
 	mark_inode_dirty(inode);
 	return 0;
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 0d80cef..0c00b63 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -261,16 +261,9 @@ static int proc_notify_change(struct dentry *dentry, struct iattr *iattr)
 	if (error)
 		return error;
 
-	if ((iattr->ia_valid & ATTR_SIZE) &&
-	    iattr->ia_size != i_size_read(inode)) {
-		error = vmtruncate(inode, iattr->ia_size);
-		if (error)
-			return error;
-	}
-
 	setattr_copy(inode, iattr);
 	mark_inode_dirty(inode);
-	
+
 	de->uid = inode->i_uid;
 	de->gid = inode->i_gid;
 	de->mode = inode->i_mode;
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index a781bdf..4b354c0 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -735,13 +735,6 @@ static int proc_sys_setattr(struct dentry *dentry, struct iattr *attr)
 	if (error)
 		return error;
 
-	if ((attr->ia_valid & ATTR_SIZE) &&
-	    attr->ia_size != i_size_read(inode)) {
-		error = vmtruncate(inode, attr->ia_size);
-		if (error)
-			return error;
-	}
-
 	setattr_copy(inode, attr);
 	mark_inode_dirty(inode);
 	return 0;
-- 
1.7.3.4

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

* [PATCH 04/21] procfs: drop vmtruncate
@ 2012-08-31 13:53 Marco Stornelli
  0 siblings, 0 replies; 6+ messages in thread
From: Marco Stornelli @ 2012-08-31 13:53 UTC (permalink / raw)
  To: Linux FS Devel; +Cc: Guenter Roeck, Luca Tettamanti, linux-kernel

Removed vmtruncate.

Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
---
 fs/proc/base.c        |    3 ++-
 fs/proc/generic.c     |    3 ++-
 fs/proc/proc_sysctl.c |    3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index 1b6c84c..36fa9dd 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -545,9 +545,10 @@ int proc_setattr(struct dentry *dentry, struct iattr *attr)
 
 	if ((attr->ia_valid & ATTR_SIZE) &&
 	    attr->ia_size != i_size_read(inode)) {
-		error = vmtruncate(inode, attr->ia_size);
+		error = inode_newsize_ok(inode, attr->ia_size);
 		if (error)
 			return error;
+		truncate_setsize(inode, attr->ia_size);
 	}
 
 	setattr_copy(inode, attr);
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index b3647fe..d471d2f 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -263,9 +263,10 @@ static int proc_notify_change(struct dentry *dentry, struct iattr *iattr)
 
 	if ((iattr->ia_valid & ATTR_SIZE) &&
 	    iattr->ia_size != i_size_read(inode)) {
-		error = vmtruncate(inode, iattr->ia_size);
+		error = inode_newsize_ok(inode, iattr->ia_size);
 		if (error)
 			return error;
+		truncate_setsize(inode, iattr->ia_size);
 	}
 
 	setattr_copy(inode, iattr);
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index dfafeb2..5c484f8 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -740,9 +740,10 @@ static int proc_sys_setattr(struct dentry *dentry, struct iattr *attr)
 
 	if ((attr->ia_valid & ATTR_SIZE) &&
 	    attr->ia_size != i_size_read(inode)) {
-		error = vmtruncate(inode, attr->ia_size);
+		error = inode_newsize_ok(inode, attr->ia_size);
 		if (error)
 			return error;
+		truncate_setsize(inode, attr->ia_size);
 	}
 
 	setattr_copy(inode, attr);
-- 
1.7.3.4

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

end of thread, other threads:[~2012-12-15 10:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-20 12:17 [PATCH 04/21] procfs: drop vmtruncate Marco Stornelli
2012-10-24 15:12 ` Christoph Hellwig
2012-10-24 16:02   ` Marco Stornelli
  -- strict thread matches above, loose matches on Subject: below --
2012-12-15 10:48 Marco Stornelli
2012-11-03  9:24 Marco Stornelli
2012-08-31 13:53 Marco Stornelli

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