From: Al Viro <viro@ZenIV.linux.org.uk>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
linux-unionfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2] vfs: fix FIGETBSZ ioctl on an overlayfs file
Date: Sat, 13 Oct 2018 05:10:26 +0100 [thread overview]
Message-ID: <20181013041026.GN32577@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20181011143814.14296-1-amir73il@gmail.com>
On Thu, Oct 11, 2018 at 05:38:14PM +0300, Amir Goldstein wrote:
> Some anon_bdev filesystems (e.g. overlayfs, ceph) don't have s_blocksize
> set. Returning zero from FIGETBSZ ioctl results in a Floating point
> exception from the e2fsprogs utility filefrag, which divides the size of
> the file with the value returned by FIGETBSZ.
>
> Fix the interface by returning -EINVAL for these filesystems.
>
> Fixes: d1d04ef8572b ("ovl: stack file ops")
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
> fs/ioctl.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/ioctl.c b/fs/ioctl.c
> index 2005529af560..0400297c8d72 100644
> --- a/fs/ioctl.c
> +++ b/fs/ioctl.c
> @@ -669,6 +669,9 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
> return ioctl_fiemap(filp, arg);
>
> case FIGETBSZ:
> + /* anon_bdev filesystems may not have a block size */
> + if (!inode->i_sb->s_blocksize)
> + return -EINVAL;
> return put_user(inode->i_sb->s_blocksize, argp);
Probably makes sense... Out of curiosity - what does the same utility do
when faced with -EINVAL here?
next prev parent reply other threads:[~2018-10-13 11:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-11 14:38 [PATCH v2] vfs: fix FIGETBSZ ioctl on an overlayfs file Amir Goldstein
2018-10-13 4:10 ` Al Viro [this message]
2018-10-13 7:33 ` Amir Goldstein
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181013041026.GN32577@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=amir73il@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).