[PATCH 4/6] v4set_root: force "fsid=0" for all exports of '/'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When "fsid=0" is not explicitly given in /etc/exports,
v4set_root creates a pseudo (NFSEXP_V4ROOT) export for '/'
with fsid 0 so that an NFSv4 client can find the root.

However if '/' is explicitly exported to the client, then that
explicit export must be used, and it will not have fsid=0.
So we must impose fsid=0 on all exports of '/'.
Without this, if '/' is exported to a client, that client will
not be able to mount '/' with NFSv4.

Signed-off-by: NeilBrown <neilb@xxxxxxx>
---

 utils/mountd/v4root.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/utils/mountd/v4root.c b/utils/mountd/v4root.c
index 81f813b..b4fdcce 100644
--- a/utils/mountd/v4root.c
+++ b/utils/mountd/v4root.c
@@ -192,6 +192,13 @@ v4root_set()
 				 */
 				continue;
 
+			if (strcmp(exp->m_export.e_path, "/") == 0 &&
+			    !(exp->m_export.e_flags & NFSEXP_FSID)) {
+				/* Force '/' to be exported as fsid == 0*/
+				exp->m_export.e_flags |= NFSEXP_FSID;
+				exp->m_export.e_fsid = 0;
+			}
+
 			v4root_add_parents(exp);
 			/* XXX: error handling! */
 		}


--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux