linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Carlos Maiolino <cmaiolino@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, hch@lst.de, sandeen@redhat.com,
	david@fromorbit.com
Subject: Re: [PATCH 2/2] Use fiemap internal infra-structure to handle FIBMAP
Date: Wed, 5 Sep 2018 07:31:47 -0700	[thread overview]
Message-ID: <20180905143147.GC3729@bombadil.infradead.org> (raw)
In-Reply-To: <20180905135748.30098-3-cmaiolino@redhat.com>

On Wed, Sep 05, 2018 at 03:57:48PM +0200, Carlos Maiolino wrote:
> +	if (inode->i_op->fiemap) {
> +		fextent.fe_logical = 0;
> +		fextent.fe_physical = 0;
> +		fieinfo.fi_flags = FIEMAP_KERNEL_FIBMAP;
> +		fieinfo.fi_extents_max = 1;
> +		fieinfo.fi_extents_start = (__force struct fiemap_extent __user *) &fextent;
> +
> +		error = inode->i_op->fiemap(inode, &fieinfo, start, 1);

You'd have to play games with set_fs() and friends if you want to do this.
The fiemap implementation is going to access fi_extents_start with a call
to copy_to_user() and for machines with a 4G/4G split, you need that
address to be interpreted as kernel space, not user space.

See fiemap_fill_next_extent():

        struct fiemap_extent __user *dest = fieinfo->fi_extents_start;
...
        if (copy_to_user(dest, &extent, sizeof(extent)))
                return -EFAULT;

  reply	other threads:[~2018-09-05 19:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-05 13:57 [PATCH RFC 0/2] ->bmap interface retirement Carlos Maiolino
2018-09-05 13:57 ` [PATCH 1/2] fs: Replace direct ->bmap calls by bmap() Carlos Maiolino
2018-09-05 14:23   ` Eric Sandeen
2018-09-05 18:55     ` Christoph Hellwig
2018-09-06  8:04       ` Carlos Maiolino
2018-09-06  8:03     ` Carlos Maiolino
2018-09-05 13:57 ` [PATCH 2/2] Use fiemap internal infra-structure to handle FIBMAP Carlos Maiolino
2018-09-05 14:31   ` Matthew Wilcox [this message]
2018-09-05 18:56     ` Christoph Hellwig
2018-09-06  8:31       ` Carlos Maiolino
2018-09-10  7:50         ` Christoph Hellwig
2018-09-10 10:31           ` Carlos Maiolino
2018-09-26 13:34           ` Carlos Maiolino
2018-09-06  8:18     ` Carlos Maiolino
2018-09-05 14:40   ` Eric Sandeen
2018-09-06  8:12     ` Carlos Maiolino
2018-09-06 15:53       ` Eric Sandeen

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=20180905143147.GC3729@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=cmaiolino@redhat.com \
    --cc=david@fromorbit.com \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --subject='Re: [PATCH 2/2] Use fiemap internal infra-structure to handle FIBMAP' \
    /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

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