[Ocfs2-devel] [PATCH] Ocfs2: do not allow fallocate on dir file

Tristan Ye tristan.ye at oracle.com
Fri Mar 4 00:21:42 PST 2011


Hi Dongyang,

    Looks like we've already had a check for that in 
ocfs2_change_file_space().



Li Dongyang wrote:
> allowing fallocate() on dir file doesn't make sense, we check if
> we are dealing with a regular file and return -EINVAL when it's not,
> Thanks
>
> Signed-off-by: Li Dongyang <lidongyang at novell.com>
> ---
>  fs/ocfs2/file.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index a665195..0c68a61 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -1870,6 +1870,11 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
>  		goto out_inode_unlock;
>  	}
>  
> +	if (!S_ISREG(inode->i_mode)) {
> +		ret = -EINVAL;
> +		goto out_inode_unlock;
> +	}
> +
>  	switch (sr->l_whence) {
>  	case 0: /*SEEK_SET*/
>  		break;




More information about the Ocfs2-devel mailing list