nfsd: do not allow exporting of special kernel filesystems
Subsystems (3)
PATCH 1/1 nfsd: do not allow exporting of special kernel filesystems
pidfs and nsfs recently gained support for encode/decode of file handles via name_to_handle_at(2)/opan_by_handle_at(2).
These special kernel filesystems have custom ->open() and ->permission() export methods, which nfsd does not respect and it was never meant to be used for exporting those filesystems by nfsd.
Therefore, do not allow nfsd to export filesystems with custom ->open() or ->permission() methods.
--- fs/nfsd/export.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
Christian,
I had enough of the stable file handles discussion [1].
This patch which I already suggested [2] on week ago, states a justified technical reason why pidfs and nsfs should not be exported by nfsd, so let's use this technical reasoning and stop the philosophic discussions about what is a stable file handle is please.
Regarding cgroupfs, we can either deal with it later or not - it is not a clear but as pidfs and nsfs which absolutely should be fixed retroactively in stable kernels.
If you think that cgroupfs could benefit from "exhaustive" file handles [3] then we can implement open_by_handle_at(FD_CGROUPFS_ROOT, ... and that would classify cgroupfs the same as pidfs and nsfs.
Thanks,
Amir.
[1] https://lore.kernel.org/linux-fsdevel/[email protected]/
[2] https://lore.kernel.org/linux-fsdevel/CAOQ4uxhkaGFtQRzTj2xaf2GJucoAY5CGiyUjB=8YA2zTbOtFvw@mail.gmail.com/
[3] https://lore.kernel.org/linux-fsdevel/[email protected]/
fs/nfsd/export.c +13 -8
@@ -405,6 +405,7 @@ static struct svc_export *svc_export_lookup(struct svc_export *);static int check_export (const struct path *path,int *flags,unsigned char *uuid) {struct inode *inode =d_inode (path->dentry); +const struct export_operations *nop = inode->i_sb->s_export_op;/* * We currently export only dirs, regular files, and (for v4
@@ -422,13 +423,12 @@ static int check_export(const struct path *path, int *flags, unsigned char *uuidif (*flags &NFSEXP_V4ROOT ) *flags |=NFSEXP_READONLY ; -/* There are two requirements on a filesystem to be exportable. -* 1: We must be able to identify the filesystem from a number. -* either a device number (so FS_REQUIRES_DEV needed) -* or an FSID number (so NFSEXP_FSID or ->uuid is needed). -* 2: We must be able to find an inode from a filehandle. -* This means that s_export_op must be set. -* 3: We must not currently be on an idmapped mount. +/* +* The requirements for a filesystem to be exportable: +* 1. The filehandle must identify a filesystem by number +* 2. The filehandle must uniquely identify an inode +* 3. The filesystem must not have custom filehandle open/perm methods +* 4. The requested file must not reside on an idmapped mount */ if (!(inode->i_sb->s_type->fs_flags & FS_REQUIRES_DEV) && !(*flags & NFSEXP_FSID) &&
@@ -437,11 +437,16 @@ static int check_export(const struct path *path, int *flags, unsigned char *uuidreturn -EINVAL ; } -if (!exportfs_can_decode_fh (inode->i_sb->s_export_op)) { +if (!exportfs_can_decode_fh (nop)) {dprintk ("exp_export: export of invalid fs type.\n" );return -EINVAL ; } +if (nop->open || nop->permission) { +dprintk ("exp_export: export of non-standard fs type.\n" ); +return -EINVAL ; + } +if (is_idmapped_mnt (path->mnt)) {dprintk ("exp_export: export of idmapped mounts not yet supported.\n" );return -EINVAL ;
Signature · 1 line
2.52.0
[cc the correct email address for Neil]
Quoted 95 lines · Amir Goldstein
pidfs and nsfs recently gained support for encode/decode of file handles via name_to_handle_at(2)/opan_by_handle_at(2).
These special kernel filesystems have custom ->open() and ->permission() export methods, which nfsd does not respect and it was never meant to be used for exporting those filesystems by nfsd.
Therefore, do not allow nfsd to export filesystems with custom ->open() or ->permission() methods.
Fixes b3caba8f7a34a ("pidfs: implement file handle support")Fixes 5222470b2fbb3 ("nsfs: support file handles")Signed-off-by Amir Goldstein <[email protected]>--- fs/nfsd/export.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)Christian,
I had enough of the stable file handles discussion [1].
This patch which I already suggested [2] on week ago, states a justified technical reason why pidfs and nsfs should not be exported by nfsd, so let's use this technical reasoning and stop the philosophic discussions about what is a stable file handle is please.
Regarding cgroupfs, we can either deal with it later or not - it is not a clear but as pidfs and nsfs which absolutely should be fixed retroactively in stable kernels.
If you think that cgroupfs could benefit from "exhaustive" file handles [3] then we can implement open_by_handle_at(FD_CGROUPFS_ROOT, ... and that would classify cgroupfs the same as pidfs and nsfs.
Thanks,
Amir.[1] https://lore.kernel.org/linux-fsdevel/[email protected]/
[2] https://lore.kernel.org/linux-fsdevel/CAOQ4uxhkaGFtQRzTj2xaf2GJucoAY5CGiyUjB=8YA2zTbOtFvw@mail.gmail.com/
[3] https://lore.kernel.org/linux-fsdevel/[email protected]/fs/nfsd/export.c +13
-9@@ -405,6 +405,7 @@ static struct svc_export *svc_export_lookup(struct svc_export *);static int check_export (const struct path *path,int *flags,unsigned char *uuid) {struct inode *inode =d_inode (path->dentry); +const struct export_operations *nop = inode->i_sb->s_export_op;/* * We currently export only dirs, regular files, and (for v4 @@ -422,13 +423,12 @@ static int check_export(const struct path *path, int *flags, unsigned char *uuidif (*flags &NFSEXP_V4ROOT ) *flags |=NFSEXP_READONLY ; -/* There are two requirements on a filesystem to be exportable. -* 1: We must be able to identify the filesystem from a number. -* either a device number (so FS_REQUIRES_DEV needed) -* or an FSID number (so NFSEXP_FSID or ->uuid is needed). -* 2: We must be able to find an inode from a filehandle. -* This means that s_export_op must be set. -* 3: We must not currently be on an idmapped mount. +/* +* The requirements for a filesystem to be exportable: +* 1. The filehandle must identify a filesystem by number +* 2. The filehandle must uniquely identify an inode +* 3. The filesystem must not have custom filehandle open/perm methods +* 4. The requested file must not reside on an idmapped mount */ if (!(inode->i_sb->s_type->fs_flags & FS_REQUIRES_DEV) && !(*flags & NFSEXP_FSID) &&@@ -437,11 +437,16 @@ static int check_export(const struct path *path, int *flags, unsigned char *uuidreturn -EINVAL ; } -if (!exportfs_can_decode_fh (inode->i_sb->s_export_op)) { +if (!exportfs_can_decode_fh (nop)) {dprintk ("exp_export: export of invalid fs type.\n" );return -EINVAL ; } +if (nop->open || nop->permission) { +dprintk ("exp_export: export of non-standard fs type.\n" ); +return -EINVAL ; + } +if (is_idmapped_mnt (path->mnt)) {dprintk ("exp_export: export of idmapped mounts not yet supported.\n" );return -EINVAL ; --2.52.0
Quoted 78 lines · Amir Goldstein
pidfs and nsfs recently gained support for encode/decode of file handles via name_to_handle_at(2)/opan_by_handle_at(2).
These special kernel filesystems have custom ->open() and ->permission() export methods, which nfsd does not respect and it was never meant to be used for exporting those filesystems by nfsd.
Therefore, do not allow nfsd to export filesystems with custom ->open() or ->permission() methods.
Fixes b3caba8f7a34a ("pidfs: implement file handle support")Fixes 5222470b2fbb3 ("nsfs: support file handles")Signed-off-by Amir Goldstein <[email protected]>--- fs/nfsd/export.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)Christian,
I had enough of the stable file handles discussion [1].
This patch which I already suggested [2] on week ago, states a justified technical reason why pidfs and nsfs should not be exported by nfsd, so let's use this technical reasoning and stop the philosophic discussions about what is a stable file handle is please.
Regarding cgroupfs, we can either deal with it later or not - it is not a clear but as pidfs and nsfs which absolutely should be fixed retroactively in stable kernels.
If you think that cgroupfs could benefit from "exhaustive" file handles [3] then we can implement open_by_handle_at(FD_CGROUPFS_ROOT, ... and that would classify cgroupfs the same as pidfs and nsfs.
Thanks,
Amir.[1] https://lore.kernel.org/linux-fsdevel/[email protected]/
[2] https://lore.kernel.org/linux-fsdevel/CAOQ4uxhkaGFtQRzTj2xaf2GJucoAY5CGiyUjB=8YA2zTbOtFvw@mail.gmail.com/
[3] https://lore.kernel.org/linux-fsdevel/[email protected]/fs/nfsd/export.c +7
-8@@ -405,6 +405,7 @@ static struct svc_export *svc_export_lookup(struct svc_export *);static int check_export (const struct path *path,int *flags,unsigned char *uuid) {struct inode *inode =d_inode (path->dentry); +const struct export_operations *nop = inode->i_sb->s_export_op;/* * We currently export only dirs, regular files, and (for v4 @@ -422,13 +423,12 @@ static int check_export(const struct path *path, int *flags, unsigned char *uuidif (*flags &NFSEXP_V4ROOT ) *flags |=NFSEXP_READONLY ; -/* There are two requirements on a filesystem to be exportable. -* 1: We must be able to identify the filesystem from a number. -* either a device number (so FS_REQUIRES_DEV needed) -* or an FSID number (so NFSEXP_FSID or ->uuid is needed). -* 2: We must be able to find an inode from a filehandle. -* This means that s_export_op must be set. -* 3: We must not currently be on an idmapped mount. +/* +* The requirements for a filesystem to be exportable: +* 1. The filehandle must identify a filesystem by number +* 2. The filehandle must uniquely identify an inode +* 3. The filesystem must not have custom filehandle open/perm methods +* 4. The requested file must not reside on an idmapped mount */ if (!(inode->i_sb->s_type->fs_flags & FS_REQUIRES_DEV) && !(*flags & NFSEXP_FSID) &&@@ -437,11 +437,16 @@ static int check_export(const struct path *path, int *flags, unsigned char *uuidreturn -EINVAL ; } -if (!exportfs_can_decode_fh (inode->i_sb->s_export_op)) {
fs/nfsd/export.c static int check_export(const struct path *path, int *flags, unsigned char *uuid · line 449
Quoted 10 lines
fs/nfsd/export.c +6
-0+if (!exportfs_can_decode_fh (nop)) {dprintk ("exp_export: export of invalid fs type.\n" );return -EINVAL ; } +if (nop->open || nop->permission) { +dprintk ("exp_export: export of non-standard fs type.\n" ); +return -EINVAL ; + } +
It is not immediately obvious that this is safe when nop is NULL, but it is because exportfs_can_decode_fh() checks for that case. As that is a static inline a static analyser can easily confirm this. So it is probably OK.
"non-standard" is not totally clear. "special" might be better, or it might not. It is only a dprintk so it probably doesn't matter much.
Thanks for posting this. I think this is a good check to have whether or not we decide to add a flag.
Thanks,
NeilBrown
Quoted 8 lines
fs/nfsd/export.c +0
-0if (is_idmapped_mnt (path->mnt)) {dprintk ("exp_export: export of idmapped mounts not yet supported.\n" );return -EINVAL ;Signature · 1 line
2.52.0
Quoted 85 lines · NeilBrown
Quoted 83 lines · Amir Goldstein
pidfs and nsfs recently gained support for encode/decode of file handles via name_to_handle_at(2)/opan_by_handle_at(2).
These special kernel filesystems have custom ->open() and ->permission() export methods, which nfsd does not respect and it was never meant to be used for exporting those filesystems by nfsd.
Therefore, do not allow nfsd to export filesystems with custom ->open() or ->permission() methods.
Fixes b3caba8f7a34a ("pidfs: implement file handle support")Fixes 5222470b2fbb3 ("nsfs: support file handles")Signed-off-by Amir Goldstein <[email protected]>--- fs/nfsd/export.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)Christian,
I had enough of the stable file handles discussion [1].
This patch which I already suggested [2] on week ago, states a justified technical reason why pidfs and nsfs should not be exported by nfsd, so let's use this technical reasoning and stop the philosophic discussions about what is a stable file handle is please.
Regarding cgroupfs, we can either deal with it later or not - it is not a clear but as pidfs and nsfs which absolutely should be fixed retroactively in stable kernels.
If you think that cgroupfs could benefit from "exhaustive" file handles [3] then we can implement open_by_handle_at(FD_CGROUPFS_ROOT, ... and that would classify cgroupfs the same as pidfs and nsfs.
Thanks,
Amir.[1] https://lore.kernel.org/linux-fsdevel/[email protected]/
[2] https://lore.kernel.org/linux-fsdevel/CAOQ4uxhkaGFtQRzTj2xaf2GJucoAY5CGiyUjB=8YA2zTbOtFvw@mail.gmail.com/
[3] https://lore.kernel.org/linux-fsdevel/[email protected]/fs/nfsd/export.c +8
-8@@ -405,6 +405,7 @@ static struct svc_export *svc_export_lookup(struct svc_export *);static int check_export (const struct path *path,int *flags,unsigned char *uuid) {struct inode *inode =d_inode (path->dentry); +const struct export_operations *nop = inode->i_sb->s_export_op;/* * We currently export only dirs, regular files, and (for v4 @@ -422,13 +423,12 @@ static int check_export(const struct path *path, int *flags, unsigned char *uuidif (*flags &NFSEXP_V4ROOT ) *flags |=NFSEXP_READONLY ; -/* There are two requirements on a filesystem to be exportable. -* 1: We must be able to identify the filesystem from a number. -* either a device number (so FS_REQUIRES_DEV needed) -* or an FSID number (so NFSEXP_FSID or ->uuid is needed). -* 2: We must be able to find an inode from a filehandle. -* This means that s_export_op must be set. -* 3: We must not currently be on an idmapped mount. +/* +* The requirements for a filesystem to be exportable: +* 1. The filehandle must identify a filesystem by number +* 2. The filehandle must uniquely identify an inode +* 3. The filesystem must not have custom filehandle open/perm methods +* 4. The requested file must not reside on an idmapped mount */ if (!(inode->i_sb->s_type->fs_flags & FS_REQUIRES_DEV) && !(*flags & NFSEXP_FSID) &&@@ -437,11 +437,16 @@ static int check_export(const struct path *path, int *flags, unsigned char *uuidreturn -EINVAL ; } -if (!exportfs_can_decode_fh (inode->i_sb->s_export_op)) { +if (!exportfs_can_decode_fh (nop)) {dprintk ("exp_export: export of invalid fs type.\n" );return -EINVAL ; }
Quoted 10 lines
fs/nfsd/export.c static int check_export(const struct path *path, int *flags, unsigned char *uuid · line 449
Quoted 5 lines
fs/nfsd/export.c +5
-0+if (nop->open || nop->permission) { +dprintk ("exp_export: export of non-standard fs type.\n" ); +return -EINVAL ; + } +It is not immediately obvious that this is safe when nop is NULL, but it is because
exportfs_can_decode_fh()checks for that case. As that is a static inline a static analyser can easily confirm this. So it is probably OK.
Heh, in the RFC patch [1], I had those conditions wrapped in a helper just below exportfs_can_decode_fh(), so this was more clear, but now I tried to avoid adding a helper named exportfs_may_nfs_export()... ;)
Quoted 4 lines
"non-standard" is not totally clear. "special" might be better, or it might not. It is only a dprintk so it probably doesn't matter much.
In said RFC patch it was using the same dprinkt() ("invalid fs type") I am not sure that the distinction to two different classes is important. printing the fstype->name, either with dprintk() or trace point would be much more valuable IMO.
But Jeff has a patch to convert dprink() to trace point, so I will gladly leave those decisions for him.
Thanks,
Amir.
Quoted 8 lines · Amir Goldstein
Quoted 4 lines
It is not immediately obvious that this is safe when nop is NULL, but it is because
exportfs_can_decode_fh()checks for that case. As that is a static inline a static analyser can easily confirm this. So it is probably OK.Heh, in the RFC patch [1], I had those conditions wrapped in a helper just below
exportfs_can_decode_fh(), so this was more clear, but now I tried to avoid adding a helper namedexportfs_may_nfs_export()... ;)
Please drop the nfs - exportfs is a generic layer, and not tried to nfs, even if that's currently the only user.
Quoted 9 lines · Amir Goldstein
pidfs and nsfs recently gained support for encode/decode of file handles via name_to_handle_at(2)/opan_by_handle_at(2).
These special kernel filesystems have custom ->open() and ->permission() export methods, which nfsd does not respect and it was never meant to be used for exporting those filesystems by nfsd.
Therefore, do not allow nfsd to export filesystems with custom ->open() or ->permission() methods.
Yeah, this was added in and not used in the existing export_ops users.
fs/nfsd/export.c static int check_export(const struct path *path, int *flags, unsigned char *uuid · line 432
Quoted 7 lines
fs/nfsd/export.c +6
-0+/* +* The requirements for a filesystem to be exportable: +* 1. The filehandle must identify a filesystem by number +* 2. The filehandle must uniquely identify an inode +* 3. The filesystem must not have custom filehandle open/perm methods +* 4. The requested file must not reside on an idmapped mount */
Please spell out here why ->open and ->permission are not allowed. Listing what the code does is generally not that useful, while why it does that provides value.
While looking this I have to say the API documentation for these methods in exportfs.h is unfortunately completely useless as well. It doesn't mention the limitation that it's only used by the non-exportfs code, and also doesn't mention why a file system would implement or have to implement them :( The commit messages adding them are just as bad as well.
Quoted 5 lines · Christoph Hellwig
Quoted 3 lines · Amir Goldstein
pidfs and nsfs recently gained support for encode/decode of file handles via name_to_handle_at(2)/opan_by_handle_at(2).
Quoted 9 lines
Quoted 6 lines
These special kernel filesystems have custom ->open() and ->permission() export methods, which nfsd does not respect and it was never meant to be used for exporting those filesystems by nfsd.
Therefore, do not allow nfsd to export filesystems with custom ->open() or ->permission() methods.
Yeah, this was added in and not used in the existing
export_opsusers.
Not used in existing users (nfsd) on purpose to my understanding That's the point of this patch - to fix this misunderstanding
Quoted 11 lines
fs/nfsd/export.c static int check_export(const struct path *path, int *flags, unsigned char *uuid · line 432
Quoted 7 lines
fs/nfsd/export.c +6
-0+/* +* The requirements for a filesystem to be exportable: +* 1. The filehandle must identify a filesystem by number +* 2. The filehandle must uniquely identify an inode +* 3. The filesystem must not have custom filehandle open/perm methods +* 4. The requested file must not reside on an idmapped mount */ Please spell out here why ->open and ->permission are not allowed. Listing what the code does is generally not that useful, while why it does that provides value.
This is what I had in the RFC patch:
/*
+ * Do not allow exporting to NFS filesystems with custom ->open() and
+ * ->permission() ops, which nfsd does not respect (e.g. pidfs, nsfs).
+ */
I took Chuck's suggestion to rewrite the requirements, but TBH, I'd rather not touch the existing comment myself at all. I prefer that Check and Jeff apply a separate patch to rewrite the documentation if they feel that this is needed or to propose the phrasing that they prefer.
Quoted 7 lines
While looking this I have to say the API documentation for these methods in
exportfs.his unfortunately completely useless as well. It doesn't mention the limitation that it's only used by the non-exportfs code, and also doesn't mention why a file system would implement or have to implement them :( The commit messages adding them are just as bad as well.
I will leave that to Christian for a followup patch or to suggest the phrasing.
Thanks,
Amir.
Quoted 10 lines · Amir Goldstein
Quoted 9 lines · Christoph Hellwig
Quoted 7 lines · Amir Goldstein
pidfs and nsfs recently gained support for encode/decode of file handles via name_to_handle_at(2)/opan_by_handle_at(2).
These special kernel filesystems have custom ->open() and ->permission() export methods, which nfsd does not respect and it was never meant to be used for exporting those filesystems by nfsd.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Therefore, do not allow nfsd to export filesystems with custom ->open() or ->permission() methods.
Yeah, this was added in and not used in the existing
export_opsusers.Not used in existing users (nfsd) on purpose to my understanding That's the point of this patch - to fix this misunderstanding
Well, I've dug through the documentation and commits that added it, and there's absolutely nothing explaining the intent unfortunately.
Quoted 11 lines
Quoted 4 lines
Please spell out here why ->open and ->permission are not allowed. Listing what the code does is generally not that useful, while why it does that provides value.
This is what I had in the RFC patch:
/*
+ * Do not allow exporting to NFS filesystems with custom ->open() and
+ * ->permission() ops, which nfsd does not respect (e.g. pidfs, nsfs).
+ */
Quoted 5 lines
I took Chuck's suggestion to rewrite the requirements, but TBH, I'd rather not touch the existing comment myself at all. I prefer that Check and Jeff apply a separate patch to rewrite the documentation if they feel that this is needed or to propose the phrasing that they prefer.
I don't really care who writes the documentation, but if we reject based on the presence of the methods we really need to document the why.
Quoted 9 lines
Quoted 6 lines
While looking this I have to say the API documentation for these methods in
exportfs.his unfortunately completely useless as well. It doesn't mention the limitation that it's only used by the non-exportfs code, and also doesn't mention why a file system would implement or have to implement them :( The commit messages adding them are just as bad as well.I will leave that to Christian for a followup patch or to suggest the phrasing.
Yes, I think we really need a braindump from Christian here. If you don't want to add that to the documentation I'll find some time to include it into a revision, because documenting these kinds of things is really essential. We're already confused only 2 years after this was added, and it's only going to get worse.
Quoted 81 lines · Amir Goldstein
pidfs and nsfs recently gained support for encode/decode of file handles via name_to_handle_at(2)/opan_by_handle_at(2).
These special kernel filesystems have custom ->open() and ->permission() export methods, which nfsd does not respect and it was never meant to be used for exporting those filesystems by nfsd.
Therefore, do not allow nfsd to export filesystems with custom ->open() or ->permission() methods.
Fixes b3caba8f7a34a ("pidfs: implement file handle support")Fixes 5222470b2fbb3 ("nsfs: support file handles")Signed-off-by Amir Goldstein <[email protected]>--- fs/nfsd/export.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)Christian,
I had enough of the stable file handles discussion [1].
This patch which I already suggested [2] on week ago, states a justified technical reason why pidfs and nsfs should not be exported by nfsd, so let's use this technical reasoning and stop the philosophic discussions about what is a stable file handle is please.
Regarding cgroupfs, we can either deal with it later or not - it is not a clear but as pidfs and nsfs which absolutely should be fixed retroactively in stable kernels.
If you think that cgroupfs could benefit from "exhaustive" file handles [3] then we can implement open_by_handle_at(FD_CGROUPFS_ROOT, ... and that would classify cgroupfs the same as pidfs and nsfs.
Thanks,
Amir.[1] https://lore.kernel.org/linux-fsdevel/[email protected]/
[2] https://lore.kernel.org/linux-fsdevel/CAOQ4uxhkaGFtQRzTj2xaf2GJucoAY5CGiyUjB=8YA2zTbOtFvw@mail.gmail.com/
[3] https://lore.kernel.org/linux-fsdevel/[email protected]/fs/nfsd/export.c +8
-8@@ -405,6 +405,7 @@ static struct svc_export *svc_export_lookup(struct svc_export *);static int check_export (const struct path *path,int *flags,unsigned char *uuid) {struct inode *inode =d_inode (path->dentry); +const struct export_operations *nop = inode->i_sb->s_export_op;/* * We currently export only dirs, regular files, and (for v4 @@ -422,13 +423,12 @@ static int check_export(const struct path *path, int *flags, unsigned char *uuidif (*flags &NFSEXP_V4ROOT ) *flags |=NFSEXP_READONLY ; -/* There are two requirements on a filesystem to be exportable. -* 1: We must be able to identify the filesystem from a number. -* either a device number (so FS_REQUIRES_DEV needed) -* or an FSID number (so NFSEXP_FSID or ->uuid is needed). -* 2: We must be able to find an inode from a filehandle. -* This means that s_export_op must be set. -* 3: We must not currently be on an idmapped mount. +/* +* The requirements for a filesystem to be exportable: +* 1. The filehandle must identify a filesystem by number +* 2. The filehandle must uniquely identify an inode +* 3. The filesystem must not have custom filehandle open/perm methods +* 4. The requested file must not reside on an idmapped mount */ if (!(inode->i_sb->s_type->fs_flags & FS_REQUIRES_DEV) && !(*flags & NFSEXP_FSID) &&@@ -437,11 +437,16 @@ static int check_export(const struct path *path, int *flags, unsigned char *uuidreturn -EINVAL ; } -if (!exportfs_can_decode_fh (inode->i_sb->s_export_op)) { +if (!exportfs_can_decode_fh (nop)) {dprintk ("exp_export: export of invalid fs type.\n" );return -EINVAL ;
fs/nfsd/export.c static int check_export(const struct path *path, int *flags, unsigned char *uuid · line 452
Quoted 10 lines
fs/nfsd/export.c +5
-0} +if (nop->open || nop->permission) { +dprintk ("exp_export: export of non-standard fs type.\n" ); +return -EINVAL ; + } +if (is_idmapped_mnt (path->mnt)) {dprintk ("exp_export: export of idmapped mounts not yet supported.\n" );return -EINVAL ;
Seems reasonable, though I agree with HCH that you should explain why we're excluding these in the "requirements" above.