@@ -503,7 +503,8 @@ static int cuse_channel_open(struct inode *inode, struct file *file)
* Limit the cuse channel to requests that can
* be represented in file->f_cred->user_ns.
*/
- fuse_conn_init(&cc->fc, file->f_cred->user_ns, &fuse_dev_fiq_ops, NULL);
+ fuse_conn_init(&cc->fc, file->f_cred->user_ns, NULL, &fuse_dev_fiq_ops,
+ NULL);
fud = fuse_dev_alloc(&cc->fc);
if (!fud) {
@@ -803,6 +803,9 @@ struct fuse_conn {
/** List of device instances belonging to this connection */
struct list_head devices;
+
+ /** DAX device, non-NULL if DAX is supported */
+ struct dax_device *dax_dev;
};
static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb)
@@ -1025,7 +1028,8 @@ struct fuse_conn *fuse_conn_get(struct fuse_conn *fc);
* Initialize fuse_conn
*/
void fuse_conn_init(struct fuse_conn *fc, struct user_namespace *user_ns,
- const struct fuse_iqueue_ops *fiq_ops, void *fiq_priv);
+ struct dax_device *dax_dev,
+ const struct fuse_iqueue_ops *fiq_ops, void *fiq_priv);
/**
* Release reference to fuse_conn
@@ -1045,12 +1049,14 @@ int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev,
* Fill in superblock and initialize fuse connection
* @sb: partially-initialized superblock to fill in
* @mount_data: mount parameters
+ * @dax_dev: DAX device, may be NULL
* @fiq_ops: fuse input queue operations
* @fiq_priv: device-specific state for fuse_iqueue
* @fudptr: fuse_dev pointer to fill in, should contain NULL on entry
*/
int fuse_fill_super_common(struct super_block *sb,
struct fuse_mount_data *mount_data,
+ struct dax_device *dax_dev,
const struct fuse_iqueue_ops *fiq_ops,
void *fiq_priv,
void **fudptr);
@@ -600,7 +600,8 @@ static void fuse_pqueue_init(struct fuse_pqueue *fpq)
}
void fuse_conn_init(struct fuse_conn *fc, struct user_namespace *user_ns,
- const struct fuse_iqueue_ops *fiq_ops, void *fiq_priv)
+ struct dax_device *dax_dev,
+ const struct fuse_iqueue_ops *fiq_ops, void *fiq_priv)
{
memset(fc, 0, sizeof(*fc));
spin_lock_init(&fc->lock);
@@ -625,6 +626,7 @@ void fuse_conn_init(struct fuse_conn *fc, struct user_namespace *user_ns,
fc->attr_version = 1;
get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key));
fc->pid_ns = get_pid_ns(task_active_pid_ns(current));
+ fc->dax_dev = dax_dev;
fc->user_ns = get_user_ns(user_ns);
}
EXPORT_SYMBOL_GPL(fuse_conn_init);
@@ -1072,6 +1074,7 @@ EXPORT_SYMBOL_GPL(fuse_dev_free);
int fuse_fill_super_common(struct super_block *sb,
struct fuse_mount_data *mount_data,
+ struct dax_device *dax_dev,
const struct fuse_iqueue_ops *fiq_ops,
void *fiq_priv,
void **fudptr)
@@ -1122,7 +1125,7 @@ int fuse_fill_super_common(struct super_block *sb,
if (!fc)
goto err;
- fuse_conn_init(fc, sb->s_user_ns, fiq_ops, fiq_priv);
+ fuse_conn_init(fc, sb->s_user_ns, dax_dev, fiq_ops, fiq_priv);
fc->release = fuse_free_conn;
fud = fuse_dev_alloc(fc);
@@ -1233,7 +1236,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
(file->f_cred->user_ns != sb->s_user_ns))
goto err_fput;
- err = fuse_fill_super_common(sb, &d, &fuse_dev_fiq_ops, NULL,
+ err = fuse_fill_super_common(sb, &d, NULL, &fuse_dev_fiq_ops, NULL,
&file->private_data);
err_fput:
fput(file);
@@ -844,7 +844,8 @@ static int virtio_fs_fill_super(struct super_block *sb, void *data,
/* TODO this sends FUSE_INIT and could cause hiprio or notifications
* virtqueue races since they haven't been set up yet!
*/
- err = fuse_fill_super_common(sb, &d, &virtio_fs_fiq_ops, fs,
+ err = fuse_fill_super_common(sb, &d, fs->dax_dev,
+ &virtio_fs_fiq_ops, fs,
(void **)&fs->vqs[2].fud);
if (err < 0)
goto err_fud;