nfs-utils: Improving NFS re-exports
Subsystems (2)
cover nfs-utils: Improving NFS re-exports
This is the second iteration of the NFS re-export improvement series for nfs-utils. While the kernel side didn't change at all and is still small,
the userspace side saw much more changes.
Please note that this is still an RFC, there is room for improvement.
The core idea is adding new export option: reeport=
Using reexport= it is possible to mark an export entry in the exports file explicitly as NFS re-export and select a strategy how unique identifiers should be provided.
"remote-devfsid" is the strategy I have proposed in my first patch,
I understand that this one is dangerous. But I still find it useful in some situations.
"auto-fsidnum" and "predefined-fsidnum" are new and use a SQLite database as backend to keep track of generated ids.
For a more detailed description see patch "exports: Implement new export option reexport=". I choose SQLite because nfs-utils already uses it and using SQL ids can nicely generated and maintained. It will also scale for large setups where the amount of subvolumes is high.
Beside of id generation this series also addresses the reboot problem. If the re-exporting NFS server reboots, uncovered NFS subvolumes are not yet mounted and file handles become stale.
Now mountd/exportd keeps track of uncovered subvolumes and makes sure they get uncovered while nfsd starts.
The whole set of features is currently opt-in via --enable-reexport. I'm also not sure about the rearrangement of the reexport code, currently it is a helper library.
Please let me know whether you like this approach. If so I'd tidy it up and submit it as non-RFC.
TODOs/Open questions:
- When re-exporting, fs.nfs.nfs_mountpoint_timeout should be set to 0
to make subvolumes not vanish.
Is this something exportfs should do automatically when it sees an export entry with a reexport= option?
- exportd saw only minimal testing so far, I wasn't aware of it yet. :-S
- Currently wtere is no way to release the shared memory which contains the database lock. I guess it could be released via exportfs -f, which is the very last exec in nfs-server.service
- Add a tool to import/export entries from the reexport database which obeys the shared lock.
- When doing v4->v4 or v3->v4 re-exports very first read access to a file block a few seconds until the client does a retransmit.
v3->v3 works fine. More investigation needed.
Looking forward for your feedback!
Thanks,
//richard
Richard Weinberger (6):
Implement reexport helper library
exports: Implement new export option reexport=
export: Implement logic behind reexport=
export: Record mounted volumes
nfsd: statfs() every known subvolume upon start
export: Garbage collect orphaned subvolumes upon start
configure.ac | 12 + support/Makefile.am | 4 + support/export/Makefile.am | 2 + support/export/cache.c | 241 +++++++++++++++++- support/export/export.h | 3 + support/include/nfslib.h | 1 + support/nfs/Makefile.am | 1 + support/nfs/exports.c | 73 ++++++ support/reexport/Makefile.am | 6 + support/reexport/reexport.c | 477 +++++++++++++++++++++++++++++++++++ support/reexport/reexport.h | 53 ++++ utils/exportd/Makefile.am | 8 +- utils/exportd/exportd.c | 17 ++ utils/exportfs/Makefile.am | 4 + utils/mount/Makefile.am | 6 + utils/mountd/Makefile.am | 6 + utils/mountd/mountd.c | 1 + utils/mountd/svc_run.c | 18 ++ utils/nfsd/Makefile.am | 6 + utils/nfsd/nfsd.c | 10 + 20 files changed, 934 insertions(+), 15 deletions(-) create mode 100644 support/reexport/Makefile.am create mode 100644 support/reexport/reexport.c create mode 100644 support/reexport/reexport.h
Signature · 1 line
2.31.1
RFC PATCH 1/6 Implement reexport helper library
This internal library contains code that will be used by various tools within the nfs-utils package to deal better with NFS re-export, especially cross mounts.
--- configure.ac | 12 + support/Makefile.am | 4 + support/reexport/Makefile.am | 6 + support/reexport/reexport.c | 477 +++++++++++++++++++++++++++++++++++ support/reexport/reexport.h | 53 ++++ 5 files changed, 552 insertions(+) create mode 100644 support/reexport/Makefile.am create mode 100644 support/reexport/reexport.c create mode 100644 support/reexport/reexport.h
configure.ac +12 -0
@@ -274,6 +274,17 @@ AC_ARG_ENABLE(nfsv4server, fi AM_CONDITIONAL(CONFIG_NFSV4SERVER, [test "$enable_nfsv4server" = "yes" ]) +AC_ARG_ENABLE(reexport, + [AC_HELP_STRING([--enable-reexport], + [enable support for re-exporting NFS mounts @<:@default=no@:>@])], + enable_reexport=$enableval, + enable_reexport="no") + if test "$enable_reexport" = yes; then + AC_DEFINE(HAVE_REEXPORT_SUPPORT, 1, + [Define this if you want NFS re-export support compiled in]) + fi + AM_CONDITIONAL(CONFIG_REEXPORT, [test "$enable_reexport" = "yes" ]) + dnl Check for TI-RPC library and headers AC_LIBTIRPC
@@ -730,6 +741,7 @@ AC_CONFIG_FILES([ support/nsm/Makefile support/nfsidmap/Makefile support/nfsidmap/libnfsidmap.pc + support/reexport/Makefile tools/Makefile tools/locktest/Makefile tools/nlmtest/Makefile
support/Makefile.am +4 -0
@@ -10,6 +10,10 @@ if CONFIG_JUNCTION OPTDIRS += junction endif +if CONFIG_REEXPORT +OPTDIRS += reexport +endif + SUBDIRS = export include misc nfs nsm $(OPTDIRS) MAINTAINERCLEANFILES = Makefile.in
support/reexport/Makefile.am new file +6 -0
@@ -0,0 +1,6 @@ +## Process this file with automake to produce Makefile.in + +noinst_LIBRARIES = libreexport.a +libreexport_a_SOURCES = reexport.c + +MAINTAINERCLEANFILES = Makefile.in
support/reexport/reexport.c new file +477 -0
477 lines not on this page · raw message
support/reexport/reexport.h new file +53 -0
53 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [RFC PATCH 1/6] Implement reexport helper library
support/reexport/reexport.c line 27
Quoted 4 lines · Richard Weinberger
support/reexport/reexport.c new file +4
-0+#define REEXPDB_SHM_NAME "/nfs_reexport_db_lock" +#define REEXPDB_SHM_SZ 4096 +#define REEXPDB_INIT_LOCK NFS_STATEDIR "/reexpdb_init.lock" +#define REEXPDB_DBFILE NFS_STATEDIR "/reexpdb.sqlite3"
I don't know much about sqlite--why do we need to do our own file locking? If we do need to do it ourself, could we lock the database file instead instead of using a separate lock file?
Quoted 1 line
+static const char initdb_sql[] = "CREATE TABLE IF NOT EXISTS fsidnums (num INTEGER PRIMARY KEY CHECK (num > 0 AND num < 4294967296), path TEXT UNIQUE); CREATE TABLE IF NOT EXISTS subvolumes (path TEXT PRIMARY KEY); CREATE INDEX IF NOT EXISTS
idx_ids_pathON fsidnums (path);";
I'd personally find it easier to read if these were defined in the place where they're used. (And, honestly, if this is just used once, maybe the definition is unnecessary.)
What are the two tables used for? Naively I'd've thought the "subvolumes" table was redundant.
Quoted 2 lines
+/*
+ * This query is a little tricky. We use SQL to find and claim the smallest free fsid number.
Yes, that is a little tricky. Is it necessary? My SQL Is rusty, but the database should be able to pick a unique value for us, shouldn't it?
Quoted 9 lines
+ * To find a free fsid the fsidnums is left joined to itself but with an offset of 1.
+ * Everything after the UNION statement is to handle the corner case where fsidnums
+ * is empty. In this case we want 1 as first fsid number.
+ */support/reexport/reexport.c new file +5
-0+static const char new_fsidnum_by_path_sql[] ="INSERT INTO fsidnums VALUES ((SELECT ids1.num + 1 FROM fsidnums AS ids1 LEFT JOIN fsidnums AS ids2 ON ids2.num = ids1.num + 1 WHERE ids2.num IS NULL UNION SELECT 1 WHERE NOT EXISTS (SELECT NULL FROM fsidnums WHERE num = 1) LIMIT 1), ?1) RETURNING num;" ; +static const char fsidnum_by_path_sql[] ="SELECT num FROM fsidnums WHERE path = ?1;" ; +static const char add_crossed_volume_sql[] ="REPLACE INTO subvolumes VALUES(?1);" ; +static const char drop_crossed_volume_sql[] ="DELETE FROM subvolumes WHERE path = ?1;" ; +static const char get_crossed_volumes_sql[] ="SELECT path from subvolumes;" ;
...
Quoted 4 lines
+/*
+ *reexpdb_init- Initialize reexport database
+ *
+ * Setup shared lock (database is concurrently used by multiple processes),
So, this should all work when rpc.mountd is run with --num_threads > 1?
--b.
Re: [RFC PATCH 1/6] Implement reexport helper library
Bruce,
----- Ursprüngliche Mail -----
Quoted 10 lines
Von: "bfields" <[email protected]>
support/reexport/reexport.c line 27
Quoted 4 lines · Richard Weinberger
support/reexport/reexport.c new file +4
-0+#define REEXPDB_SHM_NAME "/nfs_reexport_db_lock" +#define REEXPDB_SHM_SZ 4096 +#define REEXPDB_INIT_LOCK NFS_STATEDIR "/reexpdb_init.lock" +#define REEXPDB_DBFILE NFS_STATEDIR "/reexpdb.sqlite3"I don't know much about sqlite--why do we need to do our own file locking? If we do need to do it ourself, could we lock the database file instead instead of using a separate lock file?
Concurrent access to the database is synchronized using a shared rwlock (on shared memory). reexpdb_init.lock is used to make sure that creating and initializing the shared memory/lock happens once.
Quoted 8 lines
Quoted 4 lines
+static const char initdb_sql[] = "CREATE TABLE IF NOT EXISTS fsidnums (num INTEGER PRIMARY KEY CHECK (num > 0 AND num < 4294967296), path TEXT UNIQUE); CREATE TABLE IF NOT EXISTS subvolumes (path TEXT PRIMARY KEY); CREATE INDEX IF NOT EXISTS
idx_ids_pathON fsidnums (path);";I'd personally find it easier to read if these were defined in the place where they're used. (And, honestly, if this is just used once, maybe the definition is unnecessary.)
Ok.
Quoted 2 lines
What are the two tables used for? Naively I'd've thought the "subvolumes" table was redundant.
fsidnums is used to store generated and predefined fsid numbers. It is only used in reexport modes auto-fsidnum and predefined-fsidnum.
subvolumes contains a list of subvolumes which a are likely in use by a client. Up start all these paths will get touched such that they can be exported.
Quoted 6 lines
Quoted 3 lines
+/*
+ * This query is a little tricky. We use SQL to find and claim the smallest free fsid number.Yes, that is a little tricky. Is it necessary? My SQL Is rusty, but the database should be able to pick a unique value for us, shouldn't it?
SQLite can generate a unique value, but we cannot select the range. It will give a value between 0 and 2^64.
We need an id between 1 and 2^32.
Quoted 18 lines
Quoted 17 lines
+ * To find a free fsid the fsidnums is left joined to itself but with an offset of 1.
+ * Everything after the UNION statement is to handle the corner case where fsidnums
+ * is empty. In this case we want 1 as first fsid number.
+ */
+static const char new_fsidnum_by_path_sql[] = "INSERT INTO fsidnums VALUES ((SELECT ids1.num + 1 FROM fsidnums AS ids1 LEFT JOIN fsidnums AS ids2 ON ids2.num = ids1.num + 1 WHERE ids2.num IS NULL UNION SELECT 1 WHERE NOT EXISTS (SELECT NULL FROM fsidnums WHERE num = 1) LIMIT 1), ?1) RETURNING num;"; +static const char fsidnum_by_path_sql[] = "SELECT num FROM fsidnums WHERE path = ?1;";
+static const char add_crossed_volume_sql[] = "REPLACE INTO subvolumes VALUES(?1);";
+static const char drop_crossed_volume_sql[] = "DELETE FROM subvolumes WHERE path = ?1;";
+static const char get_crossed_volumes_sql[] = "SELECT path from subvolumes;";...
Quoted 6 lines
Quoted 4 lines
+/*
+ *reexpdb_init- Initialize reexport database
+ *
+ * Setup shared lock (database is concurrently used by multiple processes),So, this should all work when rpc.mountd is run with --num_threads > 1?
Yes, that's why we need the shared rwlock.
Thanks,
//richard
Re: [RFC PATCH 1/6] Implement reexport helper library
Quoted 14 lines · Richard Weinberger
Bruce,
----- Ursprüngliche Mail -----
Quoted 10 lines
Von: "bfields" <[email protected]>
support/reexport/reexport.c line 27
Quoted 4 lines · Richard Weinberger
support/reexport/reexport.c new file +4
-0+#define REEXPDB_SHM_NAME "/nfs_reexport_db_lock" +#define REEXPDB_SHM_SZ 4096 +#define REEXPDB_INIT_LOCK NFS_STATEDIR "/reexpdb_init.lock" +#define REEXPDB_DBFILE NFS_STATEDIR "/reexpdb.sqlite3"I don't know much about sqlite--why do we need to do our own file locking? If we do need to do it ourself, could we lock the database file instead instead of using a separate lock file?
Quoted 3 lines
Concurrent access to the database is synchronized using a shared rwlock (on shared memory). reexpdb_init.lock is used to make sure that creating and initializing the shared memory/lock happens once.
Could you point me to sqlite documentation that explains why the user would need to do their own locking?
I assumed sqlite would do any necessary locking for you. It seems like a core function for a database.
Quoted 9 lines
Quoted 2 lines
What are the two tables used for? Naively I'd've thought the "subvolumes" table was redundant.
fsidnums is used to store generated and predefined fsid numbers. It is only used in reexport modes auto-fsidnum and predefined-fsidnum.
subvolumes contains a list of subvolumes which a are likely in use by a client. Up start all these paths will get touched such that they can be exported.
The fsidnums also contains that same list of paths, right? So I don't understand why we need both.
Also, if we're depending on touching all the paths on startup, something is wrong.
What we want to do is touch the path when we get an upcall for the given fsid. That way we don't have to assume, for example, that the system will never expire mounts that haven't been used recently.
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
+/*
+ * This query is a little tricky. We use SQL to find and claim the smallest free fsid number.Yes, that is a little tricky. Is it necessary? My SQL Is rusty, but the database should be able to pick a unique value for us, shouldn't it?
SQLite can generate a unique value, but we cannot select the range. It will give a value between 0 and 2^64.
We need an id between 1 and 2^32.
Surely that CHECK constraint doesn't somehow cause sqlite to generate non-unique primary keys? At worst I'd think it would cause INSERTs to fail if the ordinary primary-key-choosing algorithm chooses something over 2^32.
--b.
Re: [RFC PATCH 1/6] Implement reexport helper library
Bruce,
----- Ursprüngliche Mail -----
Quoted 9 lines
Von: "bfields" <[email protected]>
Quoted 5 lines
Concurrent access to the database is synchronized using a shared rwlock (on shared memory).
reexpdb_init.lock is used to make sure that creating and initializing the shared memory/lock
happens once.Could you point me to sqlite documentation that explains why the user would need to do their own locking?
https://www.sqlite.org/rescode.html#busy
Quoted 2 lines
I assumed sqlite would do any necessary locking for you. It seems like a core function for a database.
Well, SQLite does locking but no queuing.
So, as soon somebody is writing the data base it is locked and all other read/writes will fail either with SQLITE_BUSY or SQLITE_LOCKED. It is up to the user how to react on that.
That's why I chose to use a shared rwlock where a task can *wait* upon conflicting access.
Maybe there is a better way do it, dunno.
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
What are the two tables used for? Naively I'd've thought the "subvolumes" table was redundant.
fsidnums is used to store generated and predefined fsid numbers. It is only used in reexport modes auto-fsidnum and predefined-fsidnum.
Quoted 6 lines
Quoted 3 lines
subvolumes contains a list of subvolumes which a are likely in use by a client. Up start all these paths will get touched such that they can be exported.
The fsidnums also contains that same list of paths, right? So I don't understand why we need both.
In the current design generated fsidnums will stay forever while the paths in subvolumes can get cleaned.
Quoted 2 lines
Also, if we're depending on touching all the paths on startup, something is wrong.
I think we talked about that already and agreed that it should work without touching. So far I didn't had a chance to investigate into this.
Quoted 11 lines
What we want to do is touch the path when we get an upcall for the given fsid. That way we don't have to assume, for example, that the system will never expire mounts that haven't been used recently.
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
+/*
+ * This query is a little tricky. We use SQL to find and claim the smallest free fsid number.Yes, that is a little tricky. Is it necessary? My SQL Is rusty, but the database should be able to pick a unique value for us, shouldn't it?
Quoted 8 lines
Quoted 3 lines
SQLite can generate a unique value, but we cannot select the range. It will give a value between 0 and 2^64.
We need an id between 1 and 2^32.Surely that CHECK constraint doesn't somehow cause sqlite to generate non-unique primary keys? At worst I'd think it would cause INSERTs to fail if the ordinary primary-key-choosing algorithm chooses something over 2^32.
The CHECK is just a paranoid check. My SQL INSERT generates ids starting with 1. Sure, if you run it 2^32 times, it will fail due to the CHECK.
Thanks,
//richard
Re: [RFC PATCH 1/6] Implement reexport helper library
Quoted 23 lines · Richard Weinberger
Bruce,
----- Ursprüngliche Mail -----
Quoted 9 lines
Von: "bfields" <[email protected]>
Quoted 5 lines
Concurrent access to the database is synchronized using a shared rwlock (on shared memory).
reexpdb_init.lock is used to make sure that creating and initializing the shared memory/lock
happens once.Could you point me to sqlite documentation that explains why the user would need to do their own locking?
https://www.sqlite.org/rescode.html#busy
Quoted 2 lines
I assumed sqlite would do any necessary locking for you. It seems like a core function for a database.
Well, SQLite does locking but no queuing.
So, as soon somebody is writing the data base it is locked and all other read/writes will fail either withSQLITE_BUSYorSQLITE_LOCKED. It is up to the user how to react on that.
Quoted 4 lines
That's why I chose to use a shared rwlock where a task can *wait* upon conflicting access.
Maybe there is a better way do it, dunno.
Oh, got it, thanks for the explanation.
Assuming writes are rare, maybe a dumb retry loop would be adequate. Sounds like that's what we'd need anyway if we were to share the database between cooperating re-export servers. (Would we have a performance problem in that case, if several reexport servers start at once and all start trying to populate the shared database? I don't know.)
Anyway, it's a judgement call, fair enough. Might be worth a brief comment, at least.
Quoted 13 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
What are the two tables used for? Naively I'd've thought the "subvolumes" table was redundant.
fsidnums is used to store generated and predefined fsid numbers. It is only used in reexport modes auto-fsidnum and predefined-fsidnum.
Quoted 6 lines
Quoted 3 lines
subvolumes contains a list of subvolumes which a are likely in use by a client. Up start all these paths will get touched such that they can be exported.
The fsidnums also contains that same list of paths, right? So I don't understand why we need both.
Quoted 8 lines
In the current design generated fsidnums will stay forever while the paths in subvolumes can get cleaned.
Quoted 2 lines
Also, if we're depending on touching all the paths on startup, something is wrong.
I think we talked about that already and agreed that it should work without touching. So far I didn't had a chance to investigate into this.
OK. Do you think you could look into that, and strip this down to the one auto-fsidnum case, and then continue the discussion? I think that'd clarify things.
As I say, I wouldn't necessarily be opposed to later adding a reexport= option back in, but for now I'd first like to see if we can find the simplest patches that will solve the problem in one good-enough way.
Quoted 15 lines
Quoted 15 lines
What we want to do is touch the path when we get an upcall for the given fsid. That way we don't have to assume, for example, that the system will never expire mounts that haven't been used recently.
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
+/*
+ * This query is a little tricky. We use SQL to find and claim the smallest free fsid number.Yes, that is a little tricky. Is it necessary? My SQL Is rusty, but the database should be able to pick a unique value for us, shouldn't it?
SQLite can generate a unique value, but we cannot select the range. It will give a value between 0 and 2^64.
We need an id between 1 and 2^32.
Quoted 7 lines
Quoted 4 lines
Surely that CHECK constraint doesn't somehow cause sqlite to generate non-unique primary keys? At worst I'd think it would cause INSERTs to fail if the ordinary primary-key-choosing algorithm chooses something over 2^32.
The CHECK is just a paranoid check. My SQL INSERT generates ids starting with 1. Sure, if you run it 2^32 times, it will fail due to the CHECK.
OK.
--b.
RFC PATCH 2/6 exports: Implement new export option reexport=
In reply to Richard WeinbergerWhen re-exporting a NFS volume it is mandatory to specify either a UUID or numerical fsid= option because nfsd is unable to derive a identifier on its own.
For NFS cross mounts this becomes a problem because nfsd also needs a identifier for every crossed mount.
A common workaround is stating every single subvolume in the exports list too.
But this defeats the purpose of the crossmnt option and is tedious.
This is where the reexport= tries to help.
It offers various strategies to automatically derive a identifier for NFS volumes and sub volumes.
Each have their pros and cons.
Currently three modes are implemented:
1. auto-fsidnum
In this mode mountd/exportd will create a new numerical fsid for a NFS volume and subvolume. The numbers are stored in a database such that the server will always use the same fsid.
The entry in the exports file allowed to skip fsid= entiry but stating a UUID is allowed, if needed.
This mode has the obvious downside that load balancing is not possible since multiple re-exporting NFS servers would generate different ids.
2. predefined-fsidnum
This mode works just like auto-fsidnum but does not generate ids for you. It helps in the load balancing case. A system administrator has to manually maintain the database and install it on all re-exporting NFS servers. If you have a massive amount of subvolumes this mode will help because you don't have to bloat the exports list.
3. remote-devfsid
If this mode is selected mountd/exportd will derive an UUID from the re-exported NFS volume's fsid (rfc7530 section-5.8.1.9). No further local state is needed on the re-exporting server. The export list entry still needs a fsid= setting because while parsing the exports file the NFS mounts might be not there yet. This mode is dangerous, use only of you're absolutely sure that the NFS server you're re-exporting has a stable fsid. Chances are good that it can change.
Since an UUID is derived, reexporting from NFSv3 to NFSv3 is not possible. The file handle space is too small.
NFSv3 to NFSv4 works, though.
--- support/include/nfslib.h | 1 + support/nfs/Makefile.am | 1 + support/nfs/exports.c | 73 ++++++++++++++++++++++++++++++++++++++ utils/exportfs/Makefile.am | 4 +++ utils/mount/Makefile.am | 6 ++++ 5 files changed, 85 insertions(+)
support/include/nfslib.h +1 -0
@@ -85,6 +85,7 @@ struct exportent {struct sec_entry e_secinfo[SECFLAVOR_COUNT +1 ];unsigned int e_ttl;char * e_realpath; +int e_reexport; };struct rmtabent {
support/nfs/Makefile.am +1 -0
@@ -9,6 +9,7 @@ libnfs_la_SOURCES = exports.c rmtab.c xio.c rpcmisc.c rpcdispatch.c \ svc_socket.c cacheio.c closeall.c nfs_mntent.c \ svc_create.c atomicio.c strlcat.c strlcpy.c libnfs_la_LIBADD = libnfsconf.la +libnfs_la_CPPFLAGS = -I$(top_srcdir)/support/reexport libnfsconf_la_SOURCES = conffile.c xlog.c
support/nfs/exports.c +73 -0
109 lines not on this page · raw message
utils/exportfs/Makefile.am +4 -0
@@ -12,4 +12,8 @@ exportfs_LDADD = ../../support/export/libexport.a \ ../../support/misc/libmisc.a \ $(LIBWRAP) $(LIBNSL) $(LIBPTHREAD) +if CONFIG_REEXPORT +exportfs_LDADD += ../../support/reexport/libreexport.a $(LIBSQLITE) -lrt +endif + MAINTAINERCLEANFILES = Makefile.in
utils/mount/Makefile.am +6 -0
@@ -32,6 +32,12 @@ mount_nfs_LDADD = ../../support/nfs/libnfs.la \ ../../support/misc/libmisc.a \ $(LIBTIRPC) +if CONFIG_REEXPORT +mount_nfs_LDADD += ../../support/reexport/libreexport.a \ + $(LIBSQLITE) -lrt $(LIBPTHREAD) +endif + + mount_nfs_SOURCES = $(mount_common) if CONFIG_LIBMOUNT
Signature · 1 line
2.31.1
Re: [RFC PATCH 2/6] exports: Implement new export option reexport=
Quoted 24 lines · Richard Weinberger
When re-exporting a NFS volume it is mandatory to specify either a UUID or numerical fsid= option because nfsd is unable to derive a identifier on its own.
For NFS cross mounts this becomes a problem because nfsd also needs a identifier for every crossed mount.
A common workaround is stating every single subvolume in the exports list too.
But this defeats the purpose of the crossmnt option and is tedious.This is where the reexport= tries to help.
It offers various strategies to automatically derive a identifier for NFS volumes and sub volumes.
Each have their pros and cons.Currently three modes are implemented:
1. auto-fsidnum
In this mode mountd/exportd will create a new numerical fsid for a NFS volume and subvolume. The numbers are stored in a database such that the server will always use the same fsid.
The entry in the exports file allowed to skip fsid= entiry but stating a UUID is allowed, if needed.
Quoted 3 lines
This mode has the obvious downside that load balancing is not possible since multiple re-exporting NFS servers would generate different ids.
This is the one I think it makes sense to concentrate on first. Ideally it should Just Work without requiring any configuration.
And then eventually my hope is that we could replace sqlite by a distributed database to get filehandles that are consistent across multiple servers.
Quoted 7 lines
2. predefined-fsidnum
This mode works just like auto-fsidnum but does not generate ids for you. It helps in the load balancing case. A system administrator has to manually maintain the database and install it on all re-exporting NFS servers. If you have a massive amount of subvolumes this mode will help because you don't have to bloat the exports list.
OK, I can see that being sort of useful but it'd be nice if we could start with something more automatic.
Quoted 3 lines
3. remote-devfsid
If this mode is selected mountd/exportd will derive an UUID from the re-exported NFS volume's fsid (rfc7530 section-5.8.1.9).
How does the server take a filehandle with a UUID in it and map that UUID back to the original fsid?
Quoted 3 lines
No further local state is needed on the re-exporting server. The export list entry still needs a fsid= setting because while parsing the exports file the NFS mounts might be not there yet.
I don't understand that bit.
Quoted 3 lines
This mode is dangerous, use only of you're absolutely sure that the NFS server you're re-exporting has a stable fsid. Chances are good that it can change.
The fsid should be stable.
The case I'm worried about is the case where we're reexporting exports from multiple servers. Then there's nothing preventing the two servers from accidentally picking the same fsid to represent different exports.
--b.
Quoted 3 lines
Since an UUID is derived, reexporting from NFSv3 to NFSv3 is not possible. The file handle space is too small.
NFSv3 to NFSv4 works, though.
Re: [RFC PATCH 2/6] exports: Implement new export option reexport=
Bruce,
----- Ursprüngliche Mail -----
Quoted 8 lines
Von: "bfields" <[email protected]>
Quoted 7 lines
1. auto-fsidnum
In this mode mountd/exportd will create a new numerical fsid for a NFS volume and subvolume. The numbers are stored in a database such that the server will always use the same fsid.
The entry in the exports file allowed to skip fsid= entiry but stating a UUID is allowed, if needed.
Quoted 6 lines
Quoted 3 lines
This mode has the obvious downside that load balancing is not possible since multiple re-exporting NFS servers would generate different ids.
This is the one I think it makes sense to concentrate on first. Ideally it should Just Work without requiring any configuration.
Agreed.
Quoted 3 lines
And then eventually my hope is that we could replace sqlite by a distributed database to get filehandles that are consistent across multiple servers.
Sure. I see at least two options here:
a. Allow multiple SQL backends in nfs-utils. SQLite by default, but also remote MariaDB or Postgres...
b. Placing the SQLite database on a shared file system that is capable of file locks. That way we can use SQlite as-is. We just need to handle the SQLITE_LOCKED case in the code. Luckily writing happens seldom, so this shouldn't be a big deal.
Quoted 11 lines
Quoted 7 lines
2. predefined-fsidnum
This mode works just like auto-fsidnum but does not generate ids for you. It helps in the load balancing case. A system administrator has to manually maintain the database and install it on all re-exporting NFS servers. If you have a massive amount of subvolumes this mode will help because you don't have to bloat the exports list.OK, I can see that being sort of useful but it'd be nice if we could start with something more automatic.
Quoted 6 lines
Quoted 3 lines
3. remote-devfsid
If this mode is selected mountd/exportd will derive an UUID from the re-exported NFS volume's fsid (rfc7530 section-5.8.1.9).How does the server take a filehandle with a UUID in it and map that UUID back to the original fsid?
knfsd does not need the original fsid. All it sees is the UUID. If it needs to know which export belongs to a UUID it asks mountd. In mountd the regular UUID lookup is used then.
Quoted 5 lines
Quoted 3 lines
No further local state is needed on the re-exporting server. The export list entry still needs a fsid= setting because while parsing the exports file the NFS mounts might be not there yet.
I don't understand that bit.
I tried to explain that with this mode we don't need to store UUID or fsids on disk.
Quoted 5 lines
Quoted 3 lines
This mode is dangerous, use only of you're absolutely sure that the NFS server you're re-exporting has a stable fsid. Chances are good that it can change.
The fsid should be stable.
Didn't you explain me last time that it is not?
By fsid I mean:
https://datatracker.ietf.org/doc/html/rfc7530#section-5.8.1.9
https://datatracker.ietf.org/doc/html/rfc7530#section-2.2.5
So after a reboot the very same filesystem could be on different disks and the major/minor tuple is different. (If the server uses disk ids as is).
Quoted 3 lines
The case I'm worried about is the case where we're reexporting exports from multiple servers. Then there's nothing preventing the two servers from accidentally picking the same fsid to represent different exports.
That's a good point. Since /proc/fs/nfsfs/volumes shows all that information we can add sanity checks to mountd.
Thanks,
//richard
RFC PATCH 3/6 export: Implement logic behind reexport=
In reply to Richard WeinbergerThis covers the cross mount case. When mountd/exportd detect a cross mount on a re-exported NFS volume a identifier has to be found to make nfsd happy.
--- support/export/Makefile.am | 2 + support/export/cache.c | 140 +++++++++++++++++++++++++++++++++---- utils/exportd/Makefile.am | 8 ++- utils/exportd/exportd.c | 2 + utils/mountd/Makefile.am | 6 ++ 5 files changed, 144 insertions(+), 14 deletions(-)
support/export/Makefile.am +2 -0
@@ -14,6 +14,8 @@ libexport_a_SOURCES = client.c export.c hostname.c \ xtab.c mount_clnt.c mount_xdr.c \ cache.c auth.c v4root.c fsloc.c \ v4clients.c +libexport_a_CPPFLAGS = -I$(top_srcdir)/support/reexport + BUILT_SOURCES = $(GENFILES) noinst_HEADERS = mount.h
support/export/cache.c +127 -13
222 lines not on this page · raw message
utils/exportd/Makefile.am +7 -1
@@ -16,11 +16,17 @@ exportd_SOURCES = exportd.c exportd_LDADD = ../../support/export/libexport.a \ ../../support/nfs/libnfs.la \ ../../support/misc/libmisc.a \ - $(OPTLIBS) $(LIBBLKID) $(LIBPTHREAD) -luuid + $(OPTLIBS) $(LIBBLKID) $(LIBPTHREAD) \ + -luuid +if CONFIG_REEXPORT +exportd_LDADD += ../../support/reexport/libreexport.a $(LIBSQLITE) -lrt +endif exportd_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS) \ -I$(top_srcdir)/support/export +exportd_CPPFLAGS += -I$(top_srcdir)/support/reexport + MAINTAINERCLEANFILES = Makefile.in #######################################################################
utils/exportd/exportd.c +2 -0
@@ -22,6 +22,7 @@#include "conffile.h" #include "exportfs.h" #include "export.h" +#include "reexport.h" extern void my_svc_run (void );
@@ -296,6 +297,7 @@ main(int argc, char **argv)/* Open files now to avoid sharing descriptors among forked processes */ cache_open ();v4clients_init (); +reexpdb_init ();/* Process incoming upcalls */ cache_process_loop ();
utils/mountd/Makefile.am +6 -0
@@ -20,10 +20,16 @@ mountd_LDADD = ../../support/export/libexport.a \ $(OPTLIBS) \ $(LIBBSD) $(LIBWRAP) $(LIBNSL) $(LIBBLKID) -luuid $(LIBTIRPC) \ $(LIBPTHREAD) +if CONFIG_REEXPORT +mountd_LDADD += ../../support/reexport/libreexport.a $(LIBSQLITE) -lrt +endif + mountd_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS) \ -I$(top_builddir)/support/include \ -I$(top_srcdir)/support/export +mountd_CPPFLAGS += -I$(top_srcdir)/support/reexport + MAINTAINERCLEANFILES = Makefile.in #######################################################################
Signature · 1 line
2.31.1
RFC PATCH 4/6 export: Record mounted volumes
In reply to Richard WeinbergerAs soon a client mounts a volume, record it in the database to be able to uncover NFS subvolumes after a reboot.
--- support/export/cache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
support/export/cache.c +3 -1
@@ -967,8 +967,10 @@ static void nfsd_fh(int f)* line. */ qword_addint (&bp, &blen,0x7fffffff ); -if (found) +if (found) { +reexpdb_add_subvolume (found_path);qword_add (&bp, &blen, found_path); + }qword_addeol (&bp, &blen);if (blen <=0 ||cache_write (f, buf, bp - buf) != bp - buf)xlog (L_ERROR ,"nfsd_fh: error writing reply" );
Signature · 1 line
2.31.1
RFC PATCH 5/6 nfsd: statfs() every known subvolume upon start
In reply to Richard WeinbergerThis will trigger an automount of a subvolume and existing file handles will continue to work.
--- utils/nfsd/Makefile.am | 6 ++++++ utils/nfsd/nfsd.c | 10 ++++++++++ 2 files changed, 16 insertions(+)
utils/nfsd/Makefile.am +6 -0
@@ -11,6 +11,12 @@ noinst_HEADERS = nfssvc.h nfsd_SOURCES = nfsd.c nfssvc.c nfsd_LDADD = ../../support/nfs/libnfs.la $(LIBTIRPC) +if CONFIG_REEXPORT +nfsd_LDADD += ../../support/reexport/libreexport.a $(LIBSQLITE) $(LIBPTHREAD) -lrt +endif + +nfsd_CPPFLAGS = -I$(top_srcdir)/support/reexport + MAINTAINERCLEANFILES = Makefile.in #######################################################################
utils/nfsd/nfsd.c +10 -0
@@ -29,6 +29,7 @@#include "nfssvc.h" #include "xlog.h" #include "xcommon.h" +#include "reexport.h" #ifndef NFSD_NPROC #define NFSD_NPROC 8
@@ -347,6 +348,15 @@ main(int argc, char **argv)exit (1 ); } +/* +* Make sure that uncovered NFS subvolumes are present such that +* existing file handles continue working. +*/ +if (reexpdb_init () ==0 ) { +reexpdb_uncover_subvolumes (NULL ); +reexpdb_destroy (); + } +/* make sure nfsdfs is mounted if it's available */ nfssvc_mount_nfsdfs (progname);
Signature · 1 line
2.31.1
RFC PATCH 6/6 export: Garbage collect orphaned subvolumes upon start
In reply to Richard WeinbergerMake sure the database contains no orphaned subvolumes. We have to be careful.
--- support/export/cache.c | 97 +++++++++++++++++++++++++++++++++++++++++ support/export/export.h | 3 ++ utils/exportd/exportd.c | 17 +++++++- utils/mountd/mountd.c | 1 + utils/mountd/svc_run.c | 18 ++++++++ 5 files changed, 135 insertions(+), 1 deletion(-)
support/export/cache.c +97 -0
@@ -1181,6 +1181,103 @@ lookup_export(char *dom, char *path, struct addrinfo *ai)return found; } +static char *get_export_path (char *path) +{ +int i; +nfs_export *exp; +nfs_export *found =NULL ; + +for (i =0 ; i <MCL_MAXTYPES ; i++) { +for (exp = exportlist[i].p_head; exp; exp = exp->m_next) { +if (!path_matches (exp, path)) +continue ; + +if (!found) { + found = exp; +continue ; + } + +/* Always prefer non-V4ROOT exports */ +if (exp->m_export.e_flags &NFSEXP_V4ROOT ) +continue ; +if (found->m_export.e_flags &NFSEXP_V4ROOT ) { + found = exp; +continue ; + } + +/* If one is a CROSSMOUNT, then prefer the longest path */ +if (((found->m_export.e_flags &NFSEXP_CROSSMOUNT ) || + (exp->m_export.e_flags &NFSEXP_CROSSMOUNT )) && +strlen (found->m_export.e_path) != +strlen (exp->m_export.e_path)) { + +if (strlen (exp->m_export.e_path) > +strlen (found->m_export.e_path)) { + found = exp; + } +continue ; + } + } + } + +if (found) +return found->m_export.e_path; +else +return NULL ; +} + +int export_subvol_orphaned (char *path) +{ +struct statfs st, stp; +char *path_parent; +int ret; + + path_parent =get_export_path (path); +if (!path_parent) +/* +* Path has no parent in export list. +* Must be orphaned. +*/ +return 1 ; + + ret =statfs (path_parent, &stp); +if (ret ==-1 ) +/* +* Parent path is not statfs'able. Maybe not yet mounted? +* Can't be sure, don't treat path as orphaned. +*/ +return 0 ; + +if (strcmp (path_parent, path) ==0 ) +/* +* This is not a subvolume, it is listed in exports. +* No need to keep tack of it. +*/ +return 1 ; + +if (stp.f_type !=0x6969 ) +/* +* Parent is not a NFS mount. Maybe not yet mounted? +* Can't be sure either. +*/ +return 0 ; + + ret =statfs (path, &st); +if (ret ==-1 ) { +if (errno ==ENOENT ) +/* +* Parent is a NFS mount but path is gone. +* Must be orphaned. +*/ +return 1 ; + } + +/* +* For all remaining cases we can't be sure either. +*/ +return 0 ; +} +#ifdef HAVE_JUNCTION_SUPPORT #include <libxml/parser.h>
support/export/export.h +3 -0
@@ -38,4 +38,7 @@ static inline bool is_ipaddr_client(char *dom) {return dom[0 ] =='$' ; } + +int export_subvol_orphaned (char *path); +#endif /* EXPORT__H */
utils/exportd/exportd.c +16 -1
@@ -208,6 +208,12 @@ read_exportd_conf(char *progname, char **argv) default_ttl = ttl; } +static void subvol_cb (char *path) +{ +if (export_subvol_orphaned (path)) +reexpdb_drop_subvolume_unlocked (path); +} +int main (int argc,char **argv) {
@@ -297,7 +303,16 @@ main(int argc, char **argv)/* Open files now to avoid sharing descriptors among forked processes */ cache_open ();v4clients_init (); -reexpdb_init (); +if (reexpdb_init () !=0 ) { +xlog (L_ERROR ,"%s: Failed to init reexport database" , __func__); +exit (1 ); + } + +/* +* Load exports into memory and garbage collect orphaned subvolumes. +*/ +auth_reload (); +reexpdb_uncover_subvolumes (subvol_cb);/* Process incoming upcalls */ cache_process_loop ();
utils/mountd/mountd.c +1 -0
@@ -32,6 +32,7 @@#include "nfsd_path.h" #include "nfslib.h" #include "export.h" +#include "reexport.h" extern void my_svc_run (void );
utils/mountd/svc_run.c +18 -0
@@ -57,6 +57,7 @@#include <rpc/rpc_com.h> #endif #include "export.h" +#include "reexport.h" void my_svc_run (void );
@@ -87,6 +88,12 @@ my_svc_getreqset (fd_set *readfds)#endif +static void subvol_cb (char *path) +{ +if (export_subvol_orphaned (path)) +reexpdb_drop_subvolume_unlocked (path); +} +/* * The heart of the server. A crib from libc for the most part... */
@@ -96,6 +103,17 @@ my_svc_run(void)fd_set readfds;int selret; +if (reexpdb_init () !=0 ) { +xlog (L_ERROR ,"%s: Failed to init reexport database" , __func__); +return ; + } + +/* +* Load exports into memory and garbage collect orphaned subvolumes. +*/ +auth_reload (); +reexpdb_uncover_subvolumes (subvol_cb); +for (;;) { readfds = svc_fdset;
Signature · 1 line
2.31.1
Quoted 5 lines · Richard Weinberger
This is the second iteration of the NFS re-export improvement series for nfs-utils. While the kernel side didn't change at all and is still small,
the userspace side saw much more changes.
Please note that this is still an RFC, there is room for improvement.
Quoted 10 lines
The core idea is adding new export option: reeport=
Using reexport= it is possible to mark an export entry in the exports file explicitly as NFS re-export and select a strategy how unique identifiers should be provided.
"remote-devfsid" is the strategy I have proposed in my first patch,
I understand that this one is dangerous. But I still find it useful in some situations.
"auto-fsidnum" and "predefined-fsidnum" are new and use a SQLite database as backend to keep track of generated ids.
For a more detailed description see patch "exports: Implement new export option reexport=".
Thanks, I'll try to take a look.
Before upstreaming, I would like us to pick just one. These kind of options tend to complicate testing and documentation and debugging.
For an RFC, though, I think it makes sense, so I'm fine with keeping "reexport=" while we're still exploring the different options. And, hey, maybe we end up adding more than one after we've upstreamed the first one.
Quoted 14 lines
I choose SQLite because nfs-utils already uses it and using SQL ids can nicely generated and maintained. It will also scale for large setups where the amount of subvolumes is high.
Beside of id generation this series also addresses the reboot problem. If the re-exporting NFS server reboots, uncovered NFS subvolumes are not yet mounted and file handles become stale.
Now mountd/exportd keeps track of uncovered subvolumes and makes sure they get uncovered while nfsd starts.The whole set of features is currently opt-in via --enable-reexport. I'm also not sure about the rearrangement of the reexport code, currently it is a helper library.
Quoted 7 lines
Please let me know whether you like this approach. If so I'd tidy it up and submit it as non-RFC.
TODOs/Open questions:
- When re-exporting, fs.nfs.nfs_mountpoint_timeout should be set to 0
to make subvolumes not vanish.
Is this something exportfs should do automatically when it sees an export entry with a reexport= option?
Setting the timeout to 0 doesn't help with re-export server reboots. After a reboot is another case where we could end up in a situation where a client hands us a filehandle for a filesystem that isn't mounted yet.
I think you want to keep a path with each entry in the database. When mountd gets a request for a filesystem it hasn't seen before, it stats that path, which should trigger the automounts.
And it'd be good to have a test case with a client (Linux client or pynfs) that, say, opens a file several mounts deep, then reboots the reexport server, then tries to, say, write to the file descriptor after the reboot. (Or maybe there's a way to force the mounts to expire as a shortcut instead of doing a full reboot.)
Quoted 7 lines
- exportd saw only minimal testing so far, I wasn't aware of it yet. :-S
- Currently wtere is no way to release the shared memory which contains the database lock. I guess it could be released via exportfs -f, which is the very last exec in nfs-server.service
- Add a tool to import/export entries from the reexport database which obeys the shared lock.
- When doingv4->v4orv3->v4re-exports very first read access to a file block a few seconds until the client does a retransmit.
v3->v3works fine. More investigation needed.
Might want to strace mountd and look at the communication over the /proc/fs/nfsd/*/channel files, maybe mountd is failing to respond to an upcall.
--b.
Quoted 41 lines
Looking forward for your feedback!
Thanks,
//richardRichard Weinberger (6):
Implement reexport helper library
exports: Implement new export option reexport=
export: Implement logic behind reexport=
export: Record mounted volumes
nfsd:statfs()every known subvolume upon start
export: Garbage collect orphaned subvolumes upon startconfigure.ac | 12 + support/Makefile.am | 4 + support/export/Makefile.am | 2 + support/export/cache.c | 241 +++++++++++++++++- support/export/export.h | 3 + support/include/nfslib.h | 1 + support/nfs/Makefile.am | 1 + support/nfs/exports.c | 73 ++++++ support/reexport/Makefile.am | 6 + support/reexport/reexport.c | 477 +++++++++++++++++++++++++++++++++++ support/reexport/reexport.h | 53 ++++ utils/exportd/Makefile.am | 8 +- utils/exportd/exportd.c | 17 ++ utils/exportfs/Makefile.am | 4 + utils/mount/Makefile.am | 6 + utils/mountd/Makefile.am | 6 + utils/mountd/mountd.c | 1 + utils/mountd/svc_run.c | 18 ++ utils/nfsd/Makefile.am | 6 + utils/nfsd/nfsd.c | 10 + 20 files changed, 934 insertions(+), 15 deletions(-) create mode 100644 support/reexport/Makefile.am create mode 100644 support/reexport/reexport.c create mode 100644 support/reexport/reexport.hSignature · 1 line
2.31.1
Bruce,
----- Ursprüngliche Mail -----
Quoted 30 lines
Von: "bfields" <[email protected]>
An: "richard" <[email protected]>
CC: "linux-nfs" <[email protected]>, "david" <[email protected]>, "luis turcitu" <[email protected]>, "david young" <[email protected]>, "david oberhollenzer" <[email protected]>, "trond myklebust" <[email protected]>, "anna schumaker" <[email protected]>, "chris chilvers" <[email protected]>
Gesendet: Donnerstag, 17. Februar 2022 17:33:32
Betreff: Re: [RFC PATCH 0/6] nfs-utils: Improving NFS re-exportsQuoted 6 lines · Richard Weinberger
This is the second iteration of the NFS re-export improvement series for nfs-utils.
While the kernel side didn't change at all and is still small, the userspace side saw much more changes.
Please note that this is still an RFC, there is room for improvement.Quoted 11 lines
The core idea is adding new export option: reeport=
Using reexport= it is possible to mark an export entry in the exports file explicitly as NFS re-export and select a strategy how unique identifiers should be provided.
"remote-devfsid" is the strategy I have proposed in my first patch, I understand that this one is dangerous. But I still find it useful in some situations.
"auto-fsidnum" and "predefined-fsidnum" are new and use a SQLite database as backend to keep track of generated ids.
For a more detailed description see patch "exports: Implement new export option reexport=".Thanks, I'll try to take a look.
Quoted 7 lines
Before upstreaming, I would like us to pick just one. These kind of options tend to complicate testing and documentation and debugging.
For an RFC, though, I think it makes sense, so I'm fine with keeping "reexport=" while we're still exploring the different options. And, hey, maybe we end up adding more than one after we've upstreamed the first one.
Which one do you prefer?
"predefined-fsidnum" should be the safest one to start.
Quoted 5 lines
Quoted 4 lines
- When re-exporting, fs.nfs.nfs_mountpoint_timeout should be set to 0 to make subvolumes not vanish.
Is this something exportfs should do automatically when it sees an export entry with a reexport= option?
Quoted 8 lines
Setting the timeout to 0 doesn't help with re-export server reboots. After a reboot is another case where we could end up in a situation where a client hands us a filehandle for a filesystem that isn't mounted yet.
I think you want to keep a path with each entry in the database. When mountd gets a request for a filesystem it hasn't seen before, it stats that path, which should trigger the automounts.
I have implemented that already. This feature is part of this series. :-)
Quoted 5 lines
And it'd be good to have a test case with a client (Linux client or pynfs) that, say, opens a file several mounts deep, then reboots the reexport server, then tries to, say, write to the file descriptor after the reboot. (Or maybe there's a way to force the mounts to expire as a shortcut instead of doing a full reboot.)
Okay, I'll test that.
Quoted 12 lines
Quoted 11 lines
- exportd saw only minimal testing so far, I wasn't aware of it yet. :-S
- Currently wtere is no way to release the shared memory which contains the database lock.
I guess it could be released via exportfs -f, which is the very last exec in nfs-server.service
- Add a tool to import/export entries from the reexport database which obeys the shared lock.
- When doingv4->v4orv3->v4re-exports very first read access to a file block a few seconds until
the client does a retransmit.
v3->v3works fine. More investigation needed.
Quoted 3 lines
Might want to strace mountd and look at the communication over the
/proc/fs/nfsd/*/channelfiles, maybe mountd is failing to respond to an upcall.
Ahh. The upcall might be the issue. Thanks for the pointer.
Thanks,
//richard
Quoted 6 lines · Richard Weinberger
Quoted 6 lines
Von: "bfields" <[email protected]>
Thanks, I'll try to take a look.Before upstreaming, I would like us to pick just one. These kind of options tend to complicate testing and documentation and debugging.
Quoted 7 lines
Quoted 4 lines
For an RFC, though, I think it makes sense, so I'm fine with keeping "reexport=" while we're still exploring the different options. And, hey, maybe we end up adding more than one after we've upstreamed the first one.
Which one do you prefer?
"predefined-fsidnum" should be the safest one to start.
I don't know! I'll have to do some more reading and think about it.
Quoted 10 lines
Quoted 8 lines
Setting the timeout to 0 doesn't help with re-export server reboots. After a reboot is another case where we could end up in a situation where a client hands us a filehandle for a filesystem that isn't mounted yet.
I think you want to keep a path with each entry in the database. When mountd gets a request for a filesystem it hasn't seen before, it stats that path, which should trigger the automounts.
I have implemented that already. This feature is part of this series. :-)
Oh, good, got it. It'll take me some time to catch up.
--b.
----- Ursprüngliche Mail -----
Quoted 5 lines
Von: "bfields" <[email protected]>
Quoted 2 lines
Which one do you prefer?
"predefined-fsidnum" should be the safest one to start.I don't know! I'll have to do some more reading and think about it.
No need to worry, take your time.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Setting the timeout to 0 doesn't help with re-export server reboots. After a reboot is another case where we could end up in a situation where a client hands us a filehandle for a filesystem that isn't mounted yet.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
I think you want to keep a path with each entry in the database. When mountd gets a request for a filesystem it hasn't seen before, it stats that path, which should trigger the automounts.
I have implemented that already. This feature is part of this series. :-)
Oh, good, got it. It'll take me some time to catch up.
The reason why setting the timeout to 0 is still needed is because when mountd uncovers a subvolume but no client uses it a filehandle, it is not locked and can be unmounted later.
Only when nfsd sees a matching filehandle the reference counter will be increased and umounting is no longer possible.
Thanks,
//richard
Quoted 20 lines · Richard Weinberger
----- Ursprüngliche Mail -----
Quoted 5 lines
Von: "bfields" <[email protected]>
Quoted 2 lines
Which one do you prefer?
"predefined-fsidnum" should be the safest one to start.I don't know! I'll have to do some more reading and think about it.
No need to worry, take your time.
Quoted 11 lines
Quoted 10 lines
Quoted 8 lines
Setting the timeout to 0 doesn't help with re-export server reboots. After a reboot is another case where we could end up in a situation where a client hands us a filehandle for a filesystem that isn't mounted yet.
I think you want to keep a path with each entry in the database. When mountd gets a request for a filesystem it hasn't seen before, it stats that path, which should trigger the automounts.
I have implemented that already. This feature is part of this series. :-)
Quoted 7 lines
Quoted 1 line
Oh, good, got it. It'll take me some time to catch up.
The reason why setting the timeout to 0 is still needed is because when mountd uncovers a subvolume but no client uses it a filehandle, it is not locked and can be unmounted later.
Only when nfsd sees a matching filehandle the reference counter will be increased and umounting is no longer possible.
I understand that. But, then if a client comes in with a matching filehandle, mountd should be able to look up the filesystem and trigger a new mount, right?
I can imagine that setting the timeout to 0 might be an optimization, but I'm not seeing why it's required for correct behavior.
--b.
----- Ursprüngliche Mail -----
Quoted 10 lines
Von: "bfields" <[email protected]>
Quoted 5 lines
The reason why setting the timeout to 0 is still needed is because when mountd uncovers a subvolume but no client uses it a filehandle, it is not locked and can be unmounted later.
Only when nfsd sees a matching filehandle the reference counter will be increased and umounting is no longer possible.I understand that. But, then if a client comes in with a matching filehandle, mountd should be able to look up the filesystem and trigger a new mount, right?
This does not match what I saw in my experiments. The handle machted only when the subvolume was mounted before.
But I understand now your point, in theory it should work. I'll investigate into this.
Thanks,
//richard
Bruce,
----- Ursprüngliche Mail -----
Quoted 21 lines
Von: "bfields" <[email protected]>
Quoted 6 lines · Richard Weinberger
This is the second iteration of the NFS re-export improvement series for nfs-utils.
While the kernel side didn't change at all and is still small, the userspace side saw much more changes.
Please note that this is still an RFC, there is room for improvement.Quoted 11 lines
The core idea is adding new export option: reeport=
Using reexport= it is possible to mark an export entry in the exports file explicitly as NFS re-export and select a strategy how unique identifiers should be provided.
"remote-devfsid" is the strategy I have proposed in my first patch, I understand that this one is dangerous. But I still find it useful in some situations.
"auto-fsidnum" and "predefined-fsidnum" are new and use a SQLite database as backend to keep track of generated ids.
For a more detailed description see patch "exports: Implement new export option reexport=".
Quoted 1 line
Thanks, I'll try to take a look.
Did you find some cycles to think about which approach you prefer?
Thanks,
//richard
Quoted 1 line · Richard Weinberger
Did you find some cycles to think about which approach you prefer?
I haven't. I'll try to take a look in the next couple days. Thanks for the reminder.
--b.
Quoted 5 lines · bfields
Quoted 1 line · Richard Weinberger
Did you find some cycles to think about which approach you prefer?
I haven't. I'll try to take a look in the next couple days. Thanks for the reminder.
Is there any movement on this?? I would be good to have some for the upcoming Bakeathon... Next week.
steved.
----- Ursprüngliche Mail -----
Quoted 9 lines · bfields
Quoted 5 lines · Richard Weinberger
Quoted 1 line
Did you find some cycles to think about which approach you prefer?
I haven't. I'll try to take a look in the next couple days. Thanks for the reminder.
Is there any movement on this?? I would be good to have some for the upcoming Bakeathon... Next week.
I'm in the middle of preparing the next version of the series.
Thanks,
//richard