Re: [PATCH 6/6] fuse: convert direct IO paths to use FOLL_PIN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/1/22 01:41, Miklos Szeredi wrote:
...
This might work for O_DIRECT, but fuse has this mode of operation
which turns normal "buffered" I/O into direct I/O.  And that in turn
will break execve of such files.

So AFAICS we need to keep kvec handing in some way.


Thanks for bringing that up! Do you have any hints for me, to jump start

How about just leaving that special code in place?   It bypasses page
refs and directly copies to the kernel buffer, so it should not have
any affect on the user page code.


Good idea, I'll go that direction.

a deeper look? And especially, sample programs that exercise this?

Here's one:

This is really helpful, exactly what I was looking for.


thanks!
--
John Hubbard
NVIDIA

# uncomment as appropriate:
#sudo dnf install fuse3-devel
#sudo apt install libfuse3-dev

cat <<EOF > fuse-dio-exec.c
#define FUSE_USE_VERSION 31
#include <fuse.h>
#include <errno.h>
#include <unistd.h>

static const char *filename = "/bin/true";

static int test_getattr(const char *path, struct stat *stbuf,
              struct fuse_file_info *fi)
{
     return lstat(filename, stbuf) == -1 ? -errno : 0;
}

static int test_open(const char *path, struct fuse_file_info *fi)
{
     int res;

     res = open(filename, fi->flags);
     if (res == -1)
         return -errno;

     fi->fh = res;
     fi->direct_io = 1;
     return 0;
}

static int test_read(const char *path, char *buf, size_t size, off_t offset,
               struct fuse_file_info *fi)
{
     int res = pread(fi->fh, buf, size, offset);
     return res == -1 ? -errno : res;
}

static int test_release(const char *path, struct fuse_file_info *fi)
{
     close(fi->fh);
     return 0;
}

static const struct fuse_operations test_oper = {
     .getattr    = test_getattr,
     .open        = test_open,
     .release    = test_release,
     .read        = test_read,
};

int main(int argc, char *argv[])
{
     return fuse_main(argc, argv, &test_oper, NULL);
}
EOF

gcc -W fuse-dio-exec.c `pkg-config fuse3 --cflags --libs` -o fuse-dio-exec
touch /tmp/true

#run test:
./fuse-dio-exec /tmp/true
/tmp/true
umount /tmp/true




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux