[1/2] fs/fuse kio: backport immediate-write attribute handle

Submitted by Pavel Butsykin on Dec. 24, 2018, 3:58 p.m.

Details

Message ID 20181224155810.8814-2-pbutsykin@virtuozzo.com
State New
Series "backport immediate-write attribute for Fast-path"
Headers show

Commit Message

Pavel Butsykin Dec. 24, 2018, 3:58 p.m.
This patch provides support PCS_FATTR_IMMEDIATE_WRITE attribute for KIO module.

#VSTOR-19324

Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_cs.c         | 3 ++-
 fs/fuse/kio/pcs/pcs_prot_types.h | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/kio/pcs/pcs_cs.c b/fs/fuse/kio/pcs/pcs_cs.c
index 00cd1ae99850..1a2e64270b9e 100644
--- a/fs/fuse/kio/pcs/pcs_cs.c
+++ b/fs/fuse/kio/pcs/pcs_cs.c
@@ -515,7 +515,8 @@  void pcs_cs_submit(struct pcs_cs *cs, struct pcs_int_request *ireq)
 		ioh->hdr.type = PCS_CS_READ_REQ;
 		break;
 	case PCS_REQ_T_WRITE:
-		ioh->hdr.type = PCS_CS_WRITE_REQ;
+		ioh->hdr.type = (ireq->dentry->fileinfo.attr.attrib & PCS_FATTR_IMMEDIATE_WRITE) ?
+				PCS_CS_WRITE_SYNC_REQ : PCS_CS_WRITE_REQ;
 		ioh->hdr.len += ireq->iochunk.size;
 		break;
 	case PCS_REQ_T_WRITE_HOLE:
diff --git a/fs/fuse/kio/pcs/pcs_prot_types.h b/fs/fuse/kio/pcs/pcs_prot_types.h
index 9db4516824aa..bba1f1dc76e3 100644
--- a/fs/fuse/kio/pcs/pcs_prot_types.h
+++ b/fs/fuse/kio/pcs/pcs_prot_types.h
@@ -417,6 +417,9 @@  enum
 	/* Don't cache content on the client */
 	PCS_FATTR_NO_CLNT_CACHE = 0x10000000,
 
+	/* Disable delayed writes for files in the directory */
+	PCS_FATTR_IMMEDIATE_WRITE = 0x40000000,
+
 	/* The following attributes are being inherited from the parent directory */
 	PCS_FATTR_INHERITABLE_MASK = 0xff000000,
 };

Comments

Alexey Kuznetsov Dec. 24, 2018, 4:13 p.m.
Ack.

Please, look at fuse ioctls. We have to intercept and implement in
kernel those of them,
which deal with CSes. I.e. PCS_IOC_NOCSUMONREAD and PCS_IOC_NOWRITEDELAY.

And also we must prohibit PCS_IOC_INIT_KDIRECT .. PCS_IOC_GETMAP passed
by user. Now user can screw up kio_pcs using these ioctls.

On Mon, Dec 24, 2018 at 6:58 PM Pavel Butsykin <pbutsykin@virtuozzo.com> wrote:
>
> This patch provides support PCS_FATTR_IMMEDIATE_WRITE attribute for KIO module.
>
> #VSTOR-19324
>
> Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
> ---
>  fs/fuse/kio/pcs/pcs_cs.c         | 3 ++-
>  fs/fuse/kio/pcs/pcs_prot_types.h | 3 +++
>  2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/fs/fuse/kio/pcs/pcs_cs.c b/fs/fuse/kio/pcs/pcs_cs.c
> index 00cd1ae99850..1a2e64270b9e 100644
> --- a/fs/fuse/kio/pcs/pcs_cs.c
> +++ b/fs/fuse/kio/pcs/pcs_cs.c
> @@ -515,7 +515,8 @@ void pcs_cs_submit(struct pcs_cs *cs, struct pcs_int_request *ireq)
>                 ioh->hdr.type = PCS_CS_READ_REQ;
>                 break;
>         case PCS_REQ_T_WRITE:
> -               ioh->hdr.type = PCS_CS_WRITE_REQ;
> +               ioh->hdr.type = (ireq->dentry->fileinfo.attr.attrib & PCS_FATTR_IMMEDIATE_WRITE) ?
> +                               PCS_CS_WRITE_SYNC_REQ : PCS_CS_WRITE_REQ;
>                 ioh->hdr.len += ireq->iochunk.size;
>                 break;
>         case PCS_REQ_T_WRITE_HOLE:
> diff --git a/fs/fuse/kio/pcs/pcs_prot_types.h b/fs/fuse/kio/pcs/pcs_prot_types.h
> index 9db4516824aa..bba1f1dc76e3 100644
> --- a/fs/fuse/kio/pcs/pcs_prot_types.h
> +++ b/fs/fuse/kio/pcs/pcs_prot_types.h
> @@ -417,6 +417,9 @@ enum
>         /* Don't cache content on the client */
>         PCS_FATTR_NO_CLNT_CACHE = 0x10000000,
>
> +       /* Disable delayed writes for files in the directory */
> +       PCS_FATTR_IMMEDIATE_WRITE = 0x40000000,
> +
>         /* The following attributes are being inherited from the parent directory */
>         PCS_FATTR_INHERITABLE_MASK = 0xff000000,
>  };
> --
> 2.15.1
>