Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vjs px fuse ioctl abort ios v2.6.0 #158

Open
wants to merge 3 commits into
base: v2.6.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,15 @@ __acquires(fc->lock)
end_requests(fc, &fc->processing);
}

void fuse_abort_all_ios(struct fuse_conn *fc)
{
printk(KERN_INFO "PXD_IOCTL : Aborting all requests...");
spin_lock(&fc->lock);
fc->allow_disconnected = 0;
fuse_end_queued_requests(fc);
spin_unlock(&fc->lock);
}

static void fuse_conn_free_allocs(struct fuse_conn *fc)
{
if (fc->per_cpu_ids)
Expand Down
2 changes: 2 additions & 0 deletions fuse_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ struct fuse_conn *fuse_conn_get(struct fuse_conn *fc);

void fuse_restart_requests(struct fuse_conn *fc);

void fuse_abort_all_ios(struct fuse_conn *fc);

ssize_t pxd_add(struct fuse_conn *fc, struct pxd_add_ext_out *add);
ssize_t pxd_remove(struct fuse_conn *fc, struct pxd_remove_out *remove);
ssize_t pxd_update_size(struct fuse_conn *fc, struct pxd_update_size *update_size);
Expand Down
21 changes: 21 additions & 0 deletions pxd.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,25 @@ static long pxd_ioctl_resize(struct file *file, void __user *argp)
return ret;
}

static long pxd_ioctl_abort_ios(struct file *file, void __user *argp)
{
struct pxd_context *ctx = NULL;
struct pxd_abort_ios abort_ios_args;
long ret = 0;

if (copy_from_user(&abort_ios_args, argp, sizeof(abort_ios_args))) {
return -EFAULT;
}

ctx = &pxd_contexts[abort_ios_args.context_id];
if (!ctx || ctx->id >= pxd_num_contexts_exported) {
return -EFAULT;
}

fuse_abort_all_ios(&ctx->fc);
return ret;
}

static long pxd_control_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
void __user *argp = (void __user *)arg;
Expand Down Expand Up @@ -168,6 +187,8 @@ static long pxd_control_ioctl(struct file *file, unsigned int cmd, unsigned long
break;
case PXD_IOC_RESIZE:
return pxd_ioctl_resize(file, (void __user *)arg);
case PXD_IOC_ABORT_IOS:
return pxd_ioctl_abort_ios(file, (void __user *)arg);
default:
break;
}
Expand Down
8 changes: 8 additions & 0 deletions pxd.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#define PXD_IOC_GET_VERSION _IO(PXD_IOCTL_MAGIC, 2) /* 0x505802 */
#define PXD_IOC_INIT _IO(PXD_IOCTL_MAGIC, 3) /* 0x505803 */
#define PXD_IOC_RESIZE _IO(PXD_IOCTL_MAGIC, 4) /* 0x505804 */
#define PXD_IOC_ABORT_IOS _IO(PXD_IOCTL_MAGIC, 9) /* 0x505809 */

#define PXD_MAX_DEVICES 512 /**< maximum number of devices supported */
#define PXD_MAX_IO (1024*1024) /**< maximum io size in bytes */
Expand Down Expand Up @@ -155,6 +156,13 @@ struct pxd_update_size {
int context_id;
};

/*
* PXD_ABORT_IOS ioctl from user space
*/
struct pxd_abort_ios {
int context_id;
};

/**
* PXD_SET_FASTPATH request from user space
*/
Expand Down