* [PATCH] ext4: fallocate_zero_range, check if is regular file
@ 2014-04-17 4:22 jon ernst
2014-04-17 11:08 ` Lukáš Czerner
2014-04-18 7:50 ` Ashish Sangwan
0 siblings, 2 replies; 4+ messages in thread
From: jon ernst @ 2014-04-17 4:22 UTC (permalink / raw)
To: linux-ext4@vger.kernel.org List
fallocate_zero_range, check if inode is regular file.
Signed-off-by: Jon Ernst <jonernst07@gmail.com>
---
fs/ext4/extents.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 1bb3e4b..756a3b9 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4742,6 +4742,8 @@ static long ext4_zero_range(struct file *file,
loff_t offset,
trace_ext4_zero_range(inode, offset, len, mode);
+ if (!S_ISREG(inode->i_mode))
+ return -EOPNOTSUPP;
/*
* Write out all dirty pages to avoid race conditions
* Then release them.
--
1.8.1.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: fallocate_zero_range, check if is regular file
2014-04-17 4:22 [PATCH] ext4: fallocate_zero_range, check if is regular file jon ernst
@ 2014-04-17 11:08 ` Lukáš Czerner
2014-04-18 7:50 ` Ashish Sangwan
1 sibling, 0 replies; 4+ messages in thread
From: Lukáš Czerner @ 2014-04-17 11:08 UTC (permalink / raw)
To: jon ernst; +Cc: linux-ext4@vger.kernel.org List
On Thu, 17 Apr 2014, jon ernst wrote:
> Date: Thu, 17 Apr 2014 00:22:04 -0400
> From: jon ernst <jonernst07@gmail.com>
> To: "linux-ext4@vger.kernel.org List" <linux-ext4@vger.kernel.org>
> Subject: [PATCH] ext4: fallocate_zero_range, check if is regular file
>
> fallocate_zero_range, check if inode is regular file.
>
> Signed-off-by: Jon Ernst <jonernst07@gmail.com>
Thanks, you can add.
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
> ---
> fs/ext4/extents.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index 1bb3e4b..756a3b9 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -4742,6 +4742,8 @@ static long ext4_zero_range(struct file *file,
> loff_t offset,
>
> trace_ext4_zero_range(inode, offset, len, mode);
>
> + if (!S_ISREG(inode->i_mode))
> + return -EOPNOTSUPP;
> /*
> * Write out all dirty pages to avoid race conditions
> * Then release them.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: fallocate_zero_range, check if is regular file
2014-04-17 4:22 [PATCH] ext4: fallocate_zero_range, check if is regular file jon ernst
2014-04-17 11:08 ` Lukáš Czerner
@ 2014-04-18 7:50 ` Ashish Sangwan
2014-04-18 15:52 ` Theodore Ts'o
1 sibling, 1 reply; 4+ messages in thread
From: Ashish Sangwan @ 2014-04-18 7:50 UTC (permalink / raw)
To: jon ernst; +Cc: linux-ext4@vger.kernel.org List
On Thu, Apr 17, 2014 at 9:52 AM, jon ernst <jonernst07@gmail.com> wrote:
> fallocate_zero_range, check if inode is regular file.
>
> Signed-off-by: Jon Ernst <jonernst07@gmail.com>
> ---
> fs/ext4/extents.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index 1bb3e4b..756a3b9 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -4742,6 +4742,8 @@ static long ext4_zero_range(struct file *file,
> loff_t offset,
>
> trace_ext4_zero_range(inode, offset, len, mode);
>
> + if (!S_ISREG(inode->i_mode))
> + return -EOPNOTSUPP;
IMO returning -EINVAL is better suited in this situation.
And the same error value has to be updated for collapse_range too. (as
mentioned by Michael in other mail thread regarding manpage patch of
collapse range)
> /*
> * Write out all dirty pages to avoid race conditions
> * Then release them.
> --
> 1.8.1.2
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: fallocate_zero_range, check if is regular file
2014-04-18 7:50 ` Ashish Sangwan
@ 2014-04-18 15:52 ` Theodore Ts'o
0 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2014-04-18 15:52 UTC (permalink / raw)
To: Ashish Sangwan; +Cc: jon ernst, linux-ext4@vger.kernel.org List
Thanks, applied with the error code changed to -EINVAL.
- Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-04-18 15:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-17 4:22 [PATCH] ext4: fallocate_zero_range, check if is regular file jon ernst
2014-04-17 11:08 ` Lukáš Czerner
2014-04-18 7:50 ` Ashish Sangwan
2014-04-18 15:52 ` Theodore Ts'o
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).