>                            If it is going to be a significant
> performance hit, maybe it would be better to have an option that can
> turn this on for all syscalls? That way when debugging a fuse
> file-system, the syscalls won't deadlock, but it won't slow things
> down for the general user. 

On Linux the only syscalls that can block for a FUSE file-system
are ones that implement the kernel's VFS layer (Virtual File System),
which uses a struct of function pointers for each relevant syscall.
So, just find that initialized struct in the Linux kernel sources,
and there is the list of syscalls that can block.  From linux/fs/fuse/file.c:
-----
static const struct file_operations fuse_file_operations = {
        .llseek         = fuse_file_llseek,
        .read           = do_sync_read,
        .aio_read       = fuse_file_aio_read,
        .write          = do_sync_write,
        .aio_write      = fuse_file_aio_write,
        .mmap           = fuse_file_mmap,
        .open           = fuse_open,
        .flush          = fuse_flush,
        .release        = fuse_release,   ### last 'close'
        .fsync          = fuse_fsync,
        .lock           = fuse_file_lock,
        .flock          = fuse_file_flock,
        .splice_read    = generic_file_splice_read,
        .unlocked_ioctl = fuse_file_ioctl,
        .compat_ioctl   = fuse_file_compat_ioctl,
        .poll           = fuse_file_poll,
};

static const struct file_operations fuse_direct_io_file_operations = {
        .llseek         = fuse_file_llseek,
        .read           = fuse_direct_read,
        .write          = fuse_direct_write,
        .mmap           = fuse_direct_mmap,
        .open           = fuse_open,
        .flush          = fuse_flush,
        .release        = fuse_release,
        .fsync          = fuse_fsync,
        .lock           = fuse_file_lock,
        .flock          = fuse_file_flock,
        .unlocked_ioctl = fuse_file_ioctl,
        .compat_ioctl   = fuse_file_compat_ioctl,
        .poll           = fuse_file_poll,
        /* no splice_read */
};
-----


Of course
        *flags |= SfMayBlock;
could be unified to use a global variable that zero except when
set by a command-line switch for FUSE:
        *flags |= SfMayBlock_var;


A complimentary option that also might work is
        *flags |= ((1 < n_threads) ? SfMayBlock : 0);
if the problem never occurs unless there are multiple threads already.

-- 

------------------------------------------------------------------------------
Magic Quadrant for Content-Aware Data Loss Prevention
Research study explores the data loss prevention market. Includes in-depth
analysis on the changes within the DLP market, and the criteria used to
evaluate the strengths and weaknesses of these DLP solutions.
http://www.accelacomm.com/jaw/sfnl/114/51385063/
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to