[Devel] [PATCH RH7] ioctl: use sb from file inode when make FIGETBSZ check

Kirill Tkhai ktkhai at virtuozzo.com
Mon Feb 13 04:56:08 PST 2017


On 09.02.2017 19:11, Pavel Tikhomirov wrote:
> On overlayfs blocksize on super_block is not set, and FIGETBSZ
> returns blocksize of an underlying fs, so we also need to do our
> check for underlying sb.
> 
> Rebase commit a3ee37c28983 ("rh7: import RHEL7 kernel-3.10.0-514.el7")
> brought ms commit 4bacc9c9234c ("overlayfs: Make f_path always point
> to the overlay and f_inode to the underlay"), so now super block
> filp->f_path.dentry->d_inode->i_sb is of overlayfs, not of the
> underlying fs as was before.
> 
> Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
> ---
>  fs/ioctl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ioctl.c b/fs/ioctl.c
> index f0d0cf9..ae33299 100644
> --- a/fs/ioctl.c
> +++ b/fs/ioctl.c
> @@ -590,7 +590,7 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
>  
>  	case FIGETBSZ:
>  	{
> -		struct super_block *sb = filp->f_path.dentry->d_inode->i_sb;
> +		struct super_block *sb = inode->i_sb;
>  		if (sb->s_blocksize == 1ul << sb->s_blocksize_bits)
>  			return put_user(inode->i_sb->s_blocksize, argp);

I think, we do not need this check at all. See [PATCH] fs: Revert "ms: FIGETBSZ ioctl safety checks", I've sent.

>  		/* fail through */
> 


More information about the Devel mailing list