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

px_fuse ioctl to abort ios #156

Open
wants to merge 2 commits into
base: v2.5.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 @@ -1079,6 +1079,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...");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the context and usage of this function, it should be in pxd.c alongside pxd_abort_context()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

end_queued_requests function is static and defined in dev.c, so I had to create another function in the same file to export it.

in v2.5.0, we have pxd_timeout(), which calls fuse_abort_conn() in dev.c, that in turn calls end_queued_requests()

I will leave this as is.

spin_lock(&fc->lock);
fc->allow_disconnected = 0;
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 @@ -218,6 +218,8 @@ void fuse_conn_put(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_out *update_size);
Expand Down
22 changes: 22 additions & 0 deletions pxd.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,26 @@ static long pxd_ioctl_init(struct file *file, void __user *argp)
return pxd_read_init(&ctx->fc, &iter);
}


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 @@ -142,6 +162,8 @@ static long pxd_control_ioctl(struct file *file, unsigned int cmd, unsigned long
case PXD_IOC_INIT:
status = pxd_ioctl_init(file, argp);
break;
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 @@ -28,6 +28,7 @@
#define PXD_IOC_DUMP_FC_INFO _IO(PXD_IOCTL_MAGIC, 1) /* 0x505801 */
#define PXD_IOC_GET_VERSION _IO(PXD_IOCTL_MAGIC, 2) /* 0x505802 */
#define PXD_IOC_INIT _IO(PXD_IOCTL_MAGIC, 3) /* 0x505803 */
#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 @@ -145,6 +146,13 @@ struct pxd_read_data_out {
uint32_t offset; /**< offset into data */
};

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

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