Super simple flex file server
Subsystems (3)
v5 cover Super simple flex file server
Hi Bruce,
The following patches make a flex file server in which the mds and the ds are the same machine. And the same inode services both metadata and data.
v5:
- Fix the stripe unit size as reported by Tigran
v4:
- The addr len in a netaddr is INET6_ADDRSTRLEN + 8
v3:
- Extra word help for selecting NFSD_FLEXFILELAYOUT
- Do not allow WRITE permissions on an IOMODE_READ segment
v2:
- Remove patch 2: nfsd: Can leak pnfs_block_extent on error
- Consolidate 3rd and 4th patch
- Fix the rsize and wsize to come out of the rqstp as per Jeff's review comments
- Sort the available layout types such that scsi beats block which beats flex file
- Address the points brought up by Christoph in his review
These patches are also in my flex_server branch atgit://git.linux-nfs.org/projects/loghyr/linux-nfs.git
Thanks,
Tom
Tom Haynes (2):
nfsd: flex file device id encoding will need the server address
nfsd: Add a super simple flex file server
fs/nfsd/Kconfig | 17 ++++++ fs/nfsd/Makefile | 1 + fs/nfsd/blocklayout.c | 2 + fs/nfsd/flexfilelayout.c | 133 ++++++++++++++++++++++++++++++++++++++++++++ fs/nfsd/flexfilelayoutxdr.c | 115 ++++++++++++++++++++++++++++++++++++++ fs/nfsd/flexfilelayoutxdr.h | 49 ++++++++++++++++ fs/nfsd/nfs4layouts.c | 12 +++- fs/nfsd/nfs4proc.c | 2 +- fs/nfsd/pnfs.h | 4 ++ 9 files changed, 333 insertions(+), 2 deletions(-) create mode 100644 fs/nfsd/flexfilelayout.c create mode 100644 fs/nfsd/flexfilelayoutxdr.c create mode 100644 fs/nfsd/flexfilelayoutxdr.h
Signature · 1 line
1.8.3.1
PATCH v5 1/2 nfsd: flex file device id encoding will need the server address
--- fs/nfsd/blocklayout.c | 2 ++ fs/nfsd/nfs4proc.c | 2 +- fs/nfsd/pnfs.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-)
fs/nfsd/blocklayout.c +2 -0
@@ -162,6 +162,7 @@ nfsd4_block_get_device_info_simple(struct super_block *sb,static __be32 nfsd4_block_proc_getdeviceinfo (struct super_block *sb, +struct svc_rqst *rqstp,struct nfs4_client *clp,struct nfsd4_getdeviceinfo *gdp) {
@@ -354,6 +355,7 @@ nfsd4_block_get_device_info_scsi(struct super_block *sb,static __be32 nfsd4_scsi_proc_getdeviceinfo (struct super_block *sb, +struct svc_rqst *rqstp,struct nfs4_client *clp,struct nfsd4_getdeviceinfo *gdp) {
fs/nfsd/nfs4proc.c +1 -1
@@ -1270,7 +1270,7 @@ nfsd4_getdeviceinfo(struct svc_rqst *rqstp, nfserr = nfs_ok;if (gdp->gd_maxcount !=0 ) { nfserr = ops->proc_getdeviceinfo (exp->ex_path.mnt->mnt_sb, - cstate->session->se_client, gdp); + rqstp, cstate->session->se_client, gdp); } gdp->gd_notify_types &= ops->notify_types;
fs/nfsd/pnfs.h +1 -0
@@ -21,6 +21,7 @@ struct nfsd4_layout_ops {u32 notify_types;__be32 (*proc_getdeviceinfo)(struct super_block *sb, +struct svc_rqst *rqstp,struct nfs4_client *clp,struct nfsd4_getdeviceinfo *gdevp); __be32 (*encode_getdeviceinfo)(struct xdr_stream *xdr,
Signature · 1 line
1.8.3.1
PATCH v5 2/2 nfsd: Add a super simple flex file server
In reply to Tom HaynesHave a simple flex file server where the mds (NFSv4.1 or NFSv4.2) is also the ds (NFSv3). I.e., the metadata and the data file are the exact same file.
This will allow testing of the flex file client.
Simply add the "pnfs" export option to your export in /etc/exports and mount from a client that supports flex files.
--- fs/nfsd/Kconfig | 17 ++++++ fs/nfsd/Makefile | 1 + fs/nfsd/flexfilelayout.c | 133 ++++++++++++++++++++++++++++++++++++++++++++ fs/nfsd/flexfilelayoutxdr.c | 115 ++++++++++++++++++++++++++++++++++++++ fs/nfsd/flexfilelayoutxdr.h | 49 ++++++++++++++++ fs/nfsd/nfs4layouts.c | 12 +++- fs/nfsd/pnfs.h | 3 + 7 files changed, 329 insertions(+), 1 deletion(-) create mode 100644 fs/nfsd/flexfilelayout.c create mode 100644 fs/nfsd/flexfilelayoutxdr.c create mode 100644 fs/nfsd/flexfilelayoutxdr.h
fs/nfsd/Kconfig +17 -0
@@ -111,6 +111,23 @@ config NFSD_SCSILAYOUT If unsure, say N. +config NFSD_FLEXFILELAYOUT + bool "NFSv4.1 server support for pNFS Flex File layouts" + depends on NFSD_V4 + select NFSD_PNFS + help + This option enables support for the exporting pNFS Flex File + layouts in the kernel's NFS server. The pNFS Flex File layout + enables NFS clients to directly perform I/O to NFSv3 devices + accesible to both the server and the clients. See + draft-ietf-nfsv4-flex-files for more details. + + Warning, this server implements the bare minimum functionality + to be a flex file server - it is for testing the client, + not for use in production. + + If unsure, say N. + config NFSD_V4_SECURITY_LABEL bool "Provide Security Label support for NFSv4 server" depends on NFSD_V4 && SECURITY
fs/nfsd/Makefile +1 -0
@@ -20,3 +20,4 @@ nfsd-$(CONFIG_NFSD_V4) += nfs4proc.o nfs4xdr.o nfs4state.o nfs4idmap.o \ nfsd-$(CONFIG_NFSD_PNFS) += nfs4layouts.o nfsd-$(CONFIG_NFSD_BLOCKLAYOUT) += blocklayout.o blocklayoutxdr.o nfsd-$(CONFIG_NFSD_SCSILAYOUT) += blocklayout.o blocklayoutxdr.o +nfsd-$(CONFIG_NFSD_FLEXFILELAYOUT) += flexfilelayout.o flexfilelayoutxdr.o
fs/nfsd/flexfilelayout.c new file +133 -0
133 lines not on this page · raw message
fs/nfsd/flexfilelayoutxdr.c new file +115 -0
115 lines not on this page · raw message
fs/nfsd/flexfilelayoutxdr.h new file +49 -0
49 lines not on this page · raw message
fs/nfsd/nfs4layouts.c +11 -1
@@ -27,6 +27,9 @@ static const struct nfsd4_callback_ops nfsd4_cb_layout_ops;static const struct lock_manager_operations nfsd4_layouts_lm_ops;const struct nfsd4_layout_ops *nfsd4_layout_ops[LAYOUT_TYPE_MAX ] = { +#ifdef CONFIG_NFSD_FLEXFILELAYOUT + [LAYOUT_FLEX_FILES ] = &ff_layout_ops, +#endif #ifdef CONFIG_NFSD_BLOCKLAYOUT [LAYOUT_BLOCK_VOLUME ] = &bl_layout_ops, #endif
@@ -122,17 +125,24 @@ nfsd4_set_deviceid(struct nfsd4_deviceid *id, const struct svc_fh *fhp,void nfsd4_setup_layout_type (struct svc_export *exp) { +#if defined(CONFIG_NFSD_BLOCKLAYOUT ) || defined(CONFIG_NFSD_SCSILAYOUT )struct super_block *sb = exp->ex_path.mnt->mnt_sb; +#endif if (!(exp->ex_flags &NFSEXP_PNFS ))return ;/* -* Check if the file system supports exporting a block-like layout. +* If flex file is configured, use it by default. Otherwise +* check if the file system supports exporting a block-like layout. * If the block device supports reservations prefer the SCSI layout, * otherwise advertise the block layout. */ +#ifdef CONFIG_NFSD_FLEXFILELAYOUT + exp->ex_layout_type =LAYOUT_FLEX_FILES ; +#endif #ifdef CONFIG_NFSD_BLOCKLAYOUT +/* overwrite flex file layout selection if needed */ if (sb->s_export_op->get_uuid && sb->s_export_op->map_blocks && sb->s_export_op->commit_blocks)
fs/nfsd/pnfs.h +3 -0
@@ -45,6 +45,9 @@ extern const struct nfsd4_layout_ops bl_layout_ops;#ifdef CONFIG_NFSD_SCSILAYOUT extern const struct nfsd4_layout_ops scsi_layout_ops;#endif +#ifdef CONFIG_NFSD_FLEXFILELAYOUT +extern const struct nfsd4_layout_ops ff_layout_ops; +#endif __be32 nfsd4_preprocess_layout_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, stateid_t *stateid,
Signature · 1 line
1.8.3.1
Quoted 5 lines · Tom Haynes
Hi Bruce,
The following patches make a flex file server in which the mds and the ds are the same machine. And the same inode services both metadata and data.
Thanks, applying for 4.8.
--b.
Quoted 46 lines
v5:
- Fix the stripe unit size as reported by Tigranv4:
- The addr len in a netaddr isINET6_ADDRSTRLEN+ 8v3:
- Extra word help for selectingNFSD_FLEXFILELAYOUT
- Do not allow WRITE permissions on anIOMODE_READsegmentv2:
- Remove patch 2: nfsd: Can leakpnfs_block_extenton error
- Consolidate 3rd and 4th patch
- Fix the rsize and wsize to come out of the rqstp as per Jeff's review comments
- Sort the available layout types such that scsi beats block which beats flex file
- Address the points brought up by Christoph in his reviewThese patches are also in my
flex_serverbranch atgit://git.linux-nfs.org/projects/loghyr/linux-nfs.gitThanks,
TomTom Haynes (2):
nfsd: flex file device id encoding will need the server address
nfsd: Add a super simple flex file serverfs/nfsd/Kconfig | 17 ++++++ fs/nfsd/Makefile | 1 + fs/nfsd/blocklayout.c | 2 + fs/nfsd/flexfilelayout.c | 133 ++++++++++++++++++++++++++++++++++++++++++++ fs/nfsd/flexfilelayoutxdr.c | 115 ++++++++++++++++++++++++++++++++++++++ fs/nfsd/flexfilelayoutxdr.h | 49 ++++++++++++++++ fs/nfsd/nfs4layouts.c | 12 +++- fs/nfsd/nfs4proc.c | 2 +- fs/nfsd/pnfs.h | 4 ++ 9 files changed, 333 insertions(+), 2 deletions(-) create mode 100644 fs/nfsd/flexfilelayout.c create mode 100644 fs/nfsd/flexfilelayoutxdr.c create mode 100644 fs/nfsd/flexfilelayoutxdr.hSignature · 1 line
1.8.3.1